利用数字图像处理技术检测锥螺纹
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
测量原理及系统结构
    基于数字图像处理技术的锥螺纹检测系统由照明光源、锥螺纹夹具、CCD摄像机、图像采集卡、计算机以及输出设备组成。具体结构如图1所示。工作原理为:利用CCD摄像机采集锥螺纹图像,通过图像采集卡将图像输入到计算机,然后对所采集到的图像进行数字处理,得到锥螺纹的轮廓图像。锥螺纹轮廓图像(以像素点数量表示)与实际尺寸(以毫米表示)之间具有一一对应的线性关系,即两者之间的测量比为常数K,由摄像物镜的放大比和CCD器件的放大比所决定。通过一定的算法计算出锥螺纹的几何参数,最后与标准尺寸相比较判断是否合格。
      
    图像处理
    锥螺纹检测系统软件由VC++开发,对螺纹图像的数字处理的主要流程是图像预处理、边缘轮廓的提取和螺纹尺寸参数的计算等。如图2所示。
    2.1 图像采集及图像的预处理
    图像采集是通过调用DH—CG400图像采集卡驱动程序中的图像卡读取函数来完成的。该图像卡是基于PCI总线的彩色/黑白图像采集卡,可实时传送数字视频信号到显示存贮器或系统存储器,数据的传送过程是由图像卡控制的,无需CPU参与,瞬时传输速度可达132MB/S。
    图像预处理使用平滑处理的方法,其主要目的是减少噪声。一些常见的噪声有椒盐噪声、脉冲噪声、高斯噪声等。椒盐噪声是含有随机出现的黑白亮度值;脉冲噪声是只含有随机的白亮度值(正脉冲噪声)或黑亮度值;高斯噪声
    
    
    是含有亮度服从高斯或正态分布的噪声。
    图像的平滑处理的方法视其噪声本身的特性而定,一般情况下,在空间域采用领域平均来减少噪声;在频率域,由于噪声频谱通常多在高频段,因此采用各种形式的低通滤波方法来减少噪声。
    进行图像的平滑处理要用到模板(Template)操作,它是数字图像处理中常用的一种运算方式。模板操作实现了一种邻域运算(Neighborhood Operation),即某个像素点的结果不仅与本像素灰度有关,而且和其邻域点的值有关。模板运算在数学中的描述是卷积(或互相关)运算。平滑模板的思想是通过一点和周围几个点的运算(通常为平均运算)来去除突然变化的点,从而滤掉一定的噪声,但图像有一定的模糊,而减少图像模糊的代价是图像平滑处理的主要问题之一,这主要取决于噪声本身的特性。一般选择不同的模板来消除不同的噪声。
    常用的模板有:,等,其中前一个模板是3×3平均模板;后一个模板称为高斯模板,它是通过2维高斯函数得到的。
    均值滤波的主要问题是可能模糊图像中的尖锐不连续部分,但非线性滤波算法既可消除噪声又可保持图像的细节,中值滤波是最简单的非线性滤波器,其基本思想是用像素点邻域灰度值的中值来代替该像素点灰度值。由于它不是简单的取平均值,所以产生的模糊比较少。具体方法是将固定大小的模板在图中漫游,并将模板与图中某个像素位置重合,读取模板下各对应像素的灰度值,将灰度值从大到小排序,最后取该序列的中值来代替模板中心像素点的值。图4和图5分别为均值滤波后图像和高斯滤波后图像,图6为中值滤波后图像。从图中可以看出,中值滤波后的图像均匀,噪声消除,极好地保持了边界信息。该方法对模板的选择很关键,模板太大可能造成边界信息丢失,模板太小则去噪效果不理想。对于均值滤波与高斯滤波,从图中可以看出,图像边界模糊,尺寸测量效果不好。
    
    
     图3 原始图像     图4 3×3域均值滤波后图像 图5 3×3高斯滤波后图像  图6 中值滤波后图像
    边缘轮廓提取
    锥螺纹尺寸测量的关键在于边缘轮廓的提取,提供所需的二维轮廓线。图像的边缘是图像的最基本特征,边缘点是图像中周围像素灰度有阶跃变化或屋
    
    
    顶变化的那些像素点,即灰度值导数较大或极大的地方。边缘检测局部算子法是考察图像的每个像素在某个邻域内灰度的变化,利用边缘邻近一阶或二阶导数变化规律,用边缘检测算子提取轮廓边缘。边缘检测算子检查每个像素的邻域并对灰度变化率进行量化,也包括方向的确定,然后使用基于方向导数掩模求卷积的方法提取边缘。此种方法应用于图像相对简单,被测物与背景的对比度较大的图像。但这类算法的算子计算量较大,效率偏低,且算法的的优劣决定着边缘轮廓提取精度的高低,不适于测量的要求。因此采用阈值法:利用图像的灰度直方图分布得到该图像灰度阈值,再根据阈值将图像二值化,形成锐化图像,然后逐行扫描,搜索图像边缘,最终获得边缘轮廓曲线。
    边缘算子检测法
    边缘是图像局部灰度变化最显著的部分,是灰度不连续的结果,这种不连续通常可利用求导数方便地检测到。边缘检测算子有多种,例如Sobel算子,Prewitt算子,Roberts算子,高斯-拉普拉斯算子等。
    (1)Sobel边缘算子.图7所示的两个卷积核形成了Sobel算子,图像中的每个点都用这两个核做卷积,一个核对垂直边缘响应最大,而另一个对水平边缘响应最大。两个卷积的最大值作为该点的输出值。运算结果是一幅边缘幅度图像,如图10所示。
    (2)Prewitt边缘算子.图8所示的两个卷积核形成了Prewitt边缘算子。和使用Sobel算子一样,图像中的每个点都用这两个核进行卷积,取最大值输出。Prewitt算子也产生一幅边缘幅度图像,如图11所示。
    
    图7 S
