# Simplified High-Performance Cost Aggregation for Stereo Matching
## 2 Methods
### The Proposed Aggregation Method
#### 2.2.2 The Second Step: Vertical Aggregation
For images with smaller resolutions, a smaller value of \(\lambda\) is more adequate. 2.3 The Proposed Scheme: Integration of the Texture-Independent Scheme with a Cross-Scale Cost Aggregation Algorithm  
To enhance the matching accuracy of the cost aggregation algorithm derived in the last section, we present its integration with a cross-scale scheme of [20; 30] in this section. This hybrid approach is recommended since higher matching accuracy can be achieved with only a slight increase in computation. Similarly, other algorithms can be integrated with the proposed scheme. The cross-scale scheme of [20; 30], denoted as CS, considers the primary matching costs of various scales. The scheme begins with down-sampling an image pair into \(K\) pairs. For each image pair, a matching cost is calculated according to (20). We denote the matching cost of the \(k\)-th pair as \(\widetilde{\mathcal{C}}_{k}(p,d),\ k\in\{0,1,\,\ldots,K\}\), where \(K\) is the highest pair with the lowest resolution. The framework is derived by introducing an objective function for the cross-scale scheme of [20; 30]:  
\[J_{CS}=\sum_{k=0}^{K}\sum_{q\in\Omega(p)}\left[\widehat{\mathcal{C}}_{k}(p,d) -\widetilde{\mathcal{C}}_{k}(q,d)\right]^{2}+\sum_{z=1}^{K}\gamma^{z}\cdot \left[\widehat{\mathcal{C}}_{k}(p,d)-\widehat{\mathcal{C}}_{k-1}(p,d)\right]^ {2} \tag{21}\]  
Figure 4: \(\mathbf{A}_{v}^{-1}\) as a function of \(\lambda\). The image size is 480-by-720. The plots show the element values of \(\mathbf{A}_{v}^{-1}\) on row 240. (**a**) The value of \(\mathbf{A}_{v}^{-1}\) for different \(\lambda\) values. (**b**) Partial enlargement of (**a**). where \(\gamma\) is a constant constraining factor and \(\Omega(p)\) is the aggregation window centered at \(p\). For \(K=2\) and \(\gamma=1.5\), minimizing (21) with respect to \(\widehat{\mathbf{C}}_{k}\) results in a simple representation that the aggregated matching cost of the zero-layer is  
\[\widehat{\mathbf{C}}_{0}(q,d)=0.56\cdot\frac{\sum\limits_{q\in\Omega(p)}\widetilde {\mathbf{C}}_{0}(q,d)}{|\Omega(p)|}+0.26\cdot\frac{\sum\limits_{q\in\Omega(p)} \widetilde{\mathbf{C}}_{1}(q,d)}{|\Omega(p)|}+0.18\cdot\frac{\sum\limits_{q\in \Omega(p)}\widetilde{\mathbf{C}}_{2}(q,d)}{|\Omega(p)|} \tag{22}\]  
where \(|\Omega(p)|\) is the number of pixels within the aggregation window \(\Omega(p)\). As can be observed in the original scheme [20; 30], the larger the value of \(K\), the more multi-scale features the aggregated matching cost contains. The larger the value of \(\gamma\), the larger the proportion of down-sampled information in the aggregation matching cost, and vice versa. A primary disparity map \(\hat{\mathbf{D}}\) can be obtained using the winner-take-all principle:  
\[\hat{\mathbf{D}}(x,y)=\arg\min_{d\in\{d_{\text{min}}\}d_{\text{max}}}\hat{\mathbf{C}}_ {0}(x,y,d). \tag{23}\]  
To reduce the noise effects on \(\hat{\mathbf{D}}\), we create an updated cost volume based on the primary disparity map of (23):  
\[\overline{\mathbf{C}}^{\prime}(x,y,d)=\ \left\{ \begin{array}{l}\big{|}\hat{\mathbf{D}}(x,y)-d\big{|},\quad\ if\ \ (x,y)\
otin S_{p}\\ 0,\quad\ if\ \ (x,y)\in S_{p}\end{array} \right.\quad, \tag{24}\]  
where \(S_{p}\) is the erroneous region detected via the left-right consistency examination. Implementation details of (21), (22), and (24) can be found in [20]. Finally, we aggregate the updated cost volume using the algorithm of (20):  
\[\overline{\mathbf{C}}^{\prime\prime}=A_{v}^{-1}\cdot\overline{\mathbf{C}}^{\prime} \cdot A_{h}^{-1} \tag{25}\]  
This is the final aggregated matching cost. We can then obtain the final disparity map by applying the winner-take-all computational principle to \(\overline{\mathbf{C}}^{\prime\prime}\) once again.