Print

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




    Chinagraph 2018    




  <<上一篇 




  下一篇>> 





柔性密封条截面误差自动视觉测量方法
expand article info 廖林, 李建华
华东理工大学信息科学与工程学院计算机科学与工程系, 上海 200237

摘要

目的 在柔性密封条误差测量过程中,密封条容易弯曲且形变较大,直接匹配精度较低,测量误差大。针对此问题,提出了一种新的柔性密封条截面误差自动视觉测量方法。方法 通过两步图像轮廓配准来获取测量图段和设计图段之间的匹配关系,然后进行误差度量和质量检验。1)通过基于多分辨率的轮廓角点提取算法提取出密封条轮廓的角点,然后基于最小化均方误差的思想进行穷举搜索,计算初始配准结果,再使用线性回归进行微调进一步提高初始配准结果;2)利用形状描述子进行局部轮廓配准,进一步获得两张轮廓图之间的精确局部配准结果;3)进行不同类型的误差定量计算和结果对比,主要测量的误差类型包括点偏移误差、点极限距离误差和角度位置误差等形位误差。结果 对密封条进行了逐步轮廓配准和多种误差测量,并在实际生产中进行了测试。实验结果表明,该系统配准结果好,测量精度高。该系统测量精度远高于密封条测量系统精度标准0.2 mm,且系统检测结果与实际人工检测结果完全一致,能有效促进柔性密封条自动化检测的发展。结论 提出了一种新的柔性密封条截面误差自动视觉测量方法,该系统具有良好的稳定性和可靠性,能有效进行柔性产品误差测量和质量检验。

关键词

视觉测量; 密封条; 图像配准; 误差; 角点检测

Automatic vision-based deviation measurement method for cross sections of flexible sealing strips
expand article info Liao Lin, Li Jianhua
Department of Computer Science and Engineering, School of Information Science and Engineering, East China University of Science and Technology, Shanghai 200237, China
Supported by: National Natural Science Foundation of China (61402174); National Key R&D Program of China(2016YFA0502304)

Abstract

Objective Sealing strips play an important role in the automotive industry. However, accurate results in the measurement of sealing strips are difficult to obtain due to the large deformation of their complex contour. This study proposes a novel automatic vision-based deviation measurement method for cross sections of flexible sealing strips. With this method, the matching relationship between the local contour of the captured image and the reference contour of the design drawing is computed using a two-stage image contour registration algorithm. Then, the deviation calculation is performed to evaluate the quality of sealing strips. Method The method involves three steps:global registration of the contours of the captured image and reference drawing, local registration of the contours of the captured image and reference drawing, and calculation of deviations. Global registration includes three sub-steps:corner extraction, initial registration, and fine-tuning. First, corners of the contours of the sealing strips for computer vision-based measurement are extracted using a multi-resolution-based contour corner extraction algorithm. Second, on the basis of the idea of minimizing the mean square error, an exhaustive search method is applied on the corner sets of the contours of the captured image and reference drawing to obtain the matched corner pairs and affine transformation matrix. Finally, to improve the accuracy of the initial registration, the corner pairs with larger position deviation than the average position deviation are removed from the matched corner sets, and the remaining matched corners are fed into the linear regression equation to fine-tune the affine transformation matrix. On the basis of global registration, local registration aims to determine the corresponding relationships between the local contours of the captured image and reference drawing. The shape descriptors extracted from the two global contours include shape representation and restrictions of the local contours, and the similarity of shape descriptors is used to obtain the optimal result of local registration. After the global and local registrations, the positional deviations of the sealing strips are measured on the basis of the corresponding predefined instances of positional tolerances. Here, the instances of positional tolerances are defined on the reference drawing and are used in the calculation of corresponding deviations. For all deviations, if the measured value is within the corresponding tolerance, then the quality check passes. This study concentrates on the distance and angular deviations, such as point offsetting, point distance limitation, and angular positional deviations. Point offsetting deviation refers to the offsetting distance from the original point defined on the contour of the reference drawing to the corresponding point on the contour of the captured image. The corresponding point is obtained by the similarity between two shape descriptors calculated in the previous local registration. Point distance limitation deviation refers to the maximum distance from the point on the corresponding line segment of the measurement segment to the corresponding datum line on the contour of the captured image. Point distance limitation tolerance indicates the tolerable distance from the original point to the datum line defined in the reference drawing. For angular positional deviation, the intersection of the two perpendicular bisectors of the two tolerance lines defined in the standard contour is computed as the rotation center of the angular positional deviation. In the measurement, the angular positional deviation is quantified as the value of the angle between the line segments from the barycenter of the measured local contour of the captured image to the rotation center of the angular positional deviation and from the barycenter of the standard local contour of the reference drawing to the rotation center of the angular positional deviation. Finally, the product quality can be assessed automatically on the basis of the tolerances and deviations of the sealing strips. Result In this study, the sealing strips are registered using a two-stage registration algorithm, and various deviations are measured between the local contours of the captured image and reference drawing. The proposed method has been tested in the actual production process. Several types of sealing strips have been tested during the experiments, whereas all captured images of the actual products have been rotated to increase the number of testing images. Finally, experimental results show that the method achieves good stability and reliability and is invariant to the rotation of the position of the sealing strips. These results are consistent with the manual testing results. Therefore, the system can effectively promote the development of automated testing for sealing strips. Conclusion This study proposes a novel vision-based deviation measurement method for flexible sealing strips. The proposed method achieves good stability and reliability in the actual production process, as well as effectively performs the deviation measurement and quality inspection of flexible products. The proposed method can accelerate the development of automated quality inspection because it can automatically measure the deviation of sealing strips.

