Print

发布时间: 2019-07-16
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.180665
2019 | Volume 24 | Number 7




    图像理解和计算机视觉    




  <<上一篇 




  下一篇>> 





面向像对直线特征匹配的线特征矫正与提纯方法
expand article info 贾迪, 李玉秀, 赵明远, 朱宁丹
辽宁工程技术大学电子与信息工程学院, 葫芦岛 125105

摘要

目的 像对直线特征匹配是计算机视觉的重要研究内容,现有这类匹配方法均存在不同程度的误匹配问题。导致此问题的主要因素包括直线检测结果没有位于图像的真正边缘处、缺乏匹配线对的一致性校验。为此本文提出一种面向像对直线特征匹配的线特征矫正与提纯方法。方法 首先提取像对的边缘特征获得二值化边缘图,通过边缘梯度图及梯度矢量图(GVF)建立梯度引力图。其次,采用直线检测方法提取像对的直线特征,并通过梯度引力图矫正直线位置。最后,采用点特征匹配结果计算像对极线,并结合直线匹配结果确定最后的局部校验特征区域,通过随机抽样一致小邻域范围内特征相似性校验直线匹配结果,从而剔除误匹配直线。结果 对一组宽基线像对进行匹配实验,与直接采用直线匹配算法获得的匹配结果相比,矫正后的匹配结果剔除了大部分误匹配线对,将匹配准确率从50%提高到84%,继续提纯该匹配结果获得了100%的匹配准确率。在另一组宽基线像对的匹配实验中,经本文方法处理后的匹配准确率提高近30%。与前两组实验相比,第3组实验的像对摄影姿态变化不大,仅在尺度上有所区别,经本文方法处理后配准率从92%提高到100%。结论 采用本文方法可以大幅提高像对直线特征匹配的准确率,同时该方法可以很容易对其他直线匹配结果进行校正与提纯,具备较高的实用性。

关键词

直线特征; 梯度矢量图; 梯度引力图; 对极线; 随机抽样一致

Line feature correction and purification for matching straight lines of image pair
expand article info Jia Di, Li Yuxiu, Zhao Mingyuan, Zhu Ningdan
School of Electronic and Information Engineering, Liaoning Technical University, Huludao 125105, China
Supported by: National Natural Science Foundation of China (61601213); China Postdoctoral Science Foundation Funded Project (2017M611252)

Abstract

Objective Linear feature matching is an important research content of computer vision. Existing matching methods exhibit different degrees of mismatching. The main factors leading to this problem include the following: the existing line detection results are not located at the real edge of the image, and local consistency checking for matching lines is lacking. For this reason, a line feature correction and purification method for image matching of linear features is proposed. Method First, the edge features of the pair are extracted to obtain the binarized edge map. The edge gradient map and gradient vector flow are used to establish the gradient gravitational map. Second, the line detection method is used to extract the straight line features of the pair, and the new endpoints are determined by shortening the endpoints of these straight lines. Then, the distance gravitation map is used to calculate the position of the new endpoints to create new straight lines. Subsequently, a method of extending the new lines is proposed to ensure that the length of the original line is consistent. Finally, the point feature matching result is used to calculate the image pair epipolar line, and the line matching result is combined to determine the final check local feature area. The mismatched straight lines are eliminated by randomly sampling the feature matching in the small neighborhood to verify the straight lines matching. Result Three different image pairs were selected for the experiments. A wide baseline stereo pairs was selected for the first experiment. Experimental result shows that most straight lines on the ground imperfectly fit on the ground pattern. Correction result shows that straight lines of this part were corrected to the edge of the pattern. In addition, the straight lines of doors and windows were also offset or inclined to the interior. Such lines were also corrected to the edges of doors and windows. The analysis outcome of experimental data indicated that many wrong matching lines were observed in the matching results obtained by direct line matching algorithm. However, the linear correction processed by our method could improve the matching accuracy from 50% to 84%. Although a small number of wrong matching lines were observed, 100% matching accuracy could be obtained by refining this matching result through our method. Another wide baseline image pair was selected for the second experiment. Experimental result indicated that the straight lines extracted near the edge of flowerpot show that gaps between the actual edge and extraction result. The lines were located at the edge of the flowerpot through our method. The deviation of the line position is highly evident near the window frame, and the corrected straight lines were pulled back to the correct position. The analysis outcome of experimental data indicated that the matching accuracy was also increased by 30%. An image pair of scale changed was selected for the third experiment. Experimental result demonstrated that the lines are regularly detected, but the straight lines in the horizontal and vertical directions deviate to the real position. This problem was solved after correction. Moreover, some tilted lines were also pulled back to the real edge. Only a slight scale difference in the third image pair was observed, and the matching accuracy increased from 92% to 100% compared with the previous experiments. Conclusion This work aims to improve the registration accuracy of image pair. A general method of rectifying and purifying straight line features and its implementation process is proposed. A gradient gravity map is developed by combining gradient graph and gradient vector graph of edge graph. Accordingly, the positions of straight lines are corrected. The polar line obtained by matching points and line matching results are used to check the regional similarity for eliminating wrong matching lines. Three image pairs were tested to detect the linear registration rate, alignment rate after straight line correction, and matching result of purification matching results. Experimental results show that the average matching accuracy increased by approximately 30%. The method of this work can greatly improve the accuracy of matching the line features and easily correct and purify other line matching results and exhibits high practicability.

