-
文中研究在相机镜头前加装线偏振片,并建立最佳偏振角求解模型,在使用最佳偏振角的前提下采集定位特征点图像,减少高亮度区域对图像处理的影响,便于后续进行位姿测量。
光波具有偏振特性,Stokes矢量可用来表示光的偏振态。Stokes矢量S包含四个Stokes参数:S0, S1, S2, S3,如公式(1)所示,S0表示由成像系统接收的总光强,为x方向和y方向的光强和,S1表示在x方向和y方向的光强差,S2表示+45°方向与-45°方向的光强差,S3表示左旋圆偏振光分量与右旋圆偏振光分量的光强差。Ex, Ey表示光的电矢量E在x方向和y方向的振幅,α表示两者的相位差。
$$ {\boldsymbol{S}} = \left[ \begin{array}{l} {S_0} \\ {S_1} \\ {S_2} \\ {S_3} \\ \end{array} \right] = \left[ \begin{array}{l} {E_{x}}^2 + {E_y}^2 \\ {E_{x}}^2 - {E_y}^2 \\ 2{E_{x}}{E_y}\cos \alpha \\ 2{E_{x}}{E_y}\sin \alpha \\ \end{array} \right] $$ (1) I(0°, 0°), I(45°, 0°)和I(90°, 0°)表示光在0°, 45°和90°三个不同角度的光强,由于光中圆偏振分量非常小,一般可以忽略不计,所以S3=0,Stokes矢量可以进一步表示为公式(2):
$$ {\boldsymbol{S}}=\left[\begin{array}{l}{S}_{0}\\ {S_1}\\ {S}_{2}\\ {S}_{3}\end{array}\right]=\left[\begin{array}{l}I({0}^{\circ },{0}^{\circ })+I({90}^{\circ },{0}^{\circ })\\ I({0}^{\circ },{0}^{\circ })-I({90}^{\circ },{0}^{\circ })\\ 2I({45}^{\circ },{0}^{\circ })-I({0}^{\circ },{0}^{\circ })-I({90}^{\circ },{0}^{\circ })\\ 0\end{array}\right] $$ (2) 穆勒矩阵是用来描述偏振片作用的矩阵。使用M表示穆勒矩阵,M11···M44表示穆勒矩阵的16个参数,如公式(3)所示:
$$ {\boldsymbol{M}} = \left[ {\begin{array}{*{20}{c}} {{M_{11}}}&{{M_{12}}}&{{M_{13}}}&{{M_{14}}}\\ {{M_{21}}}&{{M_{22}}}&{{M_{23}}}&{{M_{24}}}\\ {{M_{31}}}&{{M_{32}}}&{{M_{33}}}&{{M_{34}}}\\ {{M_{41}}}&{{M_{42}}}&{{M_{43}}}&{{M_{44}}} \end{array}} \right]$$ (3) 如图1所示,θ表示偏振片角度,穆勒矩阵M可以表示为公式(4),当偏振片角度发生变化时,穆勒矩阵亦会随之发生变化。
$$ {\boldsymbol{M}} = \frac{1}{2}\left[ {\begin{array}{*{20}{c}} 1&{\cos 2\theta }&{\sin 2\theta }&0\\ 0&{\cos 2\theta }&{\sin 2\theta \cos 2\theta }&0\\ 0&{\sin 2\theta \cos 2\theta }&{{{\sin }^2}2\theta }&0\\ 0&0&0&0 \end{array}} \right]$$ (4) 用Sin表示入射光的Stokes矢量,Sout表示经过偏振片后的出射光的Stokes矢量,由于偏振片的作用,出射光的Stokes矢量和入射光的Stokes矢量之间的关系可以用公式(5)来表示。
$$ {{\boldsymbol{S}}_{{\text{out}}}} = {\boldsymbol{M}} \cdot {{\boldsymbol{S}}_{{\text{in}}}} $$ (5) 出射光光强的表达式如公式(6)所示:
$$ I\left( \theta \right) = \frac{1}{2}{S_0}\left( {x,y} \right) + \frac{1}{2}{S_1}\left( {x,y} \right)\cos 2\theta + \frac{1}{2}{S_2}\left( {x,y} \right)\sin 2\theta $$ (6) 最终可以得到最佳偏振角度θopt的表达式如公式(7)所示:
$$ {\theta _{opt}} = \arg {\text{ }}\min \left| {I\left( \theta \right)} \right| $$ (7) -
通过摄像机标定得出了摄像机模型内参数,即可以进行物体位姿的求解。如图2所示,Pi是空间的任意点,在图像平面上与之对应的点是pi。空间点在世界坐标系下的坐标是(Xwi, Ywi, Zw),转换到摄像机坐标系下坐标为(Xci, Yci, Zci),旋转矩阵为R3×3,平移向量为T3×1,在图像坐标系下的理想像素坐标为(u, v)。由于文中使用共面定位特征点阵列,所以Zwi=0。由理想图像像素坐标[ui, vi]可以计算出图像坐标[xi, yi]。
已知n组定位特征点的世界坐标[Xwi, Ywi, 0]和相应的图像坐标[xi, yi],构造矩阵A,每行ai为公式(8),共计n行。
$$ {{\boldsymbol{a}}_{\boldsymbol{i}}} = \left[ {{y_i}} \right.{X_{wi}},{y_i}{Y_{wi}}, - {{\text{x}}_i}{X_{wi}}, - {x_i}{Y_{wi}},\left. {{y_i}} \right] $$ (8) 设μ=[μ1, μ2, μ3, μ4, μ5],旋转参数r11, r12, r21, r22与平移参数tx, ty之比构成μ的各个元素:μ1=r11/ty, μ2=r12/ty, μ3=r21/ty, μ4=r21/ty, μ5=tx/ty。
设向量b=[x1, x2, x3, …, xn]包含了n组定位特征点的图像横坐标xi。因为A和b是已知的,根据公式(9)能解出未知的参数向量μ。
$$ {\boldsymbol{A\mu }} = {\boldsymbol{b}} $$ (9) 根据μ计算旋转参数和平移参数。设U=μ12+μ22+μ32+μ42,如公式(10)所示计算ty2。
$$ t_y^2 = \frac{{U - {{\left[ {{U^2} - 4{{({\mu _1}{\mu _4} - {\mu _2}{\mu _3})}^2}} \right]}^{\frac{1}{2}}}}}{{2{{({\mu _1}{\mu _4} - {\mu _2}{\mu _3})}^2}}}{\text{ }} $$ (10) 设ty=(ty2)1/2,然后根据μ计算4个旋转参数r11=μ1ty, r12=μ2ty,r21=μ3ty, r22=μ4ty和平移参数tx=μ5ty。
为了确定ty的符号,选择一个定位特征点P,其世界坐标为[Xw, Yw, 0],所对应的图像坐标[x, y]远离图像中心,根据公式(11)计算ξx和ξy。如果ξx与x的符号一致且ξy与y的符号一致,则ty的符号正确,否则就要改变符号。
$$\left[ \begin{array}{l} {\xi _x}\\ {\xi _y} \end{array} \right] = \left[ {\begin{array}{*{20}{c}} {{r_{11}}}&{{r_{12}}}&1&0\\ {{r_{21}}}&{{r_{22}}}&0&1 \end{array}} \right]\left[ \begin{array}{l} {x_w}\\ {y_w}\\ {t_x}\\ {t_y} \end{array} \right]$$ (11) 其余的旋转参数可根据公式(12)进行计算。
$$ \left\{ \begin{array}{l} {r_{13}} = {\left( {1 - r_{11}^2 - r_{12}^2} \right)^{\frac{1}{2}}} \\ {r_{23}} = {\left( {1 - r_{21}^2 - r_{22}^2} \right)^{\frac{1}{2}}} \\ {r_{31}} = \dfrac{{1 - r_{11}^2 - {r_{12}}{r_{21}}}}{2} \\ {r_{32}} = \dfrac{{1 - {r_{21}}{r_{12}} - r_{22}^2}}{{{r_{23}}}} \\ {r_{33}} = {\left( {1 - {r_{31}}{r_{13}} - {r_{32}}{r_{23}}} \right)^{\frac{1}{2}}} \end{array} \right. $$ (12) 计算平移参数tz。首先构造矩阵A',矩阵的每一行如公式(13)所示:
$$ {\boldsymbol{a}}_{\boldsymbol{i}}^{'} = \left( {{r_{21}}{X_{wi}} + {r_{22}}{Y_{wi}} + {t_y},{x_i}} \right) $$ (13) 构造向量b',每一项如公式(14)所示:
$$ b_i^{'} = \left( {{r_{31}}{X_{wi}} + {r_{32}}{Y_{wi}}} \right){y_i} $$ (14) 求解如公式(15)所示的线性方程组,其中v=(f, tz)T,f为焦距,最终得到tz的值。
$$ {{\boldsymbol{A}}^{'}}{\boldsymbol{v = }}{{\boldsymbol{b}}^{'}} $$ (15) -
位姿测量实验系统包括支架,相机,电控旋转平移台、线偏振片和位姿测量靶标,如图3所示。所有实验在密闭室内环境下进行,保持屋内光源位置及光强恒定。
实验中使用棋盘靶标,棋盘格尺寸为25 mm×25 mm。实验中的图像采集设备为海康威视MV-CA016-10UM相机,分辨率为1440×1080,像元尺寸为3.45 μm×3.45 μm,相机标定结果如表1所示。
文中的实验包括两部分:角点提取实验和测量精度验证实验。
表 1 相机标定实验结果
Table 1. Camera calibration experiment results
Focal length fx =3425.60506 fy =3426.03573 Principal point Cx =732.2264 Cy =496.46005 Radial distortion k1=−0.0855 k2 =0.8394 k3 =−9.7639 Tangential distortion p1 =0.00023224 p2 =0.00023113 -
将靶标置于相机镜头前,近似平行于相机成像面,分别在偏振角0°、偏振角45°、偏振角90°的条件下,采集靶标图像,根据公式(7)完成最佳偏振角求解。在自然光(不加偏振片)条件下和最佳偏振角条件下分别采集靶标图像,共计2幅图像,使用相同的角点提取算法,提取出来11×8的角点阵列,角点分布如图4(a)和(b)所示,两幅图像对应的角点在x方向和y方向上的像素坐标差值分布如图4(c)所示,x方向上的像素坐标差值在[−3.751,−0.893]范围内,y方向上的像素坐标差值在[−4.068,0.052]范围内。可以看出,在最佳偏振角条件下采集的棋盘图像提取的角点坐标与自然光条件下采集的棋盘图像提取的角点坐标相差约2个像素,证明了在最佳偏振角条件下的图像角点坐标不同于自然光条件下的图像角点坐标。
实验中使用的棋盘靶标由彼此平行的11条水平线组成,当靶标平面近似平行于相机成像面时,由棋盘格图像的角点所拟合的11条水平线也应该是近似平行的,斜率近似相等。如图4(d)所示,黑线表示自然光条件下角点像素坐标拟合的11条水平线斜率的变化趋势,红线表示最佳偏振角条件下角点像素坐标拟合的11条水平线斜率的变化趋势,斜率的标准差分别为0.00984和0.0072。自然光条件下角点像素坐标拟合直线的斜率变化要比最佳偏振角条件下拟合直线的斜率变化更为明显,因此最佳偏振角条件下采集的图像进行角点提取具有更好的精度,证明了文中基于偏振信息采集图像提取角点的可行性和优越性。
-
将摄像机固定到支架上,偏振片固定于镜头前,针对任意一个测量位置,在0°,45°和90°三个不同偏振角度条件下采集靶标图像,根据公式(7)完成最佳偏振角求解,调整偏振片角度至最佳偏振角,采集图像,提取定位特征点(角点),计算靶标位姿。位姿测量精度验证实验包括旋转角度测量实验和位移测量实验。
-
将靶标0°位置记为初始位置。设定靶标顺时针旋转为正,以5°为间隔进行旋转,直至+60°;设定靶标逆时针旋转为负,以5°为间隔进行旋转,直至−60°。靶标各旋转位置在最佳偏振角条件下采集图像,得到的靶标图像以及每个旋转位置对应的最佳偏振角度如图5所示,po表示靶标的旋转位置,op表示计算得出的偏振片在当前旋转位置对应的最佳偏振角。
图 5 各位置在最佳偏振角条件下采集的图像
Figure 5. Images collected at each position on the condition of optimal polarization angle
在自然光(不加偏振片),偏振角0°,45°,90°以及最佳偏振角条件下,采集靶标图像,使用文中提出的线性算法计算各位置靶标位姿并计算定位特征点平均重投影误差,实验结果如图6所示,在自然光(不加偏振片)条件下计算得出的定位特征点平均重投影误差更高,在最佳偏振角条件下采集图像,能够有效降低高亮度区域对图像处理的影响,从而提升位姿测量精度,降低靶标位姿测量的平均重投影误差,充分证明了文中方法的优势。
在自然光(不加偏振片)与最佳偏振角条件下,使用文中提出的线性算法计算各旋转位置的靶标位姿,得到所有定位特征点x方向与y方向的重投影误差,误差分布图如图7所示。图7(a)为自然光条件下对应的误差分布图,图7(b)为最佳偏振角条件下对应的误差分布图。自然光条件下所有定位特征点在x方向的重投影误差均值为−0.145 pixel,y方向的重投影误差均值为0.125 pixel。最佳偏振角条件下所有定位特征点在x方向的重投影误差均值为−0.05781 pixel,y方向的重投影误差均值为0.0675 pixel,x方向和y方向分别降低了0.09 pixel和0.06 pixel。
当靶标旋转角度较大(+40°~+60°和−40°~−60°)时,高亮度区域更为明显,对定位特征点图像坐标提取影响增大,最佳偏振角的效果更为明显,x方向的平均重投影误差降低范围为[0.0203, 0.2184] pixel,y方向的平均重投影误差降低范围为[0.0349, 0.1731] pixel。
在线性算法(不加偏振片),LHM算法(不加偏振片),线性算法(最佳偏振角)三种条件下分别计算靶标位姿,并计算靶标当前位置相对初始位置(0°)的夹角,测量结果如图8所示,正交迭代算法(LHM)是非线性算法的代表性方法,在自然光(不加偏振片)条件下,其精度优于线性算法。但是在最佳偏振角条件下采集图像,能够有效降低高亮度区域对图像处理的影响,使参与运算的有效定位特征点数量增加,线性算法的精度得到提升,精度优于非线性算法(LHM),测量误差小于±0.16°,测量标准差为0.068°。
-
将靶标固定在平移台基准位置(0 mm)处,靶标每次平移距离为0.5 mm,从0 mm移动到20 mm处共41个位置。在自然光(不加偏振片)和最佳偏振角条件下,使用文中提出的线性算法计算各位置靶标位姿并计算定位特征点平均重投影误差,实验结果如图9所示,在最佳偏振角条件下采集图像,能够有效降低高亮度区域对图像处理的影响,从而提升位姿测量精度,降低靶标位姿测量的平均重投影误差。
在线性算法(不加偏振片),LHM算法(不加偏振片),线性算法(最佳偏振角)三种条件下分别计算靶标位姿,并计算靶标当前位置相对初始位置(0 mm)的距离,测量结果如图10所示。LHM算法在自然光(不加偏振片)条件下,其精度优于线性算法。但是在最佳偏振角条件下采集图像,能够有效降低高亮度区域对图像处理的影响,使参与运算的有效定位特征点数量增加,线性算法的精度得到提升,精度优于非线性算法(LHM),测量误差小于±0.05 mm,测量标准差为0.034 mm。
综上,在旋转角度测量实验中,最佳偏振角条件下的测量相比于自然光条件下的测量,平均重投影误差降低了0.101 pixel。在最佳偏振角条件下使用线性算法测量靶标位姿,角度测量误差小于±0.16°,测量标准差为0.068°。在位移测量实验中,在最佳偏振角条件下的测量相比于自然光条件下的测量,平均重投影误差降低了0.046 pixel。在最佳偏振角条件下使用线性算法测量靶标位姿,位移测量误差小于±0.05 mm,测量标准差为0.034 mm。
Research on linear pose measurement method based on optimal polarization angle
-
摘要: 在基于视觉图像的位姿测量中,非线性位姿测量算法的全局收敛存在不确定性,测量结果取决于初值的选取,不能保证位姿测量的鲁棒性。线性位姿测量算法对图像处理的要求比较高,如果定位特征点图像坐标提取不够精确,会导致位姿测量精度降低。在自然光条件下,相机采集定位特征点图像,图像中高亮度区域的存在对定位特征点提取精度产生影响,进而使有效定位特征点数量减少,影响位姿测量精度。针对上述问题,文中提出了一种基于最佳偏振角的线性位姿测量方法:在相机镜头前加装线偏振片,根据Stokes矢量建立偏振片最佳偏振角度求解模型,在使用最佳偏振角度的前提下采集定位特征点图像,提取图像坐标;建立线性位姿求解模型,计算被测物体位姿。实验结果表明,该方法能够有效减少图像中的高亮度区域,改善成像质量,提高线性位姿测量精度,在−60°~+60°的测量范围内,角度测量误差小于±0.16°,在0~20 mm的测量范围内,位移测量误差小于±0.05 mm。Abstract: As to pose measurement technology based on visual image, the global convergence of the nonlinear algorithm is uncertain, and the results depend on the selection of initial values, so the robustness of pose measurement cannot be guaranteed. Linear pose measurement algorithms have relatively high requirements for image processing. If the image coordinates of feature points are not accurately extracted, the pose measurement accuracy will be reduced. On the condition of natural light, the camera collects the image of positioning feature points, and the existence of high light regions in the image have some impacts on the extraction accuracy of feature points, which reduces the number of effective feature points and affects the pose measurement accuracy. To solve the problems above, a linear pose measurement method based on the optimal polarization angle was proposed. The camera was equipped with a polarizer. The optimal polarization angle solution model was established according to the Stokes vector. On the premise of the optimal polarization angle, the feature points images were collected and the image coordinates of the feature points were extracted. The linear solving model was established to solve the object pose. The experimental results show that this method can effectively reduce the high light regions in the image, which improve the imaging quality and improve the linear pose measurement accuracy. In the measurement range of −60° to +60°, the angle measurement error is less than ±0.16°. In the measurement range of 0 to 20 mm, the displacement measurement error is less than ±0.05 mm.
-
Key words:
- pose measurement /
- optimal polarization angle /
- linear algorithm /
- Stokes vector
-
表 1 相机标定实验结果
Table 1. Camera calibration experiment results
Focal length fx =3425.60506 fy =3426.03573 Principal point Cx =732.2264 Cy =496.46005 Radial distortion k1=−0.0855 k2 =0.8394 k3 =−9.7639 Tangential distortion p1 =0.00023224 p2 =0.00023113 -
[1] Wang Zhongyu, Li Yaru, Hao Renjie, et al. Monocular vision pose measurement algorithm based on points feature [J]. Infrared and Laser Engineering, 2019, 48(5): 0517002. (in Chinese) doi: 10.3788/IRLA201948.0517002 [2] Wang Xiangjun, Cao Yu, Zhou Kai. Methods of monocular pose measurement based on planar objects [J]. Optics and Precision Engineering, 2017, 25(1): 274-280. (in Chinese) doi: 10.3788/OPE.20172501.0274 [3] Lao Dabao, Zhang Huijuan, Xiong Zhi, et al. Automatic measurement method of attitude on monocular vision [J]. Acta Photonica Sinica, 2019, 48(3): 0315001. (in Chinese) doi: 10.3788/gzxb20194803.0315001 [4] Lei Jinzhou, Zeng Lingbin, Ye Nan. Research on industrial robot alignment technique with monocular vision [J]. Optics and Precision Engineering, 2018, 26(3): 733-741. (in Chinese) doi: 10.3788/OPE.20182603.0733 [5] Xu Chengyi, Liu Ying, Jia Minping, et al. Method of hand-eye calibration for picking board robot [J]. Transactions of the Chinese Society for Agricultural Machinery, 2019, 50(12): 420-426. (in Chinese) doi: 10.6041/j.issn.1000-1298.2019.12.049 [6] Zhang Hanxue, Shen Chong, Chen Xuemei, et al. An enhanced fusion strategy for reliable attitude measurement utilizing vision and inertial sensors [J]. Applied Sciences, 2019, 9(13): 1-17. doi: 10.3390/app9132656 [7] Lu C, Hager G, Mjolsness E. Fast and globally convergent pose estimation from video images [J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2000, 22(6): 610-622. doi: 10.1109/34.862199 [8] Hesch J, Roumeliotis S. A direct least-squares (DLS) method for PnP[C]//IEEE International Conference on Computer Vision, 2011: 383-390. [9] Zhang Huijuan, Xiong Zhi, Lao Dabao, et al. Monocular vision measurement system based on EPNP algorithm [J]. Infrared and Laser Engineering, 2019, 48(5): 0517005. (in Chinese) doi: 10.3788/IRLA201948.0517005 [10] Wang Ping, Zhou Xuefeng, An Aimin, et al. Robust and linear solving method for Perspective-n-Point problem [J]. Chinese Journal of Scientific Instrument, 2020, 41(9): 273-282. (in Chinese) [11] Li S, Xu C, Xie M. A robust O(n) solution to the perspective-n-point problem [J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2012, 34(7): 1444-1450. doi: 10.1109/TPAMI.2012.41 [12] Zhu Z, Wang X, Liu Q, et al. Camera calibration method based on optimal polarization angle [J]. Optics and Lasers in Engineering, 2019, 112: 128-135. doi: 10.1016/j.optlaseng.2018.09.009 [13] 马莉莉. 基于光谱分析与偏振成像的目标识别技术研究[D]. 长春理工大学, 2019. Ma Lili. Research on target recognition techniques based on spectrometry analysis and polarization imaging[D]. Changchun: Changchun University of Science and Technology, 2019. (in Chinese) [14] 张倩. 基于主动式线偏振光照射的偏振成像实验研究[D]. 电子科技大学, 2020. Zhang Qian. Research on polarization imaging with linearly polarized light illumination[D]. Chengdu: University of Electronic Science and Technology of China, 2020. (in Chinese) [15] Wang F, Ainouz S, Petitjean C, et al. Specularity removal: A global energy minimization approach based on polarization imaging [J]. Computer Vision and Image Understanding, 2017, 158: 31-39. doi: 10.1016/j.cviu.2017.03.003 [16] Ainouz S, Morel O, Fofi D, et al. Adaptive processing of catadioptric images using polarization imaging: toward a polacatadioptric model [J]. Optical Engineering, 2013, 52(3): 037001. doi: 10.1117/1.OE.52.3.037001 [17] Zhu Z, Wang S, Zhang H, et al. Camera–projector system calibration method based on optimal polarization angle [J]. Optical Engineering, 2020, 59(3): 035104. doi: 10.1117/1.OE.59.3.035104