Key words

vision-based measurement; sealing strip; image registration; deviation; corner detection

0 引言

汽车密封条具有防水防尘、减震隔音和提高舒适度等功能,是影响汽车整车质量的重要产品。因此,对于汽车密封条生产厂商,在生产过程中实时进行误差测量和质量监控十分重要[1]

密封条是典型的柔性橡胶产品,只能进行非接触式测量,而无法像刚性产品一样进行接触式测量。目前密封条测量系统的研究较为广泛,蔡汉明等人[2]通过密封条的1维尺寸进行质量监控,局限性较大。陈丽娟等人[3]提出基于最小包围面积矩形的密封条截面轮廓缺陷检测方法,主要使用基于最小包围面积矩形和基于角度直方图的联合配准算法进行图像骨架配准,然后测量产品误差进行质量检验。马旭等人[4]基于激光视觉测量原理,采用4套线结构光传感器获取密封条完整轮廓,并通过4种轮廓截面数据的筛选和融合,提高了系统测量的稳定性和可靠性,但系统操作繁杂,不利于工业推广。

密封条视觉测量系统主要用于测量汽车密封条的位置误差,系统主要包括图像预处理、轮廓配准和误差测量3部分,而图像配准又是其中最重要的一环。虽然柔性配准算法[5-6]研究广泛,但针对测量的柔性配准算法[7]研究较少,且测量对象主要为叶片轮廓[8]、药丸外形[9]和汽车橡胶轮廓[10]等。在图像配准领域,Abraham等人[11]利用FAST(features from accelerated segment test)算子检测图像关键点,然后构造HOG(histogram of oriented gradient)描述子,最后利用回归方程计算仿射变换矩阵。Huang等人[12]通过融合基于特征和基于强度的配准算法,然后引入金字塔思想,不断迭代优化配准结果。Li等人[13]通过在梯度域进行配准而规避直接像素匹配带来的噪声干扰因素。Motta等人[14]通过各种相似性变换、放射变换、投影变换和二次变换的综合分析,得到最优变换,同时提出使用配准前后的图像公共像素数量比(GC参数)来度量配准精度。朱逸等人[15]提出了一种基于角点匹配的密封条截面图像分块配准算法,先通过支持邻域[16]获取密封条轮廓角点,然后使用分块角点匹配求取每块的仿射变换初始值,最后使用最小二乘搜索策略获得最佳配准效果。但该方法只进行全局匹配,未考虑密封条的局部轮廓特性。局部轮廓配准需要克服不规则变形、平移、旋转等影响因素,匹配难度大。轮廓配准后需要进行误差测量,误差类型主要包括距离误差[3]、角度误差[17]和面积误差[18]等,最后通过误差大小进行产品质量检验。陈丽娟等人[3]通过计算测试图像相对标准图像的波动距离进行合格性检验,Li等人[17]通过形变部位的角度偏转误差进行合格性检验,Karunasena等人[18]通过密封条横截面积的误差大小进行判断。

本文针对密封条测量领域存在的问题,提出了一种新的柔性密封条截面误差自动视觉测量方法。该方法通过两步配准算法,首先利用基于多分辨率的轮廓角点提取算法[19]进行角点检测和初始配准,并基于线性回归进行微调,然后利用形状描述子[17]进行局部轮廓精确配准,最后对配准后的轮廓进行距离误差和角度误差测量,从而完成密封条的质量检验。

1 柔性密封条截面误差自动视觉测量方法

本文方法主要包括3个阶段: 1)利用基于多分辨率的轮廓角点提取算法进行图像角点检测,然后利用提取的角点进行图像初始配准并微调;2)利用形状描述子进行精确配准;3)最后对配准后的轮廓进行误差测量。

1.1 初始配准

通过初始配准,可以合理调整图像的位置,为后续精确配准提供良好的初始位置。采用基于多分辨率的轮廓角点提取算法进行图像角点提取,然后通过最小化均方误差进行图像初始配准,最终利用线性回归进行微调。

算法具体步骤如下:

1) 角点提取。首先利用经典的Canny边缘检测算子提取实际产品图像轮廓,然后利用基于多分辨率的轮廓角点提取算法进行角点提取,该算法通过多种尺度下的角点信息综合来提高角点检测的稳定性,而且算法提取的角点配对率高,容易进行配对。

基于多分辨率的轮廓角点提取算法主要架构如图 1所示, 其中$L\left( {ik} \right)$表示第$i$层金字塔。

图 1 基于多分辨率的轮廓角点提取算法示意图
Fig. 1 Multi-resolution-based contour corner extraction algorithm

首先通过多种分辨率邻域进行角点提取,从而构建图 1左侧多层金字塔,然后通过多种分辨率邻域下的特征值提取结果进行综合,从而完成图 1右侧各层金字塔的角点提取,最后进行各层金字塔角点值的综合来完成最终的角点提取。各层金字塔角点值更新为

$ \varphi \left( {{x_i}} \right) = \frac{{\sum\limits_{i = 1}^n C \left( {{x_i}, t} \right) \times {\omega _t}}}{{\sum\limits_{i = 1}^n {{\omega _t}} }} $ (1)

式中,$n$表示金字塔的层数,${\omega _t}$表示第$t$层金字塔角点的权重,$C\left( {{x_i}, t} \right)$表示点${x_i}$在第$t$层金字塔是否为角点。最后筛选出角点值$\varphi \left( {{x_i}} \right)$大于阈值$\sigma $的预选角点作为最终的轮廓角点。