Key words

straight line feature; gradient vector flow; gradient gravitation map; epipolar line; random sampling

0 引言

直线特征匹配是指在不同像对上寻找同名特征线的对应关系,在计算机视觉处理中具有重要的研究价值[1-2],目前像对直线特征匹配已广泛应用于3维重建、摄影测量、立体匹配和目标跟踪等领域[3-4]。Wang等人[5]提出了均值—标准差直线描述符(MSLD),MSLD着重于处理没有任何先验知识的自动匹配,该描述符采用欧氏距离进行相似性度量,对图像的旋转、光照变化、模糊、视点变化、噪声、JPEG压缩及部分遮挡有较高的鲁棒性,可用于3维重建和对象识别,对纹理场景中适度的图像变换能够获得良好的匹配结果,然而该研究局限于单一尺度拍摄的影像之间,对尺度变化较为敏感。Verhagen等人[6]利用平行直线间的小间距对MSLD加入尺度不变描述,给出一种尺度不变均值—标准差直线描述符(SMSLD),提高了宽基线下直线匹配的精度。与MSLD和SMSLD相似,Zhang等人[7]利用直线的局部外观和几何属性提出条带描述符(LBD),为了克服断裂与几何变化问题,它在尺度空间中提取线条并构建直线支持域。将该支持域划分为若干个平行子区域,通过全局高斯函数和局部高斯函数,更好地计算直线梯度方向,从而计算每个条带描述符所形成条带的描述矩阵,根据描述矩阵的均值和标准差建立LBD,获得了较好的匹配结果。但由于同一直线在不同影像上提取结果的差异,对复杂地物影像构建的支持域为非对应区域,匹配可靠性较弱。López等人[8]将直线的几何特性、局部外观及线邻域的结构上下文相结合,提出双视图直线匹配算法,适用于低纹理图像中的直线检测与匹配。这种方法高度依赖线段端点,在图像变换和部分遮挡的情况下,线段端点位置的不准确易造成误匹配。文献[9]针对影像匹配时所提取特征线断裂而影响匹配可靠性的问题,提出多重约束条件下的近景影像线特征匹配方法,与其他直线匹配方法相比,该方法的配准率提升约为0.6%~53.3%。文献[10]针对特征线匹配中因线段端点不确定而难以提供准确位置的问题,提出结合边缘主点与线段元支撑区主成分相似性约束的近景影像匹配方法。该方法实现了以点代线匹配,降低直线匹配算法的复杂程度,同时通过线段元支撑区主成分相似性约束检验匹配结果,充分利用近景影像彩色信息,提高了匹配结果的可靠性。文献[11]利用单应性约束结合核线约束精简候选线特征数量,采用“以点代线”的方式,通过统计线上同名点的分布情况确定线特征初匹配结果,并根据线特征与其邻域内同名点间的距离关系对匹配结果进行核验,在影像间存在有尺度、亮度、旋转变换等复杂条件下的匹配正确率达到90%以上。Jia等人[12]在特征数(CN)[13]投影不变量的基础上构造新的共面线—点不变量,该不变量可以计算线邻域间的相似性。与其他方法相比,该方法的匹配相似性度量受匹配特征点的影响较小。尽管如此,在像对匹配过程中,上述方法均不可避免地出现误匹配结果及匹配精度不够等问题,而导致此问题的最主要因素之一是现有直线检测结果并不位于图像真正的边缘处,如图 1所示。

图 1 直线检测结果位置偏移示例
Fig. 1 Schematic diagram of linear position deviation

图 1为采用直线分割检测器(LSD)[14]算法得到的直线检测结果。由图可见,检测结果并没有全部位于图像的真实边缘处,这种情况将会影响后续直线匹配的准确性。目前,提纯像对点特征匹配的方法较多[15-17],而针对提纯线特征匹配结果的方法还鲜有提出,为此本文提出一种面向图像直线特征匹配的线特征矫正与提纯方法,贡献点如下:1)结合边缘图的梯度图和梯度矢量图构造梯度引力图,并以此为基础对直线位置进行矫正;2)利用点特征匹配结果,从整体角度计算摄影极线,利用极线约束与直线匹配结果共同确定直线邻域内的校验区域,通过计算区域相似性剔除误匹配结果。

1 算法描述

1.1 梯度引力图

梯度矢量流(GVF)[18]是通过最小化变分框架中的能量函数从图像导出的密集矢量场,常用于解决传统的变形模型对初始化的敏感性和对边界凹度的收敛性能差的问题。因其保留了梯度空间扩散的特征,故可以从图像的梯度开始在图像中进一步迭代收敛得到每幅图像的整体梯度。

将梯度矢量流(GVF)场定义为矢量场$\mathit{\boldsymbol{V}}(x, y)=(u(x, y), v(x, y))$,则最小化能量函数为

$ \begin{array}{*{20}{c}} {\varepsilon = \iint {\left( {\mu \left( {u_x^2 + u_y^2 + v_x^2 + v_y^2} \right) + } \right.}} \\ {\left. {{{\left| {\nabla f} \right|}^2}{{\left| {v - \nabla f} \right|}^2}} \right){\text{d}}x{\text{d}}y} \end{array} $ (1)

