﻿ 改进的跨尺度引导滤波立体匹配算法
 计算机系统应用  2019, Vol. 28 Issue (4): 176-182 PDF

Improved Stereo Matching Algorithm Based on Cross-Scale Guided Filtering
DU Chen-Rui, LI Ying-Xiang
School of Communication Engineering, Chengdu University of Information Technology, Chengdu 610225, China
Abstract: As a key step in binocular 3D reconstruction, the binocular stereo matching algorithm completes the transformation from planar vision to stereo vision. But how to balance the running speed and accuracy of the binocular stereo matching algorithm is still a difficult problem. In this study, focused on that existing local stereo matching algorithm has low matching accuracy in specific regions such as weak texture and depth discontinuity, while considered the real-time performance of the algorithm at the same time, an improved stereo matching algorithm based on cross-scale guided filtering is proposed. Firstly, the two cost calculation methods of SAD and Census transform are combined, and then the cost aggregation is performed by using cross-scale guided filtering. When calculating the disparity calculation, a judgment criterion is used to judge the reliance of the disparity value corresponding to the minimum aggregation cost of each pixel in the image. When it is judged that the corresponding disparity value is unreliable, an adaptive window based on gradient similarity is constructed for the pixel, and the disparity value corresponding to the pixel is corrected based on the adaptive window. Finally, the final disparity map is obtained by parallax refinement. Experimental results on standard stereo image pairs on the Middlebury test platform show higher accuracy than traditional guided filter based stereo matching algorithms.
Key words: stereo matching     matching cost     multi-scale     guided filtering     adaptive window

1 引导滤波

I为引导图像, p为待滤波图像, q为滤波后图像, 引导滤波基于如下假设: 在以各个像素为中心的窗口 ${\omega _k}$ 内, qI线性转换得到:

 ${q_i} = {a_k}{I_i} + {b_k},\forall i \in {\omega _k}$ (1)
 ${q_i} = {p_i} - {n_i},\forall i \in {\omega _k}$ (2)

 ${{E}}\left( {{a_k},{b_k}} \right) = \mathop \sum \limits_{i \in {\omega _k}} \left[ {{{\left( {{a_k}{I_i} + {b_k} - {p_i}} \right)}^2} + \varepsilon a_k^2} \right]$ (3)

 ${a_k} = \dfrac{{\dfrac{1}{{\left| \omega \right|}}\displaystyle\mathop \sum \nolimits_{i \in {\omega _k}} {I_i}{p_i} - {\mu _k}{p_k}}}{{\sigma _k^2 + \varepsilon }}$ (4)
 ${b_k} = {p_k} - {a_k}{\mu _k}$ (5)

2 本文算法

 图 1 算法流程图

2.1 代价计算

 ${C_{AD}}\left( {{p_i},d} \right) = \frac{1}{3}\mathop \sum \limits_{c \in \left[ {r,g,b} \right]} I_l^c\left( {{\omega _i}} \right) - I_r^c\left( {{\omega _i}} \right)$ (6)
 ${\rm{I}}\left( {{\omega _i}} \right) = \frac{1}{N}\mathop \sum \limits_{j \in {w_i}} {p_j}$ (7)

 ${C_{\rm{census}}}\left( {{p_i},d} \right) = Ham\left( {ce{n_l}\left( {{p_i}} \right),ce{n_r}\left( {{p_i}} \right)} \right)$ (8)

 ${{C}}\left( {{p_i},d} \right) = \rho \left( {{C_{\rm{census}}}\left( {{p_l},d} \right),{\lambda _{\rm{census}}}} \right) + \rho \left( {{C_{AD}}\left( {{p_l},d} \right),{\lambda _{AD}}} \right)$ (9)

 $\rho \left( {C,\lambda } \right) = 1 - {\rm{exp}}\left( { - \frac{C}{\lambda }} \right)$ (10)

2.2 跨尺度引导图像滤波

 $\tilde C\left( {i,d} \right) = {\rm{argmin}}{_z}\frac{1}{{{Z_i}}}\mathop \sum \limits_{j \in {\omega _i}} K\left( {i,j} \right)z - C{\left( {j,d} \right)^2}$ (11)

 \begin{aligned} \tilde C\left( {{i^s},{d^s}} \right) &= {\rm{argmin}}{_{{z^s}_{s = 0}^s}} \left( \mathop \sum \limits_{s = 0}^S \frac{1}{{Z_{{i^s}}^S}}\mathop \sum \limits_{{j^s} \in N_i^s} K\left( {{i^s},{j^s}} \right){z^s}\right.\\ &\left.- {C^s}{{\left( {{j^s},{d^s}} \right)}^2} + \gamma \mathop \sum \limits_{s = 1}^S {z^s} - {z^{s - 1}}^2 \right)\end{aligned} (12)