2) 初始配准。计算出标准轮廓图和实际产品图的角点后,通过最小化角点匹配均方误差来计算仿射变换矩阵,即

$\left[ {\begin{array}{*{20}{l}} {{X^\prime }}\\ {{Y^\prime }}\\ 1 \end{array}} \right] = s\left[ {\begin{array}{*{20}{c}} {\cos \theta }&{ - \sin \theta }&{Tx}\\ {\sin \theta }&{\cos \theta }&{Ty}\\ 0&0&1 \end{array}} \right]\left[ {\begin{array}{*{20}{l}} X\\ Y\\ 1 \end{array}} \right] $ (2)

式中,$X$$Y$$X'$$Y'$分别表示角点的原始横坐标和纵坐标以及变换后的横坐标和纵坐标,$ s $为放缩尺度大小,$\theta $为旋转角度,$Tx$$Ty$为横坐标和纵坐标平移大小。放缩尺度$s$可通过拍摄图中参照物直接求解,故不再讨论。

假设标准轮廓图和实际产品图提取的角点集分别为$\mathit{\boldsymbol{P}}\left( {{p_i}} \right), 1 \le i \le {N_p}$$\mathit{\boldsymbol{Q}}\left( {{q_i}} \right), 1 \le i \le {N_q}$,其中,${N_p}$${N_q}$分别表示标准轮廓图和实际产品图的角点数量。

$\mathit{\boldsymbol{P}}\left( {{p_i}} \right)$$\mathit{\boldsymbol{Q}}\left( {{q_i}} \right)$中分别任取两点${p_a}, {p_b}, {q_c}, {q_d}$,计算点${p_a}$${p_b}$的中心坐标

$ {p_m} = \left( {\frac{{{p_{ax}} + {p_{bx}}}}{2}, \frac{{{p_{ay}} + {p_{by}}}}{2}} \right) = \left( {{p_{mx}}, {p_{my}}} \right) $ (3)

和点${q_c}$${q_d}$的中心坐标

$ {p_n} = \left( {\frac{{{q_{cx}} + {q_{dx}}}}{2}, \frac{{{q_{cy}} + {q_{dy}}}}{2}} \right) = \left( {{p_{nx}}, {p_{ny}}} \right) $ (4)

然后计算${P_m}$${P_n}$的平移结果作为最终的平移结果$\left( {Tx, Ty} \right)$,将线段${p_a}$${p_b}$${q_c}$${q_d}$的旋转角度作为旋转角度$\theta $

假设点${z_i}\left( {{z_{ix}}, {z_{iy}}} \right)$$\mathit{\boldsymbol{Q}}\left( {{z_i}} \right)$中离点${p_j}\left( {{p_{jx}}, {p_{jy}}} \right)$最近的点,且满足

$ \Delta ij = {\left( {{z_{ix}} - {p_{jx}}} \right)^2} + {\left( {{z_{iy}} - {p_{jy}}} \right)^2} \le r $ (5)

则认为点${z_i}\left( {{z_{xi}}, {z_{yi}}} \right)$${p_j}\left( {{p_{xj}}, {p_{yj}}} \right)$为一对候选匹配角点,$\Delta ij$为匹配误差。然后计算所有角点的匹配误差

$ \Delta \left( {{p_a}, {p_b}, {q_c}, {q_d}} \right) = \sum\limits_{i = 1}^{{N_q}} {{\Delta _{ij}}} $ (6)

最后穷举$\mathit{\boldsymbol{P}}\left( {{p_i}} \right)$中任意两点的匹配误差Δ,并将最小匹配误差Δmin对应的转换关系作为最终的初始配准方案,即

$ T = \mathop {\min }\limits_{\begin{array}{*{20}{c}} {{p_a},{p_b} \in \mathit{\boldsymbol{P}},{p_a} \ne {p_b}}\\ {{q_c},{q_d} \in \mathit{\boldsymbol{Q}},{q_c} \ne {q_d}} \end{array}} {\mkern 1mu} \Delta \left( {{p_a},{p_b},{q_c},{q_d}} \right) $ (7)

3) 微调。步骤2)中的初始配准可以计算出实际产品图到标准轮廓图的仿射变换,但因为图像本身存在噪声且柔性产品边缘容易形变,该变换仍需要进行微调。微调主要包括平均误差计算、异常值剔除以及线性回归方程求解3个步骤。

(1) 平均误差计算。计算角点集$\mathit{\boldsymbol{P}}\left( {{p_i}} \right)$$\mathit{\boldsymbol{Q}}\left( {{z_i}} \right)$中所有匹配角点对的平均误差

$ \begin{matrix} d(\boldsymbol{P}, \boldsymbol{Q})= \\ \frac{\sqrt{{{\left( {{p}_{1}}-{{z}_{1}} \right)}^{2}}+{{\left( {{p}_{2}}-{{z}_{2}} \right)}^{2}}+\cdots +{{\left( {{p}_{n}}-{{z}_{n}} \right)}^{2}}}}{n} \\ \end{matrix} $ (8)

式中,${{z}_{i}}$$\mathit{\boldsymbol{Q}}\left( {{z_i}} \right)$中与${{p}_{i}}$匹配的角点,$n$为匹配总数。

(2) 异常值剔除。为了减小输入图片的噪声和柔性产品形变的影响,需要剔除部分匹配精度不高的角点对,即

