# Mapping with Pleiades--End-to-End Workflow
## 4 Methods
### Digital Terrain Model Generation
#### 4.3.2 Consideration of Local Slope  
The main drawback in References [91; 93] is that the local slope of the terrain is not considered in the processing. If this algorithm is used to process regions which are not flat, incorrect filtering occurs since the difference of the current height to the estimated minimal value depends on the terrain slope. If ignored the following height thresholding also removes bare-earth regions. This issue is sketched in Figure 14, where a 1D profile of an artificial DSM to be filtered is given in (a). It shows a tilted surface and a building with some noise. The potential filter extent is visualized as the blue dashed line. The minimal height value within the filter extent is marked as black dot. It is always dragged towards the terrain fall and thus is incorrect (in the example a height of 93.9 m). If we apply a robust terrain slope fitting, the green dashed line in (b) is received. Using that tilt, the initial profile could be slope corrected (c) and the new minimal value can now be correctly extracted (98.7 m in this example).  
In addition to such an incorrect minimal value, the slope estimate of two adjacent DSM values should be corrected w.r.t. the local terrain slope as well.  
The first algorithmic extension is very intuitive and sketched in Figure 14. In the workflow, a robust fit of the height values within the filter extent must be performed. An obvious solution would be to use an iterative weighted least squares method with bisquare (Tukey) or Huber weighting function (cf. Reference [123]). However, this robust fit has to be performed for each pixel and for all scanline directions and thus would slow down the process. Therefore, we propose a heuristic which yields similar results as the robust fit but can be calculated very efficiently. The idea is to smooth the DSM using a huge Gaussian kernel. Local objects like buildings disappear while the terrain slope remains in this smoothed surface. The slope heuristic in the desired direction can then directly be calculated as the pixel difference of two adjacent pixels.  
Therefore, a 2D Gaussian smoothing is implemented with a spatial sigma \(\sigma\) and a kernel size of \(n\times n\) m\({}^{2}\). Per default those parameters are set to \(\sigma=25\) m and \(n=101\) m. The (separable) 2D convolution is implemented as two 1D convolutions for speedup. The pixel difference of the central (smoothed) pixels then defines the local terrain slope value. On the Innsbruck East triplet data set the differences of the robust and heuristic slope estimates have a mean value of 0.05\({}^{\circ}\) with a standard deviation of 1.76\({}^{\circ}\). These differences are small and acceptable, especially taking the speedup into account.  
Figure 15 shows a real example for the downward scanline. Given are a subset of the DSM and the local slope estimate as achieved by smoothing. The plot shows the original 1D DSM profile (black), the robust fit of the terrain slope (green), the proposed simple fit of the terrain slope (cyan) and the robust and simply corrected data (red and blue). It is obvious that the simple and fast Gaussian-based approximation yields very similar results in comparison to the iterative bisquare weighted least squares solution. Actually, initial tests revealed that it is faster by a factor of at least four magnitudes for a filter size of 91 pixels (i.e., a speedup factor of at least 10,000).