# Mapping with Pleiades--End-to-End Workflow
## 4 Methods
### Digital Terrain Model Generation
#### 4.3.3 Multi-Directional Filtering Approach  
The second algorithmic extension concerns the data processing scheme in terms of scanlines. As stated above, consideration of only one scanline direction from left to right yields a local solution and the filtering result could abruptly change within two adjacent pixels from two neighboring scanlines. Instead, we propose to use 8 scanlines and fuse the results for final pixel classification. The principal concept to solve a problem in 2D by fusing multiple 1D solutions is based on the work of Reference [61]. In the presented case the fusion is simply based on majority voting. If more than 5 scanlines classify the current point as a ground point, this point is classified as ground point, else as non-ground point. This aspect is very important for satellite stereo DSMs, as some scanlines may classify a non-ground point incorrectly (e.g., due to a smooth height transition) while the combination of classifications achieved from 8 directions certainly helps to improve final pixel classification accuracy. The complete novel algorithm is described in Algorithm 1 resulting in a ground and a non-ground label image. Instead of processing each scanline sequentially, the image can be scanned in two passes, first from the upper-left to the lower-right corner and second from the lower-right to the upper-left corner, processing four scanlines at each pass (cf. Figure 16). Doing so, image data has to be read only once and instead of storing eight label images, one label image can be used to sum up all ground pixels, followed by thresholding as stated above. This specific processing reduces the memory consumption by a factor of 8 and results in a minor speed-up since the input data is only read once. Figure 14: DSM profiles for an artificial building on a tilted surface with added noise: (**a**) Original DSM profile and the minimal height value (black) within the window (blue). (**b**) Robust fit of the surface (green). (**c**) Slope corrected DSM profile and the according minimal height value. Figure 16: Concept of splitting 8 scanlines spanning the 2D image space (**a**) into 2 passes (**b**) down-right and (**c**) up-left. Figure 15: Comparison of robust terrain slope fit to the proposed simple fit. (**a**) shows a subset of a DSM and (**b**) its Gaussian filtered variant. (**c**) visualizes the profile of the DSM along the green arrow together with the terrain slope fits and the corrected profiles. ```
Input:
1 DSM // Digital surface model. 2 Spacing // Spacing of DSM in meters. 3 DSMsmooth // Smoothed DSM. 4 Dir // Scanline direction represented as two integer shifts ShiftX and ShiftY. 5 ExtendMetric // Filter extend in meters, // converted to pixels using Spacing and yielding Ext. 6 Ext // Filter extend (odd) which also defines the local // direction dependent neighborhood ExtX(Dir) and ExtY(Dir). 7 X // centered number line with \(X=[-(Ext-1)/2:+(Ext-1)/2]\). 8 ThrHeightDiff // Height difference threshold in meters. 9 ThrSlope // Slope threshold in degrees. Output: Label \(\in\) [Ground,NonGround] // Ground or non-ground classification. 11 Function DSM2 DTM(DSM, Spacing, DSMsmooth, Dir, ExtendMetric, ThrHeightDiff, ThrSlope):
12 foreach ( scanline s ) do // Loop over whole image in x and y direction. 13
14 DSMiff = DSM(x,y) - DSM(x+ShiftX,y+ShiftY) // Local height difference. 15 DSMsmoothDiff = DSMsmooth(x,y) - DSMsmooth(x+ShiftX,y+ShiftY) // Local // terrain slope. 16
17 Neigh = DSM(x+ExtX(Dir),y+ExtY(Dir)) // Neighborhood (proposed filter extend). 18 NeighCorr = Neigh + X^DSMsmoothDiff(x,y) // Slope corrected height values. 19 MinNeigh = min(NeighCorr) // Slope corrected minimal terrain value. 20 HeightDiff = DSM(x,y) - MinNeigh // Difference to minimum. 21 if ( HeightDiff \(>\) ThrHeightDiff ) then
22 Label(x,y,s) = NonGround // Pixel is non-ground. 23
24 else
25 Delta = DSMDiff - DSMsmoothDiff // Slope corrected height difference. 26 SignDelta = -sign(Delta) // Negated sign of Delta. 27 SlopeLocal = atan2(abs(Delta),Spacing))*180/pi // Local slope.