$ \left| {{p}_{i}}-{{z}_{i}} \right|\ge d(\boldsymbol{P}, \boldsymbol{Q}) $ (9)

即剔除匹配误差大于平均误差的角点对。

(3) 线性回归方程求解。最后将角点集$\mathit{\boldsymbol{P}}\left( {{p_i}} \right)$$\mathit{\boldsymbol{Q}}\left( {{z_i}} \right)$中剩余所有匹配角点对代入回归方程求解,即

$ \begin{array}{l} J(a, b, c, d) = \frac{1}{m}\sum\limits_{i = 1}^m {{{\left( {\left| {h\left( {{p_i}} \right) - {z_i}} \right|} \right)}^2}} = \\ \frac{1}{m}\sum\limits_{i = 1}^m {{{\left( {a{p_{ix}} + b - {z_{ix}}} \right)}^2}} + {\left( {c{p_{iy}} + d - {z_{iy}}} \right)^2} \end{array} $ (10)

式中,$h\left( {{p_i}} \right) = \left( {a{p_{ix}} + b, c{p_{iy}} + d} \right)$为点${{p}_{i}}$的线性方程。

$J\left( {a, b, c, d} \right)$求偏导得

$ \begin{array}{*{20}{c}} {\frac{{\partial J(a, b, c, d)}}{{\partial a}} = \frac{2}{m} \times \left( {ma + \sum\limits_{i = 1}^m {\left( {b{p_{ix}} - {z_{ix}}} \right)} } \right)}\\ {\frac{{\partial J(a, b, c, d)}}{{\partial b}} = \frac{2}{m} \times \left( {b\sum\limits_{i = 1}^m {p_{ix}^2} + \sum\limits_{i = 1}^m {{{\left( {a - {z_{ix}}} \right)}^2}} } \right)}\\ {\frac{{\partial J(a, b, c, d)}}{{\partial c}} = \frac{2}{m} \times \left( {mc + \sum\limits_{i = 1}^m {\left( {d{p_{iy}} - {z_{iy}}} \right)} } \right)}\\ {\frac{{\partial J(a, b, c, d)}}{{\partial d}} = \frac{2}{m} \times \left( {d\sum\limits_{i = 1}^m {p_{iy}^2} + \sum\limits_{i = 1}^m {{{\left( {d - {z_{iy}}} \right)}^2}} } \right)} \end{array} $ (11)

$\frac{{\partial J(a, b, c, d)}}{{\partial a}} = \frac{{\partial J(a, b, c, d)}}{{\partial b}} = 0$, 可得

$ \left\{ {\begin{array}{*{20}{l}} {a = \frac{{\sum {{z_{ix}}} - b\sum {{p_{ix}}} }}{m}}\\ {b = \frac{{\sum {{p_{ix}}} \sum {{z_{ix}}} - m\sum {{p_{ix}}} {z_{ix}}}}{{{{\left( {\sum {{p_{ix}}} } \right)}^2} - m\sum {p_{ix}^2} }}} \end{array}} \right. $ (12)

同理得

$ \left\{ {\begin{array}{*{20}{l}} {c = \frac{{\sum {{z_{iy}}} - d\sum {{p_{iy}}} }}{m}}\\ {d = \frac{{\sum {{p_{iy}}} \sum {{z_{iy}}} - m\sum {{p_{iy}}} {z_{iy}}}}{{{{\left( {\sum {{p_{iy}}} } \right)}^2} - m\sum {p_{iy}^2} }}} \end{array}} \right. $ (13)

最后使用线性回归方程微调实际图和标准图的仿射变换结果。

1.2 精确配准

精确配准是对图像轮廓进行进一步调整,使配准结果更加合理,以便于进行下一步的误差测量。采用Li等人[17]提出的基于形状描述子的配准算法进行精确配准,首先提取图像轮廓的形状描述子,然后利用形状描述子的相似度进行精确配准。

1.2.1 形状描述子

对于一段局部轮廓,该描述子的定义为

$ {\mathit{\boldsymbol{D}}_{{\rm{ps}}}} = \{ \mathit{\boldsymbol{S}}(\Delta , \mathit{\boldsymbol{V}}, t), \mathit{\boldsymbol{G}}(L, f)\} $ (14)

式中,集合$\mathit{\boldsymbol{S}}$表示形状特征和相关位置约束,包括描述子构建的三角形Δ,方向向量$\mathit{\boldsymbol{V}}$和三角形类型参数$t$,集合$\mathit{\boldsymbol{G}}$表示几何约数,包括点集$\mathit{\boldsymbol{L}}$的长度($L$)和波动大小$f$

局部轮廓$AB$上构建的三角形要求另一个顶点$C$为该轮廓上到线段$AB$距离最远的点,且该距离大于给定阈值,而方向向量$\mathit{\boldsymbol{V}}$为顶点$C$到线段$AB$的垂线,如图 2所示。

图 2 形状描述子说明
Fig. 2 An example of the shape descriptor

当三角形的$AB$线段上的高不满足条件时,在轮廓$AB$的前后一定邻域范围内搜索满足条件的顶点$C$,从而构建不同类型的三角形。

几何约束中点集$\mathit{\boldsymbol{L}}$的长度($L$)为轮廓$AB$的曲线长度,而波动大小$f$为轮廓$AB$上的点到线段$AB$的最大距离。

为了得到更好的匹配效果,使用容错形状描述子进行配准,该描述子的定义为

$ {\mathit{\boldsymbol{D}}_{{\rm{tps}}}} = \left\{ {\mathit{\boldsymbol{S}}\left( {{\Delta _s}, {\mathit{\boldsymbol{V}}_s}, t} \right), \mathit{\boldsymbol{G}}\left( {{k_1} \times L, {k_2} \times f} \right)} \right\} $ (15)

式中,${\Delta _s}$是与原三角形形状相似的三角形,${\mathit{\boldsymbol{V}}_s}$是和原向量$\mathit{\boldsymbol{V}}$方向相似的向量且满足$\left\langle {\mathit{\boldsymbol{V}}, {\mathit{\boldsymbol{V}}_s}} \right\rangle \in \left[{- {C_A}, {C_A}} \right]$, ${k_1} \in \left[{{L_\text{l}}, {L_{\rm{u}}}} \right]$${k_2} \in \left[{{F_\text{l}}, {F_{\rm{u}}}} \right]$。其中,$\left\langle {\mathit{\boldsymbol{V}}, {\mathit{\boldsymbol{V}}_s}} \right\rangle $表示两个向量夹角,参数${C_A}$${L_{\rm{l}}}$${L_{\rm{u}}}$${F_{\rm{l}}}$${F_{\rm{u}}}$是定义公差的常量。

1.2.2 基于形状描述子的精确配准

经过初始配准,轮廓的起点$S$和终点$E$可以直接获取,匹配的搜索范围限制在当前位置的$n$个邻近点。具体的配准过程如下:

1) 对于满足${P_A} \in [S-n, E + n]$的点对${P_B} \in [S- n, {\rm{ }}E + n{\rm{ }}]$的点对$ P_{A}, P_{B} $

(1) 计算点集${\mathit{\boldsymbol{P}}_A}{\mathit{\boldsymbol{P}}_B}$的长度$L_{m}$和波动$f_{m}$

(2) 检查$L_{m}$$f_{m}$是否满足式(15),即如果${L_{\rm{l}}} \le \frac{{{L_m}}}{L} \le {L_{\rm{u}}}$${F_\text{l}} \le \frac{{{f_m}}}{f} \le {F_{\rm{u}}}$,则进入步骤(3);否则重新进行步骤1);

