## 2 Methods
### Disparity Refinement by Multi-Constraints-Based Methods  
The initial disparity maps obtained by WTA strategy still have many occluded and mismatched pixels. In this section, multi-constraints-based disparity refinement methods that consist of outlier detection, occlusion/mismatch interpolation, weighted median filter, and subpixel refinement are adopted to handle the disparity errors.  
**Outlier Detection:** In order to find out the outliers in the left and right disparity maps, a left-right consistency check is applied. A pixel \(p\) is labeled as an outlier if it violates the following constraint:  
\[\left|d_{L}(p)-d_{R}(p-d_{L}(p))\right|<1, \tag{14}\]  
Figure 6: Examples of cross-based windows on the Lampshade1 image via various construction approaches. (**a**) [PERSON] et al. [19]; (**b**) [PERSON] et al. [14]; (**c**) proposed construction approach.  
where \(d_{L}(p)\) and \(d_{R}(p-d_{L}(p))\) are the disparities of pixel \(p\) and \(p-d_{L}(p)\) in the left and right disparity maps respectively. Then outliers are further categorized into occlusions and mismatches according to the technique proposed by [PERSON] [35] to better interpolate the disparity of the outlier pixels using different methods in the interpolation step.  
**Occlusion/mismatch interpolation:** In this step, we adopt different interpolation strategies to interpolate the disparities of detected occlusion and mismatch pixels. For an occluded pixel \(p\), a valid non-occluded disparity value from background region is required since occluded areas normally locate on the background. Therefore, we extract the nearest reliable pixels in eight different directions and select the pixel with the lowest disparity value for interpolation. Otherwise, the holes due to mismatches are processed by selecting the pixels with the most similar color value.  
**Weighted median filter:** A weighted median filter [36] is usually implemented following behind the interpolation process to smooth outliers and streak-like artifacts while preserving the object boundaries. In this paper, only the invalid pixels are filtered with bilateral weights, which is computed as:  
\[W^{BF}=exp\Bigg{(}-\frac{\left|p-q\right|^{2}}{\sigma_{s}^{2}}\Bigg{)}exp \Bigg{(}-\frac{\left|I(p)-I(q)\right|^{2}}{\sigma_{c}^{2}}\Bigg{)}, \tag{15}\]  
where \(I(p)\) and \(I(q)\) represent the intensity values of the pixel \(p\) and \(q\). Parameters \(\sigma_{s}\) and \(\sigma_{c}\) adjust the spatial distance and color similarity, respectively. The filter assigns higher weights to pixels spatially close and similar in color.  
**Subpixel refinement:** Finally, a subpixel estimation approach based on quadratic polynomial interpolation is performed to reduce the discontinuities caused by discrete disparity levels [35]. For each pixel \(p\), its optimal sub-pixel disparity valve \(d_{sub}\) is determined by the following formula:  
\[d_{sub}=d-\frac{C^{\prime}(p,d_{+})-C^{\prime}(p,d_{-})}{2(C^{\prime}(p,d_{+ })+C^{\prime}(p,d_{-})-2C^{\prime}(p,d))}, \tag{16}\]  
where \(d\) is the discrete depth with the minimal cost, \(d_{-}=d-1\), and \(d_{+}=d+1\). \(C^{\prime}(p,d)\), \(C^{\prime}(p,d_{+})\), and \(C^{\prime}(p,d_{-})\) denote the aggregated costs with the corresponding disparities, respectively. Finally, a \(3\times 3\) median filter is adopted to remove a few spikes.