节点文献

利用数字图像处理技术检测锥螺纹

Detection of Conical Thread with Digital Image Processing Technology

【作者】 宋志刚

【导师】 王龙山;

【作者基本信息】 吉林大学 , 机械制造及其自动化, 2004, 硕士

【摘要】 测量原理及系统结构基于数字图像处理技术的锥螺纹检测系统由照明光源、锥螺纹夹具、CCD摄像机、图像采集卡、计算机以及输出设备组成。具体结构如图1所示。工作原理为:利用CCD摄像机采集锥螺纹图像,通过图像采集卡将图像输入到计算机,然后对所采集到的图像进行数字处理,得到锥螺纹的轮廓图像。锥螺纹轮廓图像(以像素点数量表示)与实际尺寸(以毫米表示)之间具有一一对应的线性关系,即两者之间的测量比为常数K,由摄像物镜的放大比和CCD器件的放大比所决定。通过一定的算法计算出锥螺纹的几何参数,最后与标准尺寸相比较判断是否合格。  图像处理锥螺纹检测系统软件由VC++开发,对螺纹图像的数字处理的主要流程是图像预处理、边缘轮廓的提取和螺纹尺寸参数的计算等。如图2所示。2.1 图像采集及图像的预处理图像采集是通过调用DH—CG400图像采集卡驱动程序中的图像卡读取函数来完成的。该图像卡是基于PCI总线的彩色/黑白图像采集卡,可实时传送数字视频信号到显示存贮器或系统存储器,数据的传送过程是由图像卡控制的,无需CPU参与,瞬时传输速度可达132MB/S。图像预处理使用平滑处理的方法,其主要目的是减少噪声。一些常见的噪声有椒盐噪声、脉冲噪声、高斯噪声等。椒盐噪声是含有随机出现的黑白亮度值;脉冲噪声是只含有随机的白亮度值(正脉冲噪声)或黑亮度值;高斯噪声<WP=71>是含有亮度服从高斯或正态分布的噪声。图像的平滑处理的方法视其噪声本身的特性而定,一般情况下,在空间域采用领域平均来减少噪声;在频率域,由于噪声频谱通常多在高频段,因此采用各种形式的低通滤波方法来减少噪声。进行图像的平滑处理要用到模板(Template)操作,它是数字图像处理中常用的一种运算方式。模板操作实现了一种邻域运算(Neighborhood Operation),即某个像素点的结果不仅与本像素灰度有关,而且和其邻域点的值有关。模板运算在数学中的描述是卷积(或互相关)运算。平滑模板的思想是通过一点和周围几个点的运算(通常为平均运算)来去除突然变化的点,从而滤掉一定的噪声,但图像有一定的模糊,而减少图像模糊的代价是图像平滑处理的主要问题之一,这主要取决于噪声本身的特性。一般选择不同的模板来消除不同的噪声。常用的模板有:,等,其中前一个模板是3×3平均模板;后一个模板称为高斯模板,它是通过2维高斯函数得到的。均值滤波的主要问题是可能模糊图像中的尖锐不连续部分,但非线性滤波算法既可消除噪声又可保持图像的细节,中值滤波是最简单的非线性滤波器,其基本思想是用像素点邻域灰度值的中值来代替该像素点灰度值。由于它不是简单的取平均值,所以产生的模糊比较少。具体方法是将固定大小的模板在图中漫游,并将模板与图中某个像素位置重合,读取模板下各对应像素的灰度值,将灰度值从大到小排序,最后取该序列的中值来代替模板中心像素点的值。图4和图5分别为均值滤波后图像和高斯滤波后图像,图6为中值滤波后图像。从图中可以看出,中值滤波后的图像均匀,噪声消除,极好地保持了边界信息。该方法对模板的选择很关键,模板太大可能造成边界信息丢失,模板太小则去噪效果不理想。对于均值滤波与高斯滤波,从图中可以看出,图像边界模糊,尺寸测量效果不好。 图3 原始图像     图4 3×3域均值滤波后图像 图5 3×3高斯滤波后图像  图6 中值滤波后图像边缘轮廓提取锥螺纹尺寸测量的关键在于边缘轮廓的提取,提供所需的二维轮廓线。图像的边缘是图像的最基本特征,边缘点是图像中周围像素灰度有阶跃变化或屋<WP=72>顶变化的那些像素点,即灰度值导数较大或极大的地方。边缘检测局部算子法是考察图像的每个像素在某个邻域内灰度的变化,利用边缘邻近一阶或二阶导数变化规律,用边缘检测算子提取轮廓边缘。边缘检测算子检查每个像素的邻域并对灰度变化率进行量化,也包括方向的确定,然后使用基于方向导数掩模求卷积的方法提取边缘。此种方法应用于图像相对简单,被测物与背景的对比度较大的图像。但这类算法的算子计算量较大,效率偏低,且算法的的优劣决定着边缘轮廓提取精度的高低,不适于测量的要求。因此采用阈值法:利用图像的灰度直方图分布得到该图像灰度阈值,再根据阈值将图像二值化,形成锐化图像,然后逐行扫描,搜索图像边缘,最终获得边缘轮廓曲线。边缘算子检测法边缘是图像局部灰度变化最显著的部分,是灰度不连续的结果,这种不连续通常可利用求导数方便地检测到。边缘检测算子有多种,例如Sobel算子,Prewitt算子,Roberts算子,高斯-拉普拉斯算子等。(1)Sobel边缘算子.图7所示的两个卷积核形成了Sobel算子,图像中的每个点都用这两个核做卷积,一个核对垂直边缘响应最大,而另一个对水平边缘响应最大。两个卷积的最大值作为该点的输出值。运算结果是一幅边缘幅度图像,如图10所示。(2)Prewitt边缘算子.图8所示的两个卷积核形成了Prewitt边缘算子。和使用Sobel算子一样,图像中的每个点都用这两个核进行卷积,取最大值输出。Prewitt算子也产生一幅边缘幅度图像,如图11所示。图7 S

【Abstract】 1 Measure principle and system constructionsAn 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, <WP=77>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 <WP=78>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

  • 【网络出版投稿人】 吉林大学
  • 【网络出版年期】2004年 04期
  • 【分类号】TG85
  • 【被引频次】9
  • 【下载频次】711
节点文献中: 

本文链接的文献网络图示:

本文的引文网络