式中,下标分别代表沿$\mathit{\boldsymbol{x}}$$y$轴部分的导数,$μ$是正则化参数,$μ$的值取决于图像$\mathit{\boldsymbol{I}}$中存在的噪声水平,$|\nabla f|$是根据输入图像计算的梯度幅度。GVF场在多个区域中是缓慢变化的,能量$ε$由GVF场的偏导数平方和控制。采用变分法,GVF外力场可以通过求解下列Euler方程得到

$ \begin{array}{*{20}{c}} {\mu {\nabla ^2}u - \left( {u - {f_x}} \right)\left( {f_x^2 + f_y^2} \right) = 0}\\ {\mu {\nabla ^2}v - \left( {v - {f_x}} \right)\left( {f_x^2 + f_y^2} \right) = 0} \end{array} $ (2)

式中,$\nabla ^2$为拉普拉斯算子。本文通过边缘梯度图及梯度矢量图GVF建立梯度引力图,用来修正直线检测结果,图 2给出了构建梯度引力图的过程。令矩阵$\mathit{\boldsymbol{A}}$中记录边缘位置信息,矩阵$\mathit{\boldsymbol{B}}$为根据$\mathit{\boldsymbol{A}}$生成的梯度矢量图GVF,其形式如图 2(b)所示。首先,根据矩阵$\mathit{\boldsymbol{B}}$中的红色区域创建矩阵$\mathit{\boldsymbol{C}}$,给位于$\mathit{\boldsymbol{C}}$[3, 4]$\mathit{\boldsymbol{C}}$[4, 4]位置的元素分别赋值为(3, 4),(4, 4)。然后,遍历$\mathit{\boldsymbol{B}}$中黄色区域,在$\mathit{\boldsymbol{C}}$中相应的位置填写与其指向位置相同的元素值,再以同样的方法计算蓝色区域、绿色区域,直到遍历完$\mathit{\boldsymbol{B}}$中的所有元素,将矩阵$\mathit{\boldsymbol{C}}$填满。此时,矩阵$\mathit{\boldsymbol{C}}$中各个元素均被赋值,以此获得梯度引力图$\mathit{\boldsymbol{C}}$,其表现形式如图 2(d)所示。

图 2 梯度引力图构建过程示意图
Fig. 2 Gravitational gradient map construction process sketch
((a) edge map; (b) gradient vector flow; (c) GVF matrix; (d) gradient gravitation map)

图 3直观给出采用本节方法建立的梯度引力图。图 3(a)为图像的边缘图,其梯度矢量图为图 3(b),根据上述方法构建梯度引力图,得到图 3(c),可以看到图 3(c)中所有像素均指向对应边缘的位置。

图 3 梯度引力图示例
Fig. 3 An example of gradient gravitation map
((a) edge map; (b) gradient vector flow; (c) gradient gravitation map)

1.2 直线位置修正方法

令待匹配图像为$\mathit{\boldsymbol{I}}$,匹配目标图像为$\mathit{\boldsymbol{I}}′$,首先利用Canny算子对$\mathit{\boldsymbol{I}}$进行边缘检测,得到边缘图$\mathit{\boldsymbol{E}}$。通过$\mathit{\boldsymbol{E}}$求解梯度图$\mathit{\boldsymbol{G}}$,采用一阶差分的形式计算为

$ \begin{array}{*{20}{c}} {d\left( {i,j} \right) = \sqrt {d_x^2 + d_y^2} }\\ {{d_x}\left( {i,j} \right) = \mathit{\boldsymbol{I}}\left( {i + 1,j} \right) - \mathit{\boldsymbol{I}}\left( {i,j} \right)}\\ {{d_y}\left( {i,j} \right) = \mathit{\boldsymbol{I}}\left( {i,j + 1} \right) - \mathit{\boldsymbol{I}}\left( {i,j} \right)} \end{array} $ (3)

式中,$(i, j)$为像素的坐标,$d_x(i, j)$$x$方向一阶偏导数,$d_y(i, j)$$y$方向一阶偏导数。采用式(1)计算梯度矢量图GVF,图 4为相关示例。

图 4 边缘梯度与梯度矢量图
Fig. 4 Edge gradient and gradient vector graph
((a) test image; (b) edge map; (c) edge gradient; (d) gradient vector flow)

直线检测算法检测到的直线通常与实际边缘存在一定的偏离,如图 5(a)所示。令边缘引力为$F$,→代表运动方向,点到直线的距离为$Ds$,通过引力图修正直线位置可能存在以下两种问题:

图 5 直线矫正问题示例
Fig. 5 Examples of linear correction problem
((a) line detection results; (b) gradient gravitational graph)

1) 第1种问题存在于角点局部区域。若$Ds(p_1, e_1) < Ds(p_1, e_2)$,则有$F(p_1)→e_1$$F(p_2)→e_2$,此种情况通过引力图修正将获得错误的修正结果,而实际上$p_1$应为$F(p_1)→e_2$

2) 第2种问题存在于邻接边缘处。若$Ds(p_3, e_2) < Ds(p_3, e_3)$,则有$F(p_3)→e_2$$F(p_4)→e_3$,此种情况通过引力图修正也将获得错误的修正结果,实际上$p_3$应为$F(p_3)→e_3$