1 Measure principle and system constructions
    An detecting system with digital image processing technology used for conical thread consist of the light source , clamps ,CCD camera ,PCI card ,computer and output equipments .Figure 1 show the system concrete construction . Work principle is: first make use of CCD camera to take a conical thread picture, then transport the picture into the computer by PCI card, finally get the contour picture by digital image processing technology. The contour in picture is proportional to the actual one, and the ratio is a constant K determined by CCD camera magnified ratio. Calculating the geometry parameters and comparing with the actual size.
      
    2 Digital image processing
    The detecting software is developed by VC++6.0 , Fig 2 show the main process, it consist of the image pre-processing, getting the contour and calculating the geometry parameters.
    2.1 Collecting and pre-processing image
     The picture is transferred into the computer by DH-CG400 PCI card,
    
    
    its rate could reach to 132MB/S and the support with CPU is not needed .
     The method of image pre-processing is smoothing image, and the purpose is to reduce the interferers. The ordinary interferers include spiced interferer, impulse interfere, and gauss interferer etc. If there are random black & white points in picture, it is the spiced interferer. If there are random black or white points in picture, it is the impulse interferer. The character of gauss interferer is that the distributing of interfere points in the picture is normal.
     The method of smoothing image is consistent to the character of the interferer. In the space area averaging the value of the neighborhood points might reduce the interferer, and in the frequency area the method of reducing interferer is filtering the wave with a low frequency value.
     Smoothing image usually make use of the template, the template operation is a kind of neighborhood operation, its work principal is that wiping off the variety point by operating the value of neighborhood point. But smoothing image can make itself illegibility, so the different template is used to reduce the relevant interferer.
    The templates such as , are common used, the first is 3×3 mean template, and the last is gauss template.
    Fig 4 is the 3×3 mean filter result, fig 5 is 3×3 gauss filter result, and fig 6 is the mean filter result. We can make the conclusion that the mean filter result is better than other results, because the image is clearer and the contour line is well preserved.
    
     Fig.3 Original image  Fig.4 3×3 mean filter result  Fig.5 3×3 Gauss filter result  Fig.6 Mean filter result
     Edge detection
    Unless getting the contour line, you can not detect the geometry parameters of conical thread. Edges are areas in an image where rapid changes occur in the intensity function or in spatial derivatives of this intensity function. The goal of edge detection is to recover information about shapes and reflectance or transmittance in an image.
    The methods using edge detection operator to get the contour is
    
    
    applied to the simple image in which the measured object is obviously contrasted to the background. But the calculation quantity of operator is very great and the efficiency is lower, so this method is not suit to the measured request. The work principal of the threshold method is : first get the threshold in the histogram, then convert the image to the binary one, at last search the object edge and get the contour line.
    Edge detection operator
    There are many kind of edge detection operator, such as Sobel operator, Prewitt operator, Roberts operator, and Gauss-Laplace operator etc.
    (1)Sobel operator. Fig 7 show that the Sobel operator consist of two templates, the one respond for vertical edge, and the other respond for horizontal edge. The maximal value of two results is put to the output value. Fig 10 is the Sobel edge result.
    (2)Prewitt operator. Fig 8 show that the Prewitt operator include two templates too. Its w
