﻿ 一种基于ORB特征的水下立体匹配方法
 光电工程  2019, Vol. 46 Issue (4): 180456      DOI: 10.12086/oee.2019.180456

An underwater stereo matching method based on ORB features
Li Jiakuan, Sun Chunsheng, Hu Yiming, Yu Hongzhi
Institute of Weapons Engineering, Naval University of Engineering, Wuhan, Hubei 430000, China
Abstract: Since the traditional algorithm may cause problems such as slow running speed and more mismatching points when perform stereo matching on underwater environment, the ORB characteristics detection and curve restriction has been applied in this paper. Firstly the image should be detected so as to find out the characteristics, generate the descriptor, and match the feature points. Then the underwater curve restriction can be deduced according to the law of refraction combining internal and external parameters of camera. Finally the mismatching points can be decreased by means of underwater curve restriction. The experimental results have shown that in the case of effectively controlling mismatches, the speed of this algorithm are faster than traditional SIFT algorithm combined with curve restriction. As a result, it is of practical significance to improve the speed of underwater binocular vision system.
Keywords: binocular stereo vision    underwater stereo matching    feature matching    ORB algorithm    curve restriction

1 引言

2 曲线约束的ORB特征匹配方法 2.1 ORB特征匹配

ORB是一种快速特征点提取和描述的算法，该算法将FAST(features from accelerated segment test)特征点检测和BREIF(binary robust independent elementary features)特征描述子结合起来，并做了一定的优化和改进[11]，其最突出的优点是运算速度极快。一般流程是先提取FAST特征点，然后生成BRIEF描述子，最后以特征点对应的描述子为匹配对象进行匹配。

2.1.1 特征点检测

 $C = \left( {\frac{{{m_{10}}}}{{{m_{00}}}}, \frac{{{m_{01}}}}{{{m_{00}}}}} \right)。$

FAST特征点的方向为特征点F与质心C的夹角：

 $\theta {\rm{ = }}\arctan \left( {\frac{{{m_{01}}}}{{{m_{10}}}}} \right) = \arctan \left( {\frac{{\sum\nolimits_{x, y} {yI(x, y)} }}{{\sum\nolimits_{x, y} {xI(x, y)} }}} \right)。$ (1)

BRIEF描述子则可据此方向确定。

2.1.2 描述子生成

