## 3 Data and Methods
### DEM Generation with the Ames Stereo Pipeline
#### 3.2.2 Stereo-Correlation Algorithms and Parameters  
Stereo correlation, the process of matching pixels between overlapping images, is the main processing step in optical DEM generation in the ASP or any other software. The map of matching pixels is the disparity map, which contains the vertical and horizontal offsets from the right image pixels (usually treated as moving, or secondary) to the left image pixels (usually treated as reference, or primary). These disparity values between each overlapping pixel are refined and fed into a triangulation phase, where the depth is retrieved and eventually converted to the final elevation values. Many correlation algorithms exist, which were often originally developed in the computer vision communities and later applied to stereogrammetry, leading to further refinement and changes specific to the issues of stereo correlation for satellite imagery. Below, we detail the main popular algorithms that we tested, but we also refer the reader to studies describing the algorithms [36; 37] and the ASP manual [25] section on stereo algorithms ([[https://stereopipeline.readthedocs.io/en/latest/stereo_algorithms.html](https://stereopipeline.readthedocs.io/en/latest/stereo_algorithms.html)]([https://stereopipeline.readthedocs.io/en/latest/stereo_algorithms.html](https://stereopipeline.readthedocs.io/en/latest/stereo_algorithms.html)), last accessed 28 September 2022). Unless mentioned, other processing parameters in the ASP remain at their default settings. The most widely used and well studied [36] correlation algorithm is Block Matching (BM), and it is the default option in the ASP. In this approach, a small window of pixels centered on the pixel of interest is taken from the left image, and a corresponding window is passed locally over the right image to find the matching pixel to calculate the disparity. The window is referred to as the Correlation Kernel (CK) and is by default 25 \(\times\) 25 pixels in size. The pixel selection is performed using a cost function calculated for all pixels, where the minimum cost is selected as the matching pixel. The BM algorithm uses the Normalized Cross Correlation (NCC) to obtain the pixel costs. This results in integer disparity values for all pixels which then need to be refined ina second step to obtain sub-pixel precision. During the sub-pixel refinement stage, a slightly larger Sub-pixel Kernel (SK) is centered on the initial disparity match to improve the pixel matches; however, rather than taking the cost function minimum, improvements are typically achieved using either parabola fitting to the correlation cost surface or a Bayes expectation maximum (Bayes EM) weighted affine adaptive window [25; 38; 39]. The SK defaults to 35 \(\times\) 35 pixels for the BM algorithm. The second correlation algorithm that we investigated in detail is known as More Global Matching (MGM). The MGM algorithm, developed by [PERSON] et al. [40], is a slight improvement on the Semi-Global Matching (SGM) algorithm originally by [PERSON] [37]. MGM differs significantly from the BM approach, in that it takes 8 cost pathways (original implementations can take 2, 4, 8, or 16 pathways) meeting symmetrically at the pixel of interest through the correlation search windows and is able to use much smaller CK and SK windows, both leading to improved matching in areas of low texture or repetitive features. For MGM, the cost function is not restricted to the classic NCC but can use census or ternary census [41] functions for each of the 8 cost pathways. Census cost functions maintain the local ordering of radiometric intensity in a given window, thus improving disparity matches in similar left and right image windows with differences in contrast. As opposed to a traditional census, a ternary census uses 2-bit encoding, and full details of the algorithm can be found in [PERSON] et al. [41]. By default, the MGM CK is set to 7 \(\times\) 7 pixels in the ASP, and the SK is set to 15 \(\times\) 15 pixels.