引文
徐孝恩 编著.螺纹测量.北京:机械工业出版社,1986
    何斌 马天予等编著.Visual C++数字图像处理.北京:人民邮电出版社,2001
    李兰友 编著.Visual C++.NET图形图像编程.北京:电子工业出版社,2002
    向世明 编著.Visual C++数字图像与图形处理.北京:电子工业出版社,2002
    宋志刚 王龙山 陈向伟.利用数字图像处理技术检测锥螺纹.吉林大学学报(工学版).2004,(4):248~251
    陈向伟 王龙山 宋志刚.基于计算机视觉的电极锥螺纹自动检测.光学 精密工程.2003,(8):141~144
    梁学军 洪迈生 贾文焕.轿车用螺纹紧固件的自动检测技术.传动技术.1999,(2):12~20
    梁学军 洪迈生.基于随机Hough变换的螺纹快速测量.振动、测试与诊断.1999,19(3):214~218
    洪迈生 梁学军 魏元雷.基于随机Hough变换的螺纹可旋入性判别法.光学 精密工程.2002,10(1):14~18
    10、李国正 裴仁清 袁庆丰等.基于机器视觉的螺纹检验仪软件的研制.上海大学学报(自然科学版).2000,6(4):307~310
    11、梁学军 洪迈生 贾文焕.螺纹紧固件的自动检测技术.计量技术.2000,(2):14~17
    12、尚玉华 柴军.普通螺纹中径及其检测方法探讨.山西机械. 2000,增刊:41~42
    13、王纵吉.螺纹中径的测量方法.工业计量.2001,(1):40~41
    14、于永芳 齐博文.外圆锥螺纹参数的测量.计量技术.2001,(7):20~21
    15、曲贵龙 唐卫宏.锥体螺纹中径的组合测量法.检测.2000,38(430):12~13
    16、杨名宇 罗云峰.普通螺纹光学投影测量自动化.计量技术.1997,(4):8~9
    17、赵勇 李鹏生 浦昭邦.航空航天用MJ内螺纹及其非接触检测方法.计量技术.1999,(11):3~4
    18、孙学珠 付维乔 刘庆等.高精度CCD尺寸自动检测系统的光学系统设计.光学技术.1995,9(5):4~6,23
    19、鲁昌华 徐胜海 刘春.数字图像处理技术在 PCB板检测中的应用.仪器仪表学 报.2001,22(4),增刊:426~429
    20、陈岳林.用CCD在线检测电线电缆直径.计量与测试技术.1998,(3):25~28
    
    21、缪秀娥 肖沙里 钟先信等.异形回转零件的一种图像测量研究.光学 精密工程.1997,5(4):99~105
    22、吴晓波 钟先信 刘厚权等.高精度图像测量系统.光学 精密工程.1995,3(1):28~33
    23、尹定平 朱冰莲 田学隆.WINDOWS环境下图像处理软件的设计.重庆邮电学院学报.2001,6(增刊):37~39,47
    24、曹文达 环遵祥 季凯帆等.利用WinView软件进行图像处理.云南天文台台刊.1997,(2):75~80
    25、王延杰 宋建中.一种实时自适应图像二值化方法.光学 精密工程.1994,2(5):17~21
    26、王俊杰 黄心汉.一种对图像进行快速二值化处理的方法.电子技术应用.1998,(10):16~17
    27、陈岱民 张 建 王智宏 孙坤.微小零件图像二值化处理的研究.长春大学学报.1999,9(3):1~3
    28、李罗生 白立芬 李庆祥等.微小尺寸测量中的图像处理技术.清华大学学报(自然科学版).2001,41(8):45~48
    29、王智宏 何文静 陈岱民 孙坤.微小尺寸检测图像处理方法的进一步研究.仪器仪表学报.2001,22(3),增刊:235~236
    30、秦志远 张占睦 莫华.计算机图像处理可视化软件设计与实现.测绘学院学报.2001,18(1):33~35,43
    31、李为民 黄 瑜 梁济仁.Windows环境下的图像处理——图像旋转.计算机应用研究.1997,(2):80~81,85
    32、田杰 吕建新 周晓娟等.位图的图像处理技术.现代电子技术.2001,(9):28~31
    33、李小文.利用拉普拉斯—高斯模板进行边缘检测.华南师范大学学报(自然科学版).1997,(2):53~55
    34、吴士达 杨立新.图像边缘检测的模糊数学方法.成都气象学院学报.1995,(3):220~225
    35、万志龙.一维边缘检测算子的递归算法.测绘学报.1995,24(2):45~52
    36、苑玮琦 王建军 张宏勋.一种基于梯度极值的边缘检测算法.信息与控制.1997,26(2):117~120
    37、赵巨波 孙华燕 杜巍.一种图像边缘特征提取算法.光学 精密工程.2000,8(4):325~327
    38、竺子民.两种边缘检测方法的比较.华中理工大学学报.1997,25(4):29~32
    39、向际鹰 向容海.用低分辨率CCD进行高精度边缘检测的一种新方法——模糊成象法.仪表技术与传感器.1997,(7):37~40
    40、赵英 续斌.面阵CCD亚像元边缘检测的数值计算.计量技术.1999,(11):
    
    
    5~6
    41、魏立梅 张永瑞 谢维信等.图像处理中边缘漏检的自动补偿.西安电子科技大学学报.1997,24(4):563~566
    42、史册 徐胜荣 荆仁杰.实时图像处理中一种快速的直线检测算法.浙江大学学报(工学版).1999,33(5):482~486
    43、徐晓刚 于金辉 马利庄.复杂物体轮廓提取.中国图象图形学报.2001,6A(5):455~459
    44、林晓峰 石少莉.CCD摄像法在工件尺寸测量中的应用.光学仪器.2002,24(3):11~13
    45、张少军 艾矫健 李忠富等.利用数字图像处理技术测量几何尺寸.北京科技大学学报.2002,24(3):284~287
    46、洪迈生 苏恒 魏元雷等.一种基于虚拟基准的虚拟环规.光学技术.2002,28(3):231~233
    47、ALBERTOS.AGUADO,EUGENIA MONTIEL,MARKS. NIXON.Bias Error Analysis of the Generalised Hough Transform.Journal of Mathematical Imaging and Vision 12, 25–42 (2000)
    48、AGNèS DESOLNEUX,LIONEL MOISAN AND JEAN-MICHEL MOREL.Edge Detection by Helmholtz Principle.Journal of Mathematical Imaging and Vision 14: 271-284, 2001
      49、JUAN FRANCISCO GóMEZ-LOPERA.An Analysis of Edge Detection by Using the Jensen-Shannon Divergence.Journal of Mathematical Imaging and Vision 13, 35–56, 2000
      50、GUANG DENG,JEAN-CHARLES PINOLI.Differentiation-Based Edge Detection Using the Logarithmic Image Processing Model.Journal of Mathematical Imaging and Vision 8, 161–180 (1998)
      51、Prabir Bhattacharya,Azriel Rosenfeld,Isaac Weiss.Point-to-line mappings as Hough transforms.Pattern Recognition Letters 23 (2002) 1705–1710
    52、Mark Fiala,Anup Basu.Hough transform for feature detection in panoramic images.Pattern Recognition Letters 23 (2002) 1863–1874
    53、Daniel Walsha,Adrian E.Rafteryb.Accurate and efficient curve detection in images:the importance sampling Hough transform.Pattern Recognition 35 (2002) 1421–1431
     54、Dong Hoon?Lim,Seung Ju?Jang.Comparison of two-sample tests for edge detection in noisy images.Journal of the Royal Statistical Society: Series D(The Statistician) Volume 51?Issue 1?Page 21-March 2002
    55、Fei Shen,Han Wang. Corner detection based on modified Hough transform.Pattern Recognition Letters 23 (2002) 1039–1049
    56、Adel A. Sewisy,Franz Leberl.Detection ellipses by finding lines of symmetry in the
    
    
    images via an hough transform applied to straight lines.Image and Vision Computing 19 (2001) 857 - 866
    57、Eugenia Montiel,Alberto S. Aguado,Mark S. Nixon.Improving the Hough Transform gathering process for the affine transmations.Pattern Recognition Letters 22 (2001) 959 - 969

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700