(3) 构建描述子对应的三角形和方向向量;

(4) 判断式(15)中的方向向量约束是否满足。如果构建的方向向量和标准方向向量差异不超过${C_A}$,则进入步骤(5);否则重新进行步骤1);

(5) 计算对应三角形的相似度。计算两个三角形对应的3个内角差值,用差值绝对值的累加和$\Delta s$进行相似度判断。如果构建了两个三角形,用两个三角形的总和进行判断。

(6) 记录最小累加和$\Delta {s_{{\rm{min}}}}$与对应的点对。

2) 如果存在记录好的点对,则匹配成功并返回。否则扩大搜索范围,设$n = 2 \times n$,返回步骤1)。

3) 如果存在记录好的点对,则匹配成功并返回;否则匹配失败。

1.3 公差定义与误差测量

图像匹配过程结束后,需要进行误差测量来量化产品偏差和质量检验。

1.3.1 公差定义

设置了3类公差,分别为测量点偏移公差、点极限距离公差(距离误差)和测量段偏转公差(角度误差),其定义方式如图 3所示。

图 3 公差定义
Fig. 3 Tolerance definition
((a)point offset tolerance definition; (b)point distance limitation tolerance definition; (c)segment tolerance definition)

点偏移公差表示指定点在上下左右4个方向的相对偏移${d_i}(1 \le i \le 4)$以及偏转角度${\theta _0}$,如图 3(a)所示。点极限距离公差表示指定点到指定直线距离的最大偏移量,包括指定点到水平直线和垂直直线的偏移公差距离,如图 3(b)所示。而测量段偏转公差指测量段旋转最大位置,即最大旋转角度,如图 3(c)所示,密封条右侧红色轮廓为标准轮廓,旁边蓝色和绿色分别为逆时针段偏转公差和顺时针段偏转公差,分别为81.730 7°和-7.912 4°,放大后如图 4所示。

图 4 测量段偏转公差放大图
Fig. 4 Enlarged view of segment tolerance definition

公差定义后,测量系统将测量标准轮廓与实际轮廓配准结果图的误差,并与定义的公差进行比对。若误差处于公差范围内,则判定产品合格;否则判定产品不合格。

1.3.2 误差测量

测量的误差对应公差定义时的3种误差类型,包括点偏移误差、点极限误差和段偏转误差。

点偏移误差表示实际轮廓图上对应点到公差定义点的距离,其如图 5(a)中黑点到红点距离,图 5(b)为误差测量放大图。实际使用过程中将该距离按照偏转角度${\theta _0}$拆分成横向和纵向偏移误差。

图 5 点偏移误差
Fig. 5 Point offset error
((a)original image; (b)enlarged image)

具体计算过程包括两步:

1) 由配准过程计算结果获取公差定义点$p\left( {{x_0}} \right., {y_0})$在实际轮廓上对应的点$q\left( {{x_1}, {y_1}} \right)$

2) 计算$q\left( {{x_1}, {y_1}} \right)$相对$p\left( {{x_0}} \right., {y_0})$在偏转${\theta _0}$后的横向点偏移误差$\Delta {p_x}$和纵向点偏移误差$\Delta {p_y}$,即

$ \Delta {p_x} = \left( {{x_1} - {x_0}} \right)\cos {\theta _0} + \left( {{y_1} - {y_0}} \right)\sin {\theta _0} $ (16)