针对上述情况,本文给出如下的直线矫正方法:图 6中,以直线段$l$为例,令其长度为$D$,两个端点分别为$p_1$, $p_2$, 沿直线$l$$p_1$$p_2$分别缩短$d_1$$d_2$$d_3$$d_4$后,获得4个新端点$p_{11}$$p_{12}$$p_{23}$$p_{24}$,通过梯度引力图计算$p_{11}$$p_{12}$$p_{23}$$p_{24}$的修正位置$p′_{11}$$p′_{12}$$p′_{23}$$p′_{24}$,再分别根据$p′_{11}$$p′_{12}$$p′_{23}$$p′_{24}$确定新的直线。

图 6 直线矫正示意图
Fig. 6 Sketch map of line correction

由于该方法分别将直线两个端点的距离缩短了$d_1$$d_2$$d_3$$d_4$,因此在求得新端点后对其进行延长,以保持与原直线段长度一致。分别以$p′_{11}$$p′_{12}$$p′_{23}$$p′_{24}$为起始节点,通过如下公式计算获得延长线矢量

$ \left\{ \begin{array}{l} {V_{{{p'}_{11}}}} = Vt\left( {{{p'}_{11}},{d_1} \cdot \frac{{V\left( {{{p'}_{12}},{{p'}_{11}}} \right)}}{{\left| {V\left( {{{p'}_{12}},{{p'}_{11}}} \right)} \right|}}} \right)\\ {V_{{{p'}_{12}}}} = Vt\left( {{{p'}_{12}},\left| {D - {d_2}} \right| \cdot \frac{{V\left( {{{p'}_{11}},{{p'}_{12}}} \right)}}{{\left| {V\left( {{{p'}_{11}},{{p'}_{12}}} \right)} \right|}}} \right)\\ {V_{{{p'}_{23}}}} = Vt\left( {{{p'}_{23}},\left| {D - {d_3}} \right|{d_4} \cdot \frac{{V\left( {{{p'}_{24}},{{p'}_{23}}} \right)}}{{\left| {V\left( {{{p'}_{24}},{{p'}_{23}}} \right)} \right|}}} \right)\\ {V_{{{p'}_{24}}}} = Vt\left( {{{p'}_{24}},{d_4} \cdot \frac{{V\left( {{{p'}_{23}},{{p'}_{24}}} \right)}}{{\left| {V\left( {{{p'}_{23}},{{p'}_{24}}} \right)} \right|}}} \right) \end{array} \right. $ (4)

式中,$Vt$为计算矢量函数,分别获得${V_{p_{11}^\prime }}、{V_{p_{12}^\prime }}、{V_{p_{13}^\prime }}、{V_{p_{14}^\prime }}$后即可求得修正后的直线段的新端点。图 6给出的示例是一种特征情况,修正后的结果将分别获得两条直线,且均位于图像边缘处。

1.3 提纯直线匹配结果

提纯直线匹配结果的思路为:通过点特征匹配结果计算像对极线,并结合直线匹配结果确定最后的校验局部特征区域,通过随机抽样一致小邻域范围内的特征相似性校验直线匹配结果,从而对误匹配线特征进行剔除。

图 7所示,对极几何是两视图之间内在的摄影几何[19]$\mathit{\boldsymbol{x}}$$\mathit{\boldsymbol{x}}′$分别是物方$\mathit{\boldsymbol{X}}$在另个摄影平面上获得的同名像点,$C$$C′$分别为摄影中心,它们之间的连线称为基线,基线所在平面为对极平面,$e$$e′$是基线与像平面的交点,即对极点,像平面与对极平面的交线即为对极线。这些对极线满足一定的几何约束关系。直线$\mathit{\boldsymbol{l}}$为对应于点$\mathit{\boldsymbol{x}}′$的极线,直线$\mathit{\boldsymbol{l}}′$为对应于点$\mathit{\boldsymbol{x}}$的极线,极线约束是指点$\mathit{\boldsymbol{x}}′$一定在对应于$\mathit{\boldsymbol{x}}$的极线$\mathit{\boldsymbol{l}}′$上,点$\mathit{\boldsymbol{x}}$一定在对应于$\mathit{\boldsymbol{x}}′$的极线$\mathit{\boldsymbol{l}}$上。基本矩阵是对极几何的代数表示,可通过匹配点求出,常采用归一化八点算法计算基本矩阵,基础矩阵$\mathit{\boldsymbol{F}}$满足如下等式

$ {\left( {\mathit{\boldsymbol{x'}}} \right)^{\rm{T}}}\mathit{\boldsymbol{Fx}} = 0 $ (5)

$ {\mathit{\boldsymbol{x}}^{\rm{T}}}{\mathit{\boldsymbol{F}}^{\rm{T}}}\mathit{\boldsymbol{x'}} = 0 $ (6)

图 7 摄影几何描述
Fig. 7 Photography geometry description

对于左相机图像平面,点$\mathit{\boldsymbol{x}}$在极线$\mathit{\boldsymbol{l}}$上,所以有$\mathit{\boldsymbol{x}}^{\rm{T}}\mathit{\boldsymbol{l}}=0$, 根据式(6)可知$\mathit{\boldsymbol{l}} \cong \boldsymbol{F}^{\mathrm{T}} \boldsymbol{x}^{\prime}$,相差一个常数因子时,对直线方程无影响,因此可以将极线$\mathit{\boldsymbol{l}}$直接表示为

$ \mathit{\boldsymbol{l}} = {\mathit{\boldsymbol{F}}^{\rm{T}}}\mathit{\boldsymbol{x'}} $ (7)

同理可得

$ \mathit{\boldsymbol{l'}} = \mathit{\boldsymbol{Fx}} $ (8)

例如,图 8(a)图 8(b)中,红色直线为所求极线,黄色直线表示其中一条对应的极线。

图 8 结合极线确定小邻域
Fig. 8 Determining small neighborhoods by combining epipolar line((a) linear alignment calibration areas of the matched image; (b) linear alignment calibration areas of the target image)

图 8所示,黑色的线条为一对匹配直线,红色线条为极线,本文以极线与直线为参考获取直线周边小邻域$A$$B$$C$$A′$$B′$$C′$等。具体求解方法为如下:

首先,等分直线段$L$获得等分点{${\mathit{\boldsymbol{a}}, \mathit{\boldsymbol{b}}, \mathit{\boldsymbol{c}}, …}$},根据极线约束原理,可以求得${\mathit{\boldsymbol{a}}, \mathit{\boldsymbol{b}}, \mathit{\boldsymbol{c}}, …}$}在图 8(b)中对应的极线,再根据极线与$L′$的交点求得对应的点{${\mathit{\boldsymbol{a}}′, \mathit{\boldsymbol{b}}′, \mathit{\boldsymbol{c}}′, …}$},该过程确定了匹配直线$L$$L′$上的对应点,通过求取{${\mathit{\boldsymbol{ab}}, \mathit{\boldsymbol{bc}}, …}$}及{${\mathit{\boldsymbol{a}}′ \mathit{\boldsymbol{b}}′, \mathit{\boldsymbol{b}}′ \mathit{\boldsymbol{c}}′, …}$}的小邻域特征计算线条局部区域的相似性。为了加快计算速度,可以通过随机抽样的方法计算区域相似性。

其次,确定邻域的大小。实验中,令半径阈值为Radius,保存小于半径的像素点,并将所有保存的邻域重新保存在一个新的图像$\mathit{\boldsymbol{I}}_m$中。最后,由梯度方向判断$\mathit{\boldsymbol{I}}_m$中的像素点所属邻域是左邻域还是右邻域,如图 9所示,两个黑色箭头分别表示直线$a$$b$的梯度方向。为了保持方向的一致性,由直线梯度指向的区域表示右邻域,另一侧为左邻域。

图 9 直线梯度方向图示
Fig. 9 Graphic of straight line gradient direction

线邻域的相似性通过计算区域内像素颜色的相似性来确定。令对应的匹配区域分别为$\mathit{\boldsymbol{R}}$$\mathit{\boldsymbol{R}}′$,区域$\mathit{\boldsymbol{R}}$内像素的数量为$m$,区域$\mathit{\boldsymbol{R}}′$内像素的数量为$n$,计算邻域相似性

$ Sim\left( {\mathit{\boldsymbol{R}},\mathit{\boldsymbol{R'}}} \right) = \left| {\frac{{\sum\limits_{k = 1}^m {{\mathit{\boldsymbol{I}}_k}} }}{m} - \frac{{\sum\limits_{k' = 1}^n {{\mathit{\boldsymbol{I}}_{k'}}} }}{n}} \right| $ (9)

通过上述方法进行计算,若随机抽取对应区域都具有较高相似性,则判定该段匹配直线是正确的,通过这种方法提纯直线匹配结果。

1.4 算法过程描述

结合1.1与1.2节理论部分的描述,给出构建梯度引力图伪代码:

输入:图像$\mathit{\boldsymbol{I}}$

输出:梯度引力图$\mathit{\boldsymbol{GM}}$

1) 计算图像$\mathit{\boldsymbol{I}}$的边缘图$\mathit{\boldsymbol{E}}$,计算$\mathit{\boldsymbol{E}}$的大小,$[M N]=sizeof(\mathit{\boldsymbol{E}})$

2) 求取$\mathit{\boldsymbol{E}}$的梯度图$\mathit{\boldsymbol{G}}$及梯度矢量图$\mathit{\boldsymbol{GVF}}$

3) 构造一个名为$Rect$的3维矩阵$\mathit{\boldsymbol{GM}}={\rm{Rect}}[2 M N]$, 其中$\mathit{\boldsymbol{GM}}(1, :, :)$$X$坐标,$\mathit{\boldsymbol{GM}}(2, :, :)$$Y$坐标。根据1.1节方法结合$\mathit{\boldsymbol{E}}$$\mathit{\boldsymbol{G}}$填写$\mathit{\boldsymbol{GM}}$

4) 计算每个位置上的引力值:

  $mExit=true$;

  while (mExit)

    for $i$=1:$M$

    for $j$ = 1:$N$

    {

    $mExit = false$;

    $if (\mathit{\boldsymbol{GM}}(1, i, j)!= 0)$

    {

    $mExit = true; $

    for $kx$ = -1:1

    for $ky$= -1:1

      if $(\mathit{\boldsymbol{GM}}(1, i+kx, j+ky) == 0)$

        {根据$\mathit{\boldsymbol{GVF}}(i+kx, j+ky)$

    梯度方向填写

    $\mathit{\boldsymbol{GM}}(1, i+kx, j+ky)$

    $\mathit{\boldsymbol{GM}}(2, i+kx, j+ky); $}

  }

}

5)返回$\mathit{\boldsymbol{GM}}$

结合1.3节理论部分的描述,给出如下提纯直线匹配线方法伪代码:

输入:线段$L$的等分点$\mathit{\boldsymbol{X}}=\{{\mathit{\boldsymbol{x}}_1, \mathit{\boldsymbol{x}}_2, …, \mathit{\boldsymbol{x}}_m}\}$,线段$L$′,局部邻域半径$R$,抽样个数$K$,比例阈值$P$

输出:$Output$

1)根据$\mathit{\boldsymbol{X}}$计算极线$\mathit{\boldsymbol{l}}′=\mathit{\boldsymbol{Fx}}_i(\mathit{\boldsymbol{x}}_i∈\mathit{\boldsymbol{X}})$,求取与$L′$的交点集$\{\mathit{\boldsymbol{X}}′={\mathit{\boldsymbol{x}}′_1, \mathit{\boldsymbol{x}}′_2, …, \mathit{\boldsymbol{x}}′_n}\}(n≤m)$;

2) 确定分段局部邻域:

  for $i$=1:n

  {

  for $j=\mathit{\boldsymbol{x}}(i, 1)-R/2 :\mathit{\boldsymbol{x}}(i, 1)+R/2$

      for $k=\mathit{\boldsymbol{x}}(i, 2)-R/2 :\mathit{\boldsymbol{x}}(i, 2)+R/2$

    $ImTemp1(j, k) =true; $

  for $j=\mathit{\boldsymbol{x}}′(i, 1)-R/2 :\mathit{\boldsymbol{x}}′(i, 1)+R/2$

    for $k=\mathit{\boldsymbol{x}}′(i, 2)-R/2 :\mathit{\boldsymbol{x}}′(i, 2)+R/2$

      $ImTemp2(j, k) =true; $

  }

3) 区分左右邻域:

$ImTemp1$中,确定$L$的左邻域$A_{\rm{l}}$与右邻域$A_1$;

$ImTemp2$中,确定$L′$的左邻域$A′_{\rm{l}}$与右邻域$A′_{\rm{r}}$;

4) 计算直线的相似度:

  随机抽样$K$个局部邻域,获得新集合$\mathit{\boldsymbol{SA}}_{\rm{l}}$$\mathit{\boldsymbol{SA}}_{\rm{r}}$$\mathit{\boldsymbol{SA}}′_{\rm{l}}$$\mathit{\boldsymbol{SA}}′_{\rm{r}}$

  $num=0;$

  for $i=1:K$

    if $sim\left({\mathit{\boldsymbol{S}}{\mathit{\boldsymbol{A}}_l}(i), SA_l^\prime (i)} \right) < T{\rm{ \& \& }}$

      $Sim(\mathit{\boldsymbol{SA}}_{\rm{r}}(i), \mathit{\boldsymbol{SA}}′_{\rm{r}}(i)) < T$

      $num++; $

      if $(num/K>P)$

      $Output=true; $

    else

  $Output=false; $

5) 返回$Output$

2 实验结果与分析

为了验证本文方法的有效性,选择MATLAB作为开发工具,CPU主频为3.30 GHz,内存为8.00 GB,分别在3组数据上进行实验。

2.1 实验结果

选择LSD算法提取图像的直线特征作为1.2节方法的输入,对该直线特征进行矫正。以文献[12]的直线匹配结果为基础,提纯匹配直线对。选择3组具有代表性数据进行实验,实验结果如图 10图 15所示。

图 10 宽基线像对直线矫正结果
Fig. 10 Results of linear correction for wide baseline image pair((a) LSD line test results; (b) straight line correction results)
图 11 宽基线像对直线匹配与提纯结果
Fig. 11 Results of line matching and purification for wide baseline image pair
((a) the direct match results with LSD; (b) results of the straight line correction; (c) results of the purification matching)
图 12 视角变化像对直线矫正结果
Fig. 12 Results of linear correction for viewpoint change image pair((a) LSD line test results; (b) straight line correction results)
图 13 视角变化像对直线匹配与提纯结果
Fig. 13 Results of line matching and purification for viewpoint change image pair((a) the direct match results with LSD; (b) results of the straight line correction; (c) results of the purification matching)
图 14 尺度变化像对直线矫正结果
Fig. 14 Results of linear correction for scale change image pair((a) LSD line test results; (c) straight line correction results)
图 15 尺度变化像对直线匹配与提纯结果
Fig. 15 Results of line matching and purification for scale change image pair ((a) the direct match results with LSD; (b) results of the straight line correction; (c) results of the purification matching)

图 10(a)中红色标记部分为提取到的直线特征,图 10(b)中的绿色部分为采用本文方法对图 10(a)中直线特征的矫正结果。图 10(a)中,多数地面部分的直线没有完全贴合到地面花纹上,从直线矫正结果上看较好地将这部分直线修正到花纹的边缘处。此外,门与窗边的直线检测结果也向内部偏移或有些倾斜,经过直线矫正也修正到门和窗的边缘处。图 11(a)为以图 10(a)的直线特征作为输入,采用文献[12]的方法获得的匹配结果,其中匹配线对具有相同的编号。图 11(b)图 10(b)的直线特征作为输入,采用文献[12]算法获得的匹配结果,分别对图 11(b)中的匹配结果提纯得到图 11(c)

图 11中,与图 11(a)相比,图 11(b)在匹配结果中剔除了27,25,30,3,1,8,2,7,4,6,17,21,23号直线。与图 11(b)相比,图 11(c)去除了3,15,19号直线。所有剔除的匹配线对中,具有非常明显错误的线对如1、2号直线,由于它们没有位于图像的真正边缘处,导致匹配错误。以修正后的结果作为输入进行匹配时,则可获得准确率更高的匹配结果。此外图 11(a)第1行图中6、17号直线位于同一条边缘且位置相邻,图 11(a)第2行图中与其匹配的直线位置不同,经本文方法的处理,可以较好地识别这种错误。

图 12(a)图 12(b)中,花盆边缘附近的直线提取结果与实际边缘存在一定缝隙,经过修正的直线已较好地位于花盆的边缘处。商店窗框附近检测到的直线特征位置偏离更加明显,可以清楚地看到经过修正后的直线已经被拉回到正确位置上。图 13中,图 13 (a)相比,图 13 (b)在匹配结果中剔除了16,12,19,17,14,26,20号直线。与图 13 (b)相比,与图 13 (c)了剔除16号直线。这组实验中的图 13 (a)匹配错误不够明显,例如17与19号直线虽然在同一侧平面上,但在图 13 (a)第1行中位于侧平面的中间位置,而在图 13 (b)第1行中位于侧平面的边缘位置,易导致错误的匹配结果,其主要原因是由于LSD检测到边缘位置的直线向侧平面的中间偏移,匹配时则判定该特征是位于中间位置的直线所致,采用本文方法可以较好地解决这部分问题。

图 14(a)中检测到的直线条比较规整,但在水平方向上的直线整体向上偏移,垂直方向的直线整体向左侧偏移,矫正后较好地解决了该问题,同时一些倾斜的直线也被拉回到真正的边缘处。在图 15中,与图 15(a)相比,图 15 (b)在匹配结果中剔除了121,113,145,115,142,134,, 109,93,99,114,146号直线。与图 15 (b)相比,图 15 (c)去除了105号直线。由于这组数据仅为尺度变换像对,因此匹配正确的直线相对较多,但依然存在部分错误,如115、142号线对的明显错误对匹配结果影响较大,通过本文方法处理后,可以剔除这部分误匹配结果。

综上,本文选择LSD算法的直线检测结果作为输入,存在较多直线偏离正确位置的情况,经过本文给出的直线矫正方法处理,对位置有偏离的直线进行调整,能够提高直线匹配的准确率。此外,通过

1.3节的直线对提纯方法的处理可以更好地剔除误匹配线对,从而进一步提高配准率。该方法不仅适用于所有直线提取结果的矫正,同时易于与现有直线匹配方法结合提高其配准率。

2.2 准确率分析

3组数据的量化比较结果见表 1。第1列为不同像对的实验编号,第2列为采用LSD直线检测结果进行匹配所获线对的数量及配准率, 第3列为对LSD直线检测结果修正后所获数量及配准率,第4列为对匹配结果提纯之后的匹配线对数量及准确率。

表 1 实验分析
Table 1 Experimental analysis

下载CSV
实验
编号
直线匹配线
对数量/
准确率
修正后匹配
线对数量/
准确率
提纯匹配线
对数量/
准确率
准确率
提高百分
比/%
图 11 32/50% 19/84% 16/100% 50
图 13 27/70% 20/95% 19/100% 30
图 15 160/92% 149/99% 148/100% 8

表 1所示,第1行数据为一组针对宽基线像对的实验结果,直接采用直线匹配算法获得的匹配结果中存在较多错误匹配线对,对LSD进行直线修正后,剔除了大部分误匹配线对,将匹配准确率从50%提高到84%。此时仍然存在少量错误匹配线,继续对匹配结果提纯,获得了100%的匹配准确率。

第2行数据为另一组宽基线像对的实验结果,经本文方法处理后准确率提高同样较为明显,达到了30%。与前两组实验相比,第3行数据的实验对象摄影姿态变化不大,仅在尺度上有所区别。直接采用直线匹配算法对本对图像已获得较好的匹配结果,但依然存在误匹配线对,经本文方法处理后,准确率从92%提高到100%。综上,在各数据集上的实验结果表明,本文方法可以较好地提高像对间直线特征匹配的准确率。

3 结论

本文从提高像对直线特征配准率的目的出发,给出一种通用的像对直线特征矫正与提纯方法。提出结合边缘图的梯度图和梯度矢量图构造梯度引力图,并以此为基础对直线位置进行矫正;利用点特征匹配结果,从整体角度计算摄影极线,利用极线约束原理与直线匹配结果共同确定直线邻域内的校验区域,通过计算区域相似性剔除误匹配结果。分别从LSD检测直线配准率、直线矫正后的配准率、提纯匹配结果配准率3方面对3组像对进行实验,实验结果表明,该方法不仅可以矫正偏离正确位置的直线,解决由于直线位置偏离等原因产生错误匹配线的问题,而且能够较好地剔除错误的匹配线,提高配准率。因其具备较高的通用性,将在后续工作中将该方法应到3维重建、SLAM等高级图像处理中。

参考文献

  • [1] Bergamasco F, Albarelli A, Torsello A. Pi-Tag:a fast image-space marker design based on projective invariants[J]. Machine Vision and Applications, 2013, 24(6): 1295–1310. [DOI:10.1007/s00138-012-0469-6]
  • [2] Ramalingam S, Antunes M, Snow D, et al. Line-sweep: cross-ratio for wide-baseline matching and 3D reconstruction[C]//Proceedings of 2015 IEEE Conference on Computer Vision and Pattern Recognition. Boston, MA: IEEE, 2015.[DOI:10.1109/CVPR.2015.7298728]
  • [3] Albarelli A, Rodolá E, Torsello A. Loosely distinctive features for robust surface alignment[C]//Proceedings of the 11th European Conference on Computer Vision. Heraklion, Crete, Greece: Springer-Verlag, 2010.[DOI:10.1007/978-3-642-15555-0_38]
  • [4] Lemaire T, Lacroix S. Monocular-vision based SLAM using line segments[C]//Proceedings of 2007 IEEE International Conference on Robotics and Automation. Roma, Italy: IEEE, 2007: 2791-2796.[DOI:10.1109/ROBOT.2007.363894]
  • [5] Wang Z H, Wu F C, Hu Z Y. MSLD:a robust descriptor for line matching[J]. Pattern Recognition, 2009, 42(5): 941–953. [DOI:10.1016/j.patcog.2008.08.035]
  • [6] Verhagen B, Timofte R, Van Gool L. Scale-invariant line descriptors for wide baseline matching[C]//Proceedings of 2014 IEEE Winter Conference on Applications of Computer Vision. Steamboat Springs, CO: IEEE, 2014: 493-500.[DOI:10.1109/WACV.2014.6836061]
  • [7] Zhang L L, Koch R. An efficient and robust line segment matching approach based on LBD descriptor and pairwise geometric consistency[J]. Journal of Visual Communication and Image Representation, 2013, 24(7): 794–805. [DOI:10.1016/j.jvcir.2013.05.006]
  • [8] López J, Santos R, Fdez-Vidal X R, et al. Two-view line matching algorithm based on context and appearance in low-textured images[J]. Pattern Recognition, 2015, 48(7): 2164–2184. [DOI:10.1016/j.patcog.2014.11.018]
  • [9] Song W D, Zhu H, Wang J X, et al. Line feature matching method based on multiple constraints for close-range images[J]. Journal of Image and Graphics, 2016, 21(6): 764–770. [宋伟东, 朱红, 王竞雪, 等. 多重约束下的近景影像线特征匹配方法[J]. 中国图象图形学报, 2016, 21(6): 764–770. ] [DOI:10.11834/jig.20160609]
  • [10] Song W D, Zhu H, Wang J X, et al. Feature line matching based on the principal component similarity constraint of line segment primitive support region[J]. Journal of Signal Processing, 2016, 32(8): 904–910. [宋伟东, 朱红, 王竞雪, 等. 线段元支撑区主成分相似性约束特征线匹配[J]. 信号处理, 2016, 32(8): 904–910. ] [DOI:10.16798/j.issn.1003-0530.2016.08.04]
  • [11] Ouyang H, Fan D Z, Ji S, et al. Line matching based on discrete description and conjugate point constraint[J]. Acta Geodaetica et Cartographica Sinica, 2018, 47(10): 1363–1371. [欧阳欢, 范大昭, 纪松, 等. 结合离散化描述与同名点约束的线特征匹配[J]. 测绘学报, 2018, 47(10): 1363–1371. ] [DOI:10.11947/j.AGCS.2018.20170231]
  • [12] Jia Q, Gao X K, Fan X, et al. Novel coplanar line-points invariants for robust line matching across views[C]//Proceedings of the 14th European Conference on Computer Vision. Amsterdam, The Netherlands: Springer International Publishing, 2016: 599-611.[DOI:10.1007/978-3-319-46484-8_36]
  • [13] Luo Z X, Zhou X C, Gu D X. From a projective invariant to some new properties of algebraic hypersurfaces[J]. Science China Mathematics, 2014, 57(11): 2273–2284. [DOI:10.1007/s11425-014-4877-0]
  • [14] Wang L, You S Y, Neumann U. Supporting range and segment-based hysteresis thresholding in edge detection[C]//Proceedings of the 15th IEEE International Conference on Image Processing. San Diego, CA: IEEE, 2008.[DOI:10.1109/ICIP.2008.4711828]
  • [15] Ma J Y, Zhao J, Tian J W, et al. Robust point matching via vector field consensus[J]. IEEE Transactions on Image Processing, 2014, 23(4): 1706–1721. [DOI:10.1109/TIP.2014.2307478]
  • [16] Bian J W, Lin W Y, Matsushita Y, et al. GMS: grid-based motion statistics for fast, ultra-robust feature correspondence[C]//Proceedings of 2017 IEEE Conference on Computer Vision and Pattern Recognition. Honolulu, HI: IEEE, 2017: 2828-2837.[DOI:10.1109/CVPR.2017.302]
  • [17] Chen F J, Han J, Wang Z W, et al. Image registration algorithm based on improved GMS and weighted projection transformation[J]. Laser & Optoelectronics Progress, 2018, 55(11): 111006. [陈方杰, 韩军, 王祖武, 等. 基于改进GMS和加权投影变换的图像配准算法[J]. 激光与光电子学进展, 2018, 55(11): 111006. ] [DOI:10.3788/LOP55.111006]
  • [18] Xu C Y, Prince J L. Snakes, shapes, and gradient vector flow[J]. IEEE Transactions on Image Processing, 1998, 7(3): 359–369. [DOI:10.1109/83.661186]
  • [19] Hartley R, Zisserman A. Multiple View Geometry in Computer Vision[M]. 2nd ed. Cambridge: Cambridge University Press, 2004.