2.3 视差计算

 ${C_d} = \frac{{{C_{i,1}}}}{{{C_{i,2}}}}$ (13)
 ${C_i} = \left\{ {\begin{array}{*{20}{c}} {{C_{i,1}},{C_d} \le {C_{th}}}\\ {g\left( {C\left( {i,d} \right)} \right),{C_d} > {C_{th}}} \end{array}} \right.$ (14)

 图 2 基于梯度相似性的自适应窗口

 $h_{i}^{r}=\text{max}\left[ {r}{\mathop{\prod_{{\begin{matrix} j\in \left[ 1,2,3,\cdots, N \right],\\ {{x}_{j}}\in \left[ {{x}_{i}}+1,{{x}_{i}}+r \right],\\ {{y}_{j}}={{y}_{i}} ,\\ r\in \left[ 1,L \right] \\ \end{matrix}}} }}\,g\left( j-1,j \right) \right]$ (15)
 $g\left( {j - 1,j} \right) = \left\{ {\begin{array}{*{20}{l}} {1,\;\;\dfrac{1}{3}\displaystyle\mathop \sum \limits_{c \in \left[ {r,g,b} \right]} \left| {G_x^c\left( {j - 1} \right) - G_x^c\left( j \right)} \right| \leqslant \partial } \\ {0,\;\;{\rm{other}}} \end{array}} \right.$ (16)

 ${H_i} = \left\{ {\left( {x,y} \right)|x \in \left[ {{x_i} - h_i^l,{x_i} + h_i^r} \right],y = {y_i}} \right\}$ (17)
 ${V_i} = \left\{ \left( {x,y} \right)|y \in \left[ {{y_i} - v_i^u,{y_i} + v_i^b} \right]\right\}$ (18)

 ${U_i} = \bigcup\limits_{j \in {V_i}} {{H_j}}$ (19)

 $g\left( {C\left( {i,d} \right)} \right) = {\rm{argmin}}\mathop \sum \limits_{j \in {U_i}} {C_{j,l}}$ (20)

3 实验结果与分析

3.1 结果与分析

3.2 参数分析

 图 3 标准图像对不同方法下的视差图对比

 图 4 不同 ${C_{th}}$ 取值下的误匹配率

 图 5 不同 $\partial$ 取值下的误匹配率

4 结论

 [1] Scharstein D, Szeliski R. A taxonomy and evaluation of dense two-frame stereo correspondence algorithms. International Journal of Computer Vision, 2002, 47(1): 7-42. [2] Zabih R, Woodfill J. Non-parametric local transforms for computing visual correspondence. Proceedings of the third European Conference on Computer Vision (Vol. II). Stockholm, Sweden. 1994. 151–158. [3] Mei X, Sun X, Zhou MC, et al. On building an accurate stereo matching system on graphics hardware. Proceedings of 2011 IEEE International Conference on Computer Vision Workshops. Barcelona, Spain. 2011. 467–474. [4] Zhu SP, Yan L. Local stereo matching algorithm with efficient matching cost and adaptive guided image filter. The Visual Computer, 2017, 33(9): 1087-1102. DOI:10.1007/s00371-016-1264-6 [5] Yoon KJ, Kweon IS. Adaptive support-weight approach for correspondence search. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2006, 28(4): 650-656. DOI:10.1109/TPAMI.2006.70 [6] Hosni A, Rhemann C, Bleyer M, et al. Fast cost-volume filtering for visual correspondence and beyond. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2013, 35(2): 504-511. DOI:10.1109/TPAMI.2012.156 [7] Zhu SP, Yan LN, Li Z. Stereo matching algorithm based on improved Census transform and dynamic programming. Acta Optica Sinica, 2016, 36(4): 0415001. [8] He KM, Sun J, Tang XO. Guided image filtering. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2013, 35(6): 1397-1409. DOI:10.1109/TPAMI.2012.213 [9] Milanfar P. A tour of modern image filtering: New insights and methods, both practical and theoretical. IEEE Signal Processing Magazine, 2013, 30(1): 106-128. DOI:10.1109/MSP.2011.2179329 [10] Zhang K, Fang YQ, Min DB, et al. Cross-scale cost aggregation for stereo matching. IEEE Transactions on Circuits and Systems for Video Technology, 2017, 27(5): 965-976. DOI:10.1109/TCSVT.2015.2513663 [11] Hirschmüller H, Innocent PR, Garibaldi J. Real-time correlation-based stereo vision with reduced border errors. International Journal of Computer Vision, 2002, 47(1–3): 229-246. [12] Scharstein D, Szeliski R, Hirschmüller H. The middlebury stereo vision page. http://vision.middlebury.edu/stereo/.