$ \Delta {p_y} = \left( {{y_1} - {y_0}} \right)\cos {\theta _0} + \left( {{x_1} - {x_0}} \right)\sin {\theta _0} $ (17)

点极限距离误差表示待测点到指定直线的距离与公差定义时该点到指定直线(如图 3(b))的距离之差,如图 6所示。该点极限距离误差为图 6中黑点到粉红色水平直线的距离与图 3(b)中红点到红色水平直线距离之差$\Delta d$

图 6 点极限距离误差
Fig. 6 Point distance limitation error

段偏转误差的计算如Li等人[17]所述,为标准图像局部轮廓重心与旋转中心形成的线段和实际图像局部轮廓重心与旋转中心形成的线段的顺时针角度${\theta _{\rm{l}}}$或逆时针角度${\theta _{\rm{r}}}$

2 实验分析

2.1 测量系统设计

本文所提出的柔性密封条截面误差自动视觉测量方法已经在Microsoft Visual C++ 2013中实现了一个原型系统,并在Win7 64位操作系统、Intel I5-3210M CPU 2.50 GHz和8 GB内存的环境下进行了实验。

密封条测量系统主要包含6个功能模块,分别是摄像头模块、公差定义模块、图像获取和预处理模块、初始配准模块、精确配准模块和测量与输出模块。

为了验证系统的准确性,引用了Li等人[17]的模板和用无线切割技术生成的产品部件, 标准模板几乎和实际的生成样本完全匹配,且最大误差的平均值和标准差分别为0.075 3 mm和0.013 7 mm。而密封条产品的测量精度一般为0.2 mm,因此,本文配准算法可以保证测量系统的精度。

2.2 实际产品测量结果

因为系统包含配准和测量两个主要模块,所以实验结果主要分为两部分,分别为配准结果和测量结果。

2.2.1 图像配准实验

图像配准包括两步:初始配准和精确配准。使用图 7所示密封条作为测试对象,图 7(a)为标准轮廓图,图 7(b)为实际产品轮廓图。

图 7 密封条轮廓图
Fig. 7 Contour of sealing strips
((a) standard contour; (b) actual contour)

最终配准结果如图 8所示,其中初始配准结果如图 8(a)所示,红色轮廓为实际产品图轮廓,黑色轮廓为标准设计图轮廓;精确配准结果如图 8(b)所示,从配准结果图明显可以看出精确配准后,标准轮廓图和实际轮廓图的匹配效果更好,轮廓重叠的部位更多。

图 8 配准结果图
Fig. 8 Registration results ((a) initial registration result; (b) accurate registration result)

初始配准中,主要参数有角点权重${\omega _t}$和匹配误差阈值$t$。考虑到各层金字塔所代表特征不同,实验所使用权重为${\omega _t} = t(1 \le t \le n)$,具体分析可查阅文献[19]。匹配误差阈值$t$的设置需要参考图像大小,考虑到实验所用图像均为1 024×768像素,故阈值$t$为4 000,即匹配点对的距离需要小于63。当阈值$t$设为400和40 000时,配准结果如图 9所示,从图 9可以看出,阈值$t$对于配准的精度基本没有影响。但当阈值$t$过小,设为40时,即匹配点对距离小于6,将导致所有角点都无法匹配,无法产生配准图。

图 9 不同阈值下的初始配准图
Fig. 9 Initial registration results of different t
((a) $t = 400$; (b) $t = 40\;000$)

精确配准中,配准参数主要与形状描述子有关,文中这些参数的选取与文献[17]一致。

2.2.2 产品测量实验

密封条产品的工业标准即为产品设计的公差范围,产品的测量过程主要通过测量实际产品的误差,然后判断误差是否在公差范围内来判断产品是否合格。

对于图 7所示密封条, 点偏移公差为${d_i} = 2{\mathop{\rm mm}\nolimits} (1 \le i \le 4)$${\theta _0}=0$; 点极限距离公差上下界均分别为1 mm; 而段偏移公差上界为9.685 04°,下界为-10.142 61°,即正向误差在(-999, 9.685 04),且反向误差在(-10.142 61, 999)范围内,则判断段偏移误差合格。最终测量结果如图 10所示。

图 10 密封条测量结果图
Fig. 10 Measurement results of sealing strips

为了验证本文算法的稳定性,将图像以30°为单位,旋转11次,生成另外11幅图像。最终12幅图像的测试结果如表 1所示,表 1$\Delta {p_x}$$\Delta {p_y}$$\Delta d$${\theta _{\rm{l}}}$${\theta _{\rm{r}}}$依次表示横向和纵向点偏移误差、点极限距离误差、顺时针和逆时针的段偏移误差。表 1说明了本文所有测量误差均在小范围内波动且全都在相应的公差范围内,证明了该方法的稳定性和可重复性。

表 1 旋转后误差测量结果
Table 1 Error measurement after rotation

下载CSV
角度/(°) Δpx/mm Δpy/mm Δd/mm θl/(°) θr/(°)
0 -1.65 0.54 0.36 -4.18 -15.21
30 -1.70 0.58 0.37 -2.46 -10.43
60 -1.27 0.31 0.25 -5.67 -17.39
90 -1.21 0.62 0.40 -0.66 -10.20
120 -2.00 0.71 0.41 -3.02 -10.41
150 -1.09 0.21 0.27 -3.73 -12.08
180 -1.08 0.43 0.35 -3.08 -12.49
210 -1.99 0.67 0.39 -4.13 -13.12
240 -0.83 0.41 0.30 -3.02 -13.93
270 -1.41 0.69 0.40 -3.65 -14.25
300 -1.98 0.72 0.41 -3.05 -9.29
330 -1.47 0.44 0.36 -3.59 -15.03
平均值 -1.47 0.53 0.36 -3.35 -12.82
标准差 0.38 0.16 0.05 1.14 2.35