ORB算法使用BRIEF描述子对检测到的特征点进行描述。选取特征点附近若干像素的点对，进行灰度二值化比较，即大于取1，小于取0，将结果存为一个二进制串。则BRIEF描述子即为特征点邻域的若干点灰度值组成的指定次数位二进制串。对图像邻域u，定义一个描述准则函数τ

 $\tau (u;x, y) = \left\{ \begin{array}{l} 1, I(x) < I(y)\\ 0, I(x) \ge I(y) \end{array} \right.,$ (2)

 ${f_m}(u) = \sum\nolimits_{1 \le i \le m} {{2^{i - 1}}\tau (u;{x_i}, {y_i})} 。$ (3)

 $\mathit{\boldsymbol{Q}} = \left[ \begin{array}{l} {x_1} \cdots {x_m}\\ {y_1} \cdots {y_m} \end{array} \right]。$ (4)

2.1.3 特征点匹配

ORB描述算子是m维二进制串，随机选取两幅图像的描述子K1K2

 ${K_1} = ({x_0}, {x_1}, \cdots , {x_m}), {K_{\rm{2}}} = ({y_0}, {y_1}, \cdots , {y_m})。$

 $D({K_1}, {K_2}) = \sum\nolimits_{i = 1}^n {{x_i} \oplus {y_i}} 。$ (5)

$D({K_1}, {K_2})$越小则特征点相似度越高。因为只在同位置进行求异或运算，计算汉明距离比欧氏距离简单，所以运算速度远超过求欧氏距离的SIFT等算法。

2.2 水下极线曲线约束

 图 1 不同条件下的极线约束。(a)空气中的极线约束；(b)不同介质中的曲线约束 Fig. 1 Epipolar constraint in different media. (a) Epipolar constraint in air; (b) Curve constraint in different media

 图 2 折射模型 Fig. 2 Refraction model

 $\left\{ \begin{array}{l} {x_1} = h\tan {\alpha _1}\sin \beta = \frac{h}{f}{x_0}\\ {y_1} = h\tan {\alpha _1}\cos \beta = \frac{h}{f}{y_0}\\ {z_1} = h \end{array} \right.。$ (6)

 $\left\{ \begin{array}{l} {x_2} = (d\tan {\alpha _2} + h\tan {\alpha _1})\sin \beta \\ \;\;\;\;\; = d \times \frac{{{y_0}}}{{\sqrt {{n^2}(x_0^2 + y_0^2 + z_0^2) - (x_0^2 + y_0^2)} }} + \frac{h}{f}{x_0}\\ {y_2} = (d\tan {\alpha _2} + h\tan {\alpha _1})\cos \beta \\ \;\;\;\;\; = d \times \frac{{{x_0}}}{{\sqrt {{n^2}(x_0^2 + y_0^2 + z_0^2) - (x_0^2 + y_0^2)} }} + \frac{h}{f}{y_0}\\ {z_0} = h + d \end{array} \right.,$ (7)

 $\left\{ \begin{array}{l} {x_4} = \frac{f}{h}{x_3}\\ {y_4} = \frac{f}{h}({y_3} - a)\\ {z_4} = f \end{array} \right.。$ (8)

2.3 实验流程

ORB算法通过搜索特征点的最近郊和次近郊特征点，并计算特征点与其最近郊以及次近郊的汉明距离来消除误匹配，对于水下图像，存在误差过大的问题，引入水下曲线极线约束，剔除误匹配点，提高匹配精度。整个算法流程如图 3所示：

 图 3 算法流程 Fig. 3 Steps of the algorithm

1) 特征点检测：

① FAST算子提取图片特征信息；

② 用Harris方法对特征点进行排序；

③ 构造图像金字塔，搜索每一层的FAST特征点；

④ 用灰度质心法确定特征向量方向；

⑤ 根据灰度值的大小选取特征点附近的几个像素点对，构成二进制编码的算子，生成BRIEF描述子。

2) 特征点匹配：

① 用KNN方法寻找特征点最近邻与次近邻，计算汉明距离；

② 比较最近郊距离${D_{\min }}$和次近郊距离${D'_{\min }}$之比与阈值${T_{\rm{r}}}$，进行特征点匹配；

3) 剔除误匹配对：

① 提取参考图的特征点，求出其对应在待匹配图上的曲线极线；

② 用给定一个阈值T剔除误匹配。

3 实验分析 3.1 实验系统

 左相机 右相机 (fx, fy) (352.5668，354.5694) (352.5668，354.5694) (cx, cy) (334.734，191.319) (345.472, 190.423) k (-0.15670，-0.03325，-0.07572) (-0.17060，0.02663，0.00513) R (1，-0.000188，0.013209，0.000177，1，0.000857，-0.013209，-0.000855) T (-119.7177，-0.16548，0.79235)

 图 4 实验系统 Fig. 4 The experimental system
3.2 实验结果

 图 5 两种约束对比 Fig. 5 Contrast the two constraints

 图 6 (a) SIFT加曲线约束；(b)本文算法 Fig. 6 (a) SIFT and curve constraint; (b) Our algorithm

 图 7 (a) SIFT加曲线约束；(b)本文算法 Fig. 7 (a) SIFT and curve constraint; (b) Our algorithm
3.3 数据分析

 算法 图 6场景 图 7场景 SIFT加曲线约束 总匹配对数 41 84 剔除误匹配后的匹配对数 26 54 准确率/% 84.6 87 运算时间/s 3.30 4.12 本文算法 总匹配对数 25 36 剔除误匹配后的匹配对数 16 45 准确率/% 87.5 84.4 运算时间/s 0.41 0.48

 图像编号 11 45 93 97 99 106 SIFT加曲线约束 317 450 340 372 364 413 ORB算法 132 162 206 158 145 173 本文算法 105 114 117 123 106 124

4 结论

 [1] Cao Z L, Yan Z H, Wang H. Summary of binocular stereo vision matching technology[J]. Journal of Chongqing University of Technology (Natural Science), 2015, 29(2): 70-75. 曹之乐, 严中红, 王洪. 双目立体视觉匹配技术综述[J]. 重庆理工大学学报(自然科学), 2015, 29(2): 70-75 [Crossref] [2] Zhang Q, Hao K, Li H B. Research on scale invariant feature transform feature matching based on underwater curve constraint[J]. Acta Optica Sinica, 2014, 34(2): 0215003. 张强, 郝凯, 李海滨. 水下环境中基于曲线约束的SIFT特征匹配算法研究[J]. 光学学报, 2014, 34(2): 0215003 [Crossref] [3] Zhang Q, Lu S Q, Li H B, et al. Research on underwater stereo matching method based on color segmentation[J]. Acta Optica Sinica, 2016, 36(8): 0815001. 张强, 卢士强, 李海滨, 等. 基于色彩分割的水下立体匹配算法的研究[J]. 光学学报, 2016, 36(8): 0815001 [Crossref] [4] 赵鹏. 机器视觉研究与发展[M]. 北京: 科学出版社, 2012. [5] Sanchez-Ferreira C, Mori J Y, Llanos C H, et al.Development of a stereo vision measurement architecture for an underwater robot[C]//2013 IEEE 4th Latin American Symposium on Circuits and Systems, 2013: 1-4. [6] Lowe D G. Distinctive image features from scale-invariant keypoints[J]. International Journal of Computer Vision, 2004, 60(2): 91-110. [Crossref] [7] Lowe D G. Object recognition from local scale-invariant features[C]//Proceedings of the Seventh IEEE International Conference on Computer Vision, 1999, 2: 1150-1157. [8] Rublee E, Rabaud V, Konolige K, et al. ORB: An efficient alternative to SIFT or SURF[C]//2011 IEEE International Conference on Computer Vision, 2011: 2564-2571. [9] Peng H, Wen Y X, Zhai R F, et al. Stereo matching for binocular citrus images using SURF operator and epipolar constraint[J]. Computer Engineering and Applications, 2011, 47(8): 157-160. 彭辉, 文友先, 翟瑞芳, 等. 结合SURF算子和极线约束的柑橘立体图像对匹配[J]. 计算机工程与应用, 2011, 47(8): 157-160 [Crossref] [10] Gedge J, Gong M L, Yang Y H. Refractive epipolar geometry for underwater stereo matching[C]//2011 Canadian Conference on Computer and Robot Vision, 2011: 146-152. [11] Li J, Pan T S, Tseng K K, et al. Design of a monocular simultaneous localisation and mapping system with ORB feature[C]//2013 IEEE International Conference on Multimedia and Expo, 2013: 1-4. [12] Zhang W M, Deng X X, Zhang Q, et al. Non-parallel system underwater image transformation model[J]. Acta Photonica Sinica, 2015, 44(2): 211002. 张文明, 邓茜雪, 张强, 等. 基于非平行系统的水下图像转化模型[J]. 光子学报, 2015, 44(2): 211002 [Crossref] [13] Wang H B, Sun H Y, Shen J, et al. A research on stereo matching algorithm for underwater image[C]//2014 4th International Congress on Image and Signal Processing, 2011: 850-854. [14] Li Y Q, Zhang Y S, Li H B, et al. Underwater dense stereo matching based on depth constraint[J]. Acta Photonica Sinica, 2017, 46(7): 0715001. 李雅倩, 张岩松, 李海滨, 等. 基于深度约束的水下稠密立体匹配[J]. 光子学报, 2017, 46(7): 0715001 [Crossref]