﻿ 基于机器视觉的轴承防尘盖检测算法
 计算机系统应用  2019, Vol. 28 Issue (1): 212-215 PDF

1. 杭州师范大学 杭州国际服务工程学院, 杭州 311121;
2. 易博工控表业(杭州)有限公司, 杭州 311305;
3. 浙江大学 航空航天学院, 杭州 310027

Detection Algorithm of Bearing Dustproof Cover Based on Machine Vision
YUAN Dong-Dong1, YING Jun2, XIE Li-Jun3, ZHOU Di-Bin1
1. Hangzhou Institute of Service Engineering, Hangzhou Normal University, Hangzhou 311121, China;
2. Yibo Industrial Control Gauge (Hangzhou) Co. Ltd., Hangzhou 311305, China;
3. School of Aeronautics and Astronautics, Zhejiang University, Hangzhou 310027, China
Foundation item: National Natural Science Foundation of China (11772301); Natural Science Foundation of Zhejiang Province (LY17F020016)
Abstract: In order to realize automatic detection of bearing dust cover in industrial field, the key technology of machine vision detection is studied, and a set of bearing dust cover detection is put forward based on machine vision. According to the characteristics of the bearing image, based on image filtering, a least square method is used to carry out circle fitting circle detection algorithm, the bearing detection and extraction of the ROI area are completed. The characteristics of the connected region are analyzed, then binary and morphological operations are carried out, and finally quantitatively processed and judged. The experimental results show that the method has good real-time performance and high detection accuracy, and can meet the industrial requirement of automatic detection of the bearing dust cover.
Key words: machine vision     image processing     binarization     circle detection

1 算法框架

 图 1 检测算法流程

1.1 图像采集和预处理

 图 2 滤波效果对比

1.2 轴承防尘盖区域检测和提取

 图 3 防尘盖区域提取

$D_i^2 = {({X_i} - A)^2} + {({Y_i} - B)^2}$ , 点( ${X_i}$ , ${Y_i}$ )到圆边缘的距离的平方与和半径平方的差为:

 $\begin{array}{l}{T_i} = D_i^2 - {R^2} = {({X_i} - A)^2} + {({Y_i} - B)^2} - {R^2}\\ \;\;\;\;\;= X_i^2 + Y_i^2 + a{X_i} + b{Y_i} + c\end{array}$ (1)

 $\begin{array}{l}s(a,b,c) = \displaystyle\sum {T_i^2} \\ \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;= \displaystyle\sum {[X_i^2 + Y_i^2 + a{X_i} + b{Y_i} + c} {]^2}\end{array}$ (2)

 $\begin{array}{l}\displaystyle\frac{{\partial s(a,b,c)}}{{\partial a}} = \displaystyle\sum {2(X_i^2 + Y_i^2 + a{X_i} + } b{Y_i} + c){X_i} = 0\end{array}$ (3)
 $\begin{array}{l}\displaystyle\frac{{\partial s(a,b,c)}}{{\partial b}} =\displaystyle\sum {2(X_i^2 + Y_i^2 + a{X_i} + } b{Y_i} + c){Y_i} = 0\end{array}$ (4)
 $\begin{array}{l}\displaystyle\frac{{\partial s(a,b,c)}}{{\partial c}} = \displaystyle\sum {2(X_i^2 + Y_i^2 + a{X_i} + } b{Y_i} + c) = 0\end{array}$ (5)

 $A = - \frac{1}{2}a,B = - \frac{1}{2}b,R = 1/2\sqrt {{a^2}{\rm{ + }}{b^2} - 4c}$
1.3 区域二值化

 $g(x, y) = \left\{ {\begin{array}{*{20}{c}} {1,\;\;f(x, y) > t} \\ {0,\;\;f(x, y) \leqslant t} \end{array}} \right.$ (6)

 图 4 阀值分割算法对比

 ${m_1}(k) = \frac{1}{{{P_1}(k)}}\sum\limits_{i = 0}^k {i{p_i}}$ (7)

 ${m_2}(k) = \frac{1}{{{P_2}(k)}}\sum\limits_{i = k + 1}^{L - 1} {i{p_i}}$ (8)

 ${m_G} = \sum\limits_{i = 0}^{L - 1} {i{p_i}}$ (9)

$\sigma _B^2$ 类间方差类间方差定义为:

 $\sigma _B^2 = {P_1}{({m_1} - {m_G})^2} + {P_2}{({m_2} - {m_G})^2}$ (10)

 $\sigma _B^2 = \frac{{{{({m_G}{P_1} - m)}^2}}}{{{P_1}(1 - {P_1})}}$ (11)

${k^ * }$ 是最佳阀值:

 $\sigma _B^2({k^*}) = \mathop {\max}\limits_{0 \leqslant {{k}} \leqslant L - 1} \sigma _B^2(k)$ (12)

$0 < {P_1}(k) < 1$ 条件下选取 $\sigma _B^2(k)$ 最大的 $k$ 值.

1.4 形态学操作

 图 5 开运算处理

1.5 特征提取与分析

1.6 量化与判断

2 结果分析

3 结语

 [1] 袁清珂, 张振亚, 吴晖辉, 等. 基于机器视觉系统的自动检测系统设计与开发. 组合机床与自动化加工技术, 2014(11): 119-121. [2] 陈跃飞, 王恒迪, 邓四二. 机器视觉检测技术中轴承的定位算法. 轴承, 2010(4): 54-56. DOI:10.3969/j.issn.1000-3762.2010.04.016 [3] 王昌, 高晶晶. 基于机器视觉的轴承生产中的表面质量在线检测与研究. 机床与液压, 2013, 41(19): 53-55. DOI:10.3969/j.issn.1001-3881.2013.19.014 [4] 陈龙, 侯普华, 王进, 等. 轴承表面缺陷类型识别算法. 计算机应用研究, 2015, 32(5): 1549-1553. DOI:10.3969/j.issn.1001-3695.2015.05.068 [5] 康牧. 图像处理中几个关键算法的研究[博士学位论文]. 西安: 西安电子科技大学, 2009. [6] 刘胜利. 基于工业视觉的轴承尺寸在线检测技术[硕士学位论文]. 西安: 西安工业大学, 2014. [7] 陈文达, 白瑞林, 吉峰, 等. 基于机器视觉的轴承防尘盖表面缺陷检测. 计算机工程与应用, 2014, 50(6): 250-254. DOI:10.3778/j.issn.1002-8331.1204-0589 [8] 霍建亮, 曾翎, 王德胜, 等. 基于最小二乘法改进的随机圆检测算法. 光电工程, 2011, 38(5): 145-150. DOI:10.3969/j.issn.1003-501X.2011.05.026 [9] 徐煜明, 韩雁. FPCB基准孔精确定位技术研究. 计算机工程与应用, 2009, 45(29): 233-236. DOI:10.3778/j.issn.1002-8331.2009.29.070 [10] 陈宁宁. 几种图像阈值分割算法的实现与比较. 电脑知识与技术, 2011, 7(13): 3109-3111. DOI:10.3969/j.issn.1009-3044.2011.13.052 [11] 骆腾斌, 陈硕, 赵紫阳, 等. 基于机器视觉算法的轴承套端面缺陷检测研究. 机电工程, 2018, 35(2): 148-152. DOI:10.3969/j.issn.1001-4551.2018.02.007