对处于同一个生产周期的其他3个密封条轮廓也进行了测试,4次测试结果如表 2所示。表 2结果表明,密封条具有一定的柔性,产品误差在一个小范围内波动。同时表 2也证明了本文算法的可靠性。

表 2 不同密封条误差测量结果
Table 2 Measurement results of different sealing strips

下载CSV
编号 Δpx/mm Δpy/mm Δd/mm θl/(°) θr/(°) 结果
1 -1.65 0.54 0.36 -4.18 -15.21 合格
2 0.02 0.31 0.21 31.94 14.74 合格
3 -0.20 -0.01 -0.04 -0.02 -2.14 合格
4 0.05 0.04 0.02 -5.59 -7.39 合格

此外,对算法的耗时情况进行了实验分析。假设实际产品图和标准设计图轮廓点数量分别为${N_p}$, ${N_q}$, 支持邻域长度为$l$, 金字塔层数为$m$, 提取的角点数量分别为$p, q$,那么初始配准的时间复杂度为角点提取耗时、仿射变换耗时和线性回归耗时的总和,${\rm{O}}\left( {\left( {{N_p} + {N_q}} \right) \times l \times m + p \times p \times q + p} \right)$。实际实验中,$p$$q$一般小于40,而图像轮廓点${N_p}$${N_q}$大于5 000,支持邻域长度$l$大于200,金字塔层数超过3层,故耗时最长的地方实际为角点提取阶段。假设精确配准搜索范围为前后$n$个点,那么精确配准的时间复杂度为$\text{O}\left( {8 \times {n^3}} \right)$。实际实验过程中各步骤耗时如表 3所示。

表 3 算法各阶段耗时
Table 3 Time-consuming in each stage

下载CSV
/s
编号 初始配准 精确配准 总耗时
角点提取 其他
1 6.293 0.014 2.611 8.918
2 9.085 0.047 2.279 11.411
3 4.141 0.016 1.405 5.562
4 5.247 0.016 2.468 7.731

在测试样例中,部分形变较大的测试样例如图 11(a)所示,最终测试结果如图 12(a)所示。从图 12(a)可以看出,该密封条截面明显误差较大,局部形变严重,因而未通过质量检测。除此以外,还有部分特殊的密封条存在由于块移位导致的变形,此时直接用本文方法测量误差较大。测试实例和结果如图 11(b)图 12(b)所示。对这种特殊变形的密封条截面可采用文献[15]的分块配准思想对块移位进行恢复来获得较好的结果,本文不再详述。

图 11 异常密封条
Fig. 11 Abnormal sealingstrips
((a)sealing strip with large deformation; (b)sealing strip with deformation caused by block shifting)
图 12 异常测量结果
Fig. 12 Abnormal measurement results
((a) sealing strip with large deformation; (b) sealing strip with deformation caused by block shifting)

最后,测试了图 7同类产品的400个样例,其中既包括结构简单形变较小的密封条,也包括部分结构复杂且形变较大的密封条,但最终所有测试结果都和熟练工人质检结果一致。

实验表明本系统可以有效提高密封条误差测量的稳定性和可靠性,同时也表明本文进一步拓展了柔性产品的自动化测量方法。

3 结论

提出一种新的柔性密封条截面误差自动视觉测量方法,主要包括基于角点的初始配准和基于形状描述子的局部轮廓精确配准,最后进行公差计算和误差测量来量化产品质量。实验结果表明,该方法具有良好的旋转不变性,能适应复杂的生产环境,且测量误差小,测试结果与人工质检结果完全一致,能有效提高密封条测量精度,并拓展柔性产品的自动化测量方法。但密封条轮廓配准的优劣依赖于密封条轮廓的提取准确性,而本文并未就此进行讨论,在后续工作中需要研究如何能够更准确地提取图像轮廓。同时,本文方法基于图像单个像素,若要进一步提高测量精度,后续可以引入亚像素。

