The T(…) function controls the application of penalties, i.e. the weighting between matching and smoothness
constraints; it is 1 in case that its argument is true and 0 if false. SGM approximates the theoretically desired twodimensional,
global aggregation of matching cost by a number of one-dimensional cost paths for each potential
disparity. A total of eight paths at every 45° is considered sufficient and also used for ADS processing (Gehrke et
al., 2010). The overall cost vector for each base image pixel results from the summation of these eight aggregated
cost vectors at that pixel. Based on that, the final disparity map is provided by the disparities corresponding to the
minimum of each pixel’s summed cost vector. It is generated for the base image and also for the pair image by
switching the role of base and pair images. This reverse matching allows for the elimination of mismatches, which
occur mainly in occluded areas.