参考文献

  • [1] Chen W H, Tao L, Mao R J, et al. Design of automatic cutting machine for automobile sunroof sealing strip[J]. Manufacturing Technology & Machine Tool, 2018(7): 162–166. [陈卫华, 陶略, 毛瑞杰, 等. 汽车天窗密封条自动下料机设计[J]. 制造技术与机床, 2018(7): 162–166. ] [DOI:10.19287/j.cnki.1005-2402.2018.07.033.]
  • [2] Cai H M, Liu G X, Zhao L W, et al. Study of the image processing in the sealing strip's measuring system[J]. China Measurement Technology, 2007, 33(3): 4–6. [蔡汉明, 刘国霞, 赵利伟, 等. 图像处理在密封条尺寸测量中的应用研究[J]. 中国测试技术, 2007, 33(3): 4–6. ] [DOI:10.3969/j.issn.1674-5124.2007.03.002]
  • [3] Chen L J, He F Q, He L. Sealing strip cross section contour defects detection method based on surrounded by minimum area of rectangle[J]. Computer Measurement & Control, 2014, 22(2): 534–535, 538. [陈丽娟, 贺福强, 何磊. 基于最小包围面积矩形的密封条截面轮廓缺陷检测方法[J]. 计算机测量与控制, 2014, 22(2): 534–535, 538. ] [DOI:10.3969/j.issn.1671-4598.2014.02.069]
  • [4] Ma X, Wang P, Sun C K. An on-line laser-vision system for measurement of sealing strip's section profile[J]. Nanotechnology and Precision Engineering, 2017, 15(1): 44–52. [马旭, 王鹏, 孙长库. 密封条轮廓激光视觉在线检测系统[J]. 纳米技术与精密工程, 2017, 15(1): 44–52. ] [DOI:10.13494/j.npe.20150138]
  • [5] Sorokin D V, Peterlik I, Tektonidis M, et al. Non-rigid contour-based registration of cell nuclei in 2-D live cell microscopy images using a dynamic elasticity model[J]. IEEE Transactions on Medical Imaging, 2018, 37(1): 173–184. [DOI:10.1109/TMI.2017.2734169]
  • [6] Wang G, Zhou Q Q, Chen Y F. Robust non-rigid point set registration using spatially constrained Gaussian fields[J]. IEEE Transactions on Image Processing, 2017, 26(4): 1759–1769. [DOI:10.1109/TIP.2017.2658947]
  • [7] Maiseli B, Gu Y F, Gao H J. Recent developments and trends in point set registration methods[J]. Journal of Visual Communication and Image Representation, 2017, 46: 95–106. [DOI:10.1016/j.jvcir.2017.03.012]
  • [8] Huang J H, Yuan Y C, Wang Z, et al. A global-to-local registration and error evaluation method of blade profile lines based on parameter priority[J]. The International Journal of Advanced Manufacturing Technology, 2018, 94(9-12): 3829–3839. [DOI:10.1007/s00170-017-1125-0]
  • [9] Maddala K T, Moss R H, Stoecker W V, et al. Adaptable ring for vision-based measurements and shape analysis[J]. IEEE Transactions on Instrumentation and Measurement, 2017, 66(4): 746–756. [DOI:10.1109/TIM.2017.2650738]
  • [10] Anchini R, Di Leo G, Liguori C, et al. Metrological characterization of a vision-based measurement system for the online inspection of automotive rubber profile[J]. IEEE Transactions on Instrumentation and Measurement, 2009, 58(1): 4–13. [DOI:10.1109/TIM.2008.2004979]
  • [11] Abraham E, Mishra S, Tripathi N, et al. HOG descriptor based registration (a new image registration technique)[C]//Proceedings of the 15th International Conference on Advanced Computing Technologies. Rajampet, India: IEEE, 2013: 1-4.[DOI:10.1109/ICACT.2013.6710513]
  • [12] Huang L X, Shen Z X. A hybrid image registration technique for multi-spectral images application[C]//Proceedings of the 5th International Congress on Image and Signal Processing. Chongqing: IEEE, 2012: 977-981.[DOI:10.1109/CISP.2012.6469722]
  • [13] Li Y Q, Chen C, Zhou J H, et al. Robust image registration in the gradient domain[C]//Robust image registration in the gradient domain. The 12th IEEE International Symposium on Biomedical Imaging (ISBI). New York, USA: IEEE, 2015: 605-608.[DOI:10.1109/ISBI.2015.7163946]
  • [14] Motta D, Casaca W, Paiva A. Fundus image transformation revisited: towards determining more accurate registrations[C]//Proceedings of the 31st IEEE International Symposium on Computer-Based Medical Systems. Karlstad, Sweden: IEEE, 2018: 227-232.[DOI:10.1109/CBMS.2018.00047]
  • [15] Zhu Y, Tu Y X, Du Z C. A block-registration algorithm for strip of section image based on corner points matching[J]. Machine Design and Research, 2012, 28(3): 55–57, 61. [朱逸, 屠晏欣, 杜正春. 基于角点匹配的密封条截面图像分块配准算法[J]. 机械设计与研究, 2012, 28(3): 55–57, 61. ] [DOI:10.3969/j.issn.1006-2343.2012.03.016]
  • [16] Tu Y X, Zhu Y, Du Z C. A new corner detection algorithm based on barycenter finding[J]. Journal of Shanghai Jiaotong University, 2011, 45(7): 1031–1034, 1040. [屠晏欣, 朱逸, 杜正春. 一种基于重心计算的角点检测算法[J]. 上海交通大学学报, 2011, 45(7): 1031–1034, 1040. ] [DOI:10.16183/j.cnki.jsjtu.2011.07.018]
  • [17] Li J H, Du Z Z, Wang Y. Shape descriptor-based local contour profile registration and measurement for flexible automotive sealing strips[J]. Journal of Computing and Information Science in Engineering, 2018, 18(2): #021006. [DOI:10.1115/1.4039430]
  • [18] Karunasena C, Wickramarachchi N. Vision based cross sectional area estimator for industrial rubber profile extrusion process controlling[C]//Proceedings of the 5 th International Conference on Information and Automation for Sustainability. Colombo, Sri Lanka: IEEE, 2010: 1-6.[DOI:10.1109/ICIAFS.2010.5767511]
  • [19] Li J H, Liao L. Multi-resolution-based contour corner extraction algorithm for computer vision-based measurement[C]//Proceedings of the ASME 2018 International Design Engineering Technical Conferences and Computers and Information in Engineering Conference. Quebec City, Quebec, Canada: ASME, 2018: #V01AT02A025.[DOI:10.1115/DETC2018-85890]