CN102680494A - Real-time detecting method of metal arc plane flaw based on machine vision - Google Patents

Real-time detecting method of metal arc plane flaw based on machine vision Download PDF

Info

Publication number
CN102680494A
CN102680494A CN2012101637107A CN201210163710A CN102680494A CN 102680494 A CN102680494 A CN 102680494A CN 2012101637107 A CN2012101637107 A CN 2012101637107A CN 201210163710 A CN201210163710 A CN 201210163710A CN 102680494 A CN102680494 A CN 102680494A
Authority
CN
China
Prior art keywords
image
sample image
sigma
histogram
max
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012101637107A
Other languages
Chinese (zh)
Other versions
CN102680494B (en
Inventor
白瑞林
温振市
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Blue Creative Intelligent Polytron Technologies Inc
Original Assignee
Jiangnan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangnan University filed Critical Jiangnan University
Priority to CN201210163710.7A priority Critical patent/CN102680494B/en
Publication of CN102680494A publication Critical patent/CN102680494A/en
Application granted granted Critical
Publication of CN102680494B publication Critical patent/CN102680494B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Length Measuring Devices By Optical Means (AREA)
  • Image Processing (AREA)

Abstract

本发明涉及一种基于机器视觉的抛光金属弧状面瑕疵实时检测方法,其包括如下步骤:步骤1、离线情况下,获取N张第一样本图像及M张第二样本图像,并进行数据融合;步骤2、建立融合后图像直方图,得到图像背景与对应的灰度值间的线性关系式;步骤3、计算所选第一样本图像、第二样本图像的反射分量;步骤4、建立合格工件反射分量标准差与对应的灰度值间的对应关系式;步骤5、在线实时获取抛光金属弧状面工件的检测图像,计算得到第一标准差及第二标准差;步骤6、进行阈值分割,得到对应的二值图像;步骤7、将二值图像内连通区域面积与预设判断阈值比较,判断抛光金属弧状面的瑕疵。本发明操作方便,检测精度高,检测适应性好,稳定可靠。

Figure 201210163710

The present invention relates to a machine vision-based method for real-time detection of flaws on polished metal arcuate surfaces, which includes the following steps: Step 1. In an offline situation, acquire N first sample images and M second sample images, and perform data fusion Step 2, set up the image histogram after fusion, obtain the linear relationship between the image background and the corresponding gray value; Step 3, calculate the reflection component of the selected first sample image and the second sample image; Step 4, establish The corresponding relationship between the standard deviation of the reflection component of the qualified workpiece and the corresponding gray value; step 5, obtain the detection image of the polished metal arc-shaped workpiece online in real time, and calculate the first standard deviation and the second standard deviation; step 6, perform the threshold Segment to obtain the corresponding binary image; step 7, compare the area of the connected region in the binary image with the preset judgment threshold, and judge the flaw of the polished metal arc surface. The invention has the advantages of convenient operation, high detection precision, good detection adaptability, stability and reliability.

Figure 201210163710

Description

基于机器视觉的抛光金属弧状面瑕疵实时检测方法Real-time detection method of polished metal arc-shaped surface defects based on machine vision

技术领域 technical field

本发明涉及一种检测方法,尤其是一种基于机器视觉的抛光金属弧状面瑕疵实时检测方法,属于抛光金属弧状面检测的技术领域。The invention relates to a detection method, in particular to a machine vision-based real-time detection method for flaws on polished metal arcuate surfaces, belonging to the technical field of polished metal arcuate surface detection.

背景技术 Background technique

在工业生产中,随着工业技术水平的不断提高,对产品的质量要求也随之提高,传统对工件质量的监测主要靠人工目测。由于受检查人员的主观因素的影响,很容易出现误检和漏检等情况,并且人工目测还有效率低、准确率低和规范化程度不够,检测结果与检查人员的个人能力及精神状态密切相关,稳定性和可靠性比较差,另外,也不能将检测数据分类实时送入计算机进行自动质量管理。为了解决人工目测工作量大、效率低、漏检率高的难题,企业急需引进一种自动检测技术,以替代人工操作,在降低人力成本的同时又能实现对产品质量的严格控制。所以,引入了机器视觉在工件质量监测上的应用。通过机器视觉代替传统的人眼来对产品质量进行监测,提高了生产效率和产品的质量。In industrial production, with the continuous improvement of industrial technology, the quality requirements of products also increase. The traditional monitoring of workpiece quality mainly depends on manual visual inspection. Due to the influence of the subjective factors of the inspectors, it is easy to have false detections and missed detections, and manual visual inspection has low efficiency, low accuracy and insufficient standardization. The detection results are closely related to the personal ability and mental state of the inspectors. , the stability and reliability are relatively poor. In addition, the detection data classification cannot be sent to the computer in real time for automatic quality management. In order to solve the problems of heavy workload, low efficiency and high missed detection rate of manual visual inspection, enterprises urgently need to introduce an automatic detection technology to replace manual operation, so as to achieve strict control of product quality while reducing labor costs. Therefore, the application of machine vision in workpiece quality monitoring is introduced. Product quality is monitored by machine vision instead of traditional human eyes, which improves production efficiency and product quality.

目前,国内外也有许多学者在研究抛光弧状金属表面的瑕疵检测,比如轴承外表面这类圆柱形的金属工件。此类工件的检测还存在以下几个问题:(1)、由于抛光弧状工件表面的反射率高,相机接受到的反射光的反射角不同,所以很难得到光照均匀,幅面宽的图像;(2)采集到的图像灰度分布不均匀,有效区域过窄。如采用同轴光作为光源时,有效区域过窄,经实验分析检测一个轴承需至少60张图像。为解决光照不均的问题,可以采用提取背景图像,再根据背景图像对图像进行增强,得到灰度均匀的图像。但当工件有大缺陷的时候,背景图像的提取将会出现误差。At present, many scholars at home and abroad are also studying the flaw detection of polished arc-shaped metal surfaces, such as cylindrical metal workpieces such as the outer surface of bearings. There are still several problems in the detection of such workpieces: (1) Due to the high reflectivity of the surface of the polished arc-shaped workpiece, the reflection angle of the reflected light received by the camera is different, so it is difficult to obtain an image with uniform illumination and a wide format; ( 2) The gray distribution of the collected image is uneven, and the effective area is too narrow. If coaxial light is used as the light source, the effective area is too narrow, and at least 60 images are required to detect a bearing through experimental analysis. In order to solve the problem of uneven illumination, the background image can be extracted, and then the image can be enhanced according to the background image to obtain an image with uniform gray scale. But when the workpiece has a large defect, the extraction of the background image will have errors.

发明内容 Contents of the invention

本发明的目的是克服现有技术中存在的不足,提供一种基于机器视觉的抛光金属弧状面瑕疵实时检测方法,其操作方便,检测精度高,检测适应性好,稳定可靠。The purpose of the present invention is to overcome the deficiencies in the prior art and provide a machine vision-based real-time detection method for polished metal arc-shaped surface flaws, which is easy to operate, high in detection accuracy, good in detection adaptability, stable and reliable.

按照本发明提供的技术方案,一种基于机器视觉的抛光金属弧状面瑕疵实时检测方法,所述抛光金属弧状面瑕疵实时检测方法包括如下步骤:According to the technical solution provided by the present invention, a machine vision-based method for real-time detection of flaws on polished metal arcuate surfaces, the method for real-time detection of flaws on polished metal arcuate surfaces includes the following steps:

步骤1、离线情况下,获取N张合格工件在正常工作光照下的第一样本图像及M张合格工件在低光照下的第二样本图像,对N张第一样本图像分别进行中值滤波获得图像序列In,n=1,2,…,N,对M张第二样本图像分别进行中值滤波获得图像序列Im,m=1,2,…,M,对图像序列In、图像序列Im分别进行数据融合后得到图像g(x,y)、h(x,y);Step 1. Offline, obtain the first sample images of N qualified workpieces under normal working light and the second sample images of M qualified workpieces under low light, and perform median Filter to obtain image sequence I n , n=1,2,...,N, respectively perform median filtering on M second sample images to obtain image sequence I m ,m=1,2,...,M, for image sequence I n and the image sequence I m respectively carry out data fusion to obtain images g(x, y), h(x, y);

步骤2、统计融合后图像g(x,y)、h(x,y)内相应灰度值及灰度值对应的像素个数,分别得到图像g(x,y)、h(x,y)的直方图,根据直方图相应的较大波峰值对应的灰度值建立图像背景I(x,y)与直方图内较大波峰值对应的灰度值间的线性关系式为Step 2. Count the corresponding gray value and the number of pixels corresponding to the gray value in the fused image g(x, y), h(x, y), and obtain the image g(x, y), h(x, y) respectively ) histogram, according to the gray value corresponding to the corresponding larger wave peak in the histogram, the linear relationship between the image background I(x, y) and the gray value corresponding to the larger wave peak in the histogram is established as

I(x,y)=a(x,y)*(Zmax-Zh)+h(x,y)I(x,y)=a(x,y)*(Z max -Z h )+h(x,y)

其中,Zmax表示直方图内较大波峰值对应的灰度值,a(x,y)为斜率矩阵;Among them, Z max represents the gray value corresponding to the larger wave peak in the histogram, and a(x, y) is the slope matrix;

步骤3、从上述第一样本图像、第二样本图像中均任选一张样本图像,并建立所选第一样本图像、第二样本图像的直方图,得到所选第一样本图像、第二样本图像直方图内的较大波峰值对应的灰度值,根据所述灰度值及步骤2的线性关系式,分别得到所选第一样本图像、第二样本图像的反射分量;Step 3. Select a sample image from the above-mentioned first sample image and the second sample image, and establish the histogram of the selected first sample image and the second sample image to obtain the selected first sample image , the gray value corresponding to the larger wave peak value in the histogram of the second sample image, according to the gray value and the linear relational expression in step 2, respectively obtain the reflection components of the selected first sample image and the second sample image;

步骤4、根据步骤3得到所选第一样本图像、第二样本图像的反射分量,建立合格工件反射分量标准差与直方图内较大波峰值对应的灰度值间的对应关系式为Step 4. Obtain the reflection components of the selected first sample image and the second sample image according to step 3, and establish the corresponding relationship between the standard deviation of the reflection component of the qualified workpiece and the gray value corresponding to the larger wave peak in the histogram:

σσ (( ZZ maxmax )) ≈≈ σσ nno -- σσ 00 ZZ maxmax __ nno -- ZZ maxmax __ 00 ** (( ZZ maxmax -- ZZ maxmax __ 00 )) ++ σσ 00

其中,σ(Zmax)表示合格工件的反射分量标准差,Zmax_n表示所选第一样本图像直方图中最大波峰值对应的灰度值,Zmax_0表示所选第二样本图像直方图中最大波峰值对应的灰度值,σn为所选第一样本图像的标准差,σ0为所选第二样本图像的标准差;Among them, σ(Z max ) represents the standard deviation of the reflection component of a qualified workpiece, Z max_n represents the gray value corresponding to the maximum peak value in the histogram of the selected first sample image, and Z max_0 represents the gray value in the histogram of the selected second sample image The gray value corresponding to the maximum peak value, σ n is the standard deviation of the selected first sample image, and σ 0 is the standard deviation of the selected second sample image;

步骤5、在线实时获取抛光金属弧状面工件在工作光照下的检测图像,对所述检测图像进行中值滤波,建立检测图像的直方图;根据直方图内较大波峰值对应的灰度值及上述步骤得到检测图像的反射分量;对获得检测图像的反射分量进行高斯滤波,得到第二反射分量,并计算第二反射分量的第二标准差,且根据步骤4计算得到检测图像在对应灰度水平的合格工件图像的第一标准差;Step 5. Obtain the detection image of the polished metal arc-shaped workpiece in real time online under the working light, perform median filtering on the detection image, and establish a histogram of the detection image; according to the gray value corresponding to the larger wave peak in the histogram and the above The first step is to obtain the reflection component of the detection image; Gaussian filtering is performed on the reflection component of the detection image to obtain the second reflection component, and the second standard deviation of the second reflection component is calculated, and the detection image is calculated according to step 4 at the corresponding gray level The first standard deviation of the qualified workpiece image;

步骤6、比较第一标准差及第二标准差,以选取分割阈值,通过分割阈值对第二反射分量进行阈值分割,得到对应的二值图像;Step 6. Comparing the first standard deviation and the second standard deviation to select a segmentation threshold, and performing threshold segmentation on the second reflection component through the segmentation threshold to obtain a corresponding binary image;

步骤7、扫描上述二值图像,并对二值图像内不同连通区域进行标记,统计连通区域面积,将连通区域面积与预设判断阈值比较,判断抛光金属弧状面的瑕疵。Step 7. Scanning the above binary image, marking different connected areas in the binary image, counting the area of the connected area, comparing the area of the connected area with a preset judgment threshold, and judging the flaws of the polished metal arc surface.

所述步骤1包括如下步骤:Described step 1 comprises the following steps:

步骤1.1、在离线情况下,采集N张合格工件在工作光照下的第一样本图像,然后降低至所需光照强度,采集M张合格工件在低光照强度下的第二样本图像;Step 1.1. In the offline situation, collect the first sample images of N qualified workpieces under working light, and then reduce to the required light intensity, and collect the second sample images of M qualified workpieces under low light intensity;

步骤1.2、对第一样本图像、第二样本图像进行中值滤波分别得到图像序列In,Im;其中,n=1,2,…,N,m=1,2,…M;Step 1.2, performing median filtering on the first sample image and the second sample image to obtain image sequences I n , I m respectively; where, n=1, 2,..., N, m=1, 2,...M;

步骤1.3、根据

Figure BDA00001676593300022
将图像序列In进行数据融合,其中,(x,y)表示图像序列内的像素位置;Step 1.3, according to
Figure BDA00001676593300022
Carry out data fusion with the image sequence I n , wherein, (x, y) represents the pixel position in the image sequence;

步骤1.4、根据

Figure BDA00001676593300023
将图像序列Im进行数据融合。Step 1.4, according to
Figure BDA00001676593300023
The image sequence I m is subjected to data fusion.

所述步骤2包括如下步骤:Described step 2 comprises the following steps:

步骤2.1、图像灰度取0~255,统计图像g(x,y)对应灰度值的像素个数,然后除以图像g(x,y)的总像素个数,得到图像g(x,y)的直方图p(z),并求出达到较大波峰值的灰度值ZgStep 2.1, the grayscale of the image is 0~255, the number of pixels corresponding to the grayscale value of the image g(x,y) is counted, and then divided by the total number of pixels of the image g(x,y) to obtain the image g(x,y) y) histogram p(z), and calculate the gray value Z g that reaches the larger peak value;

步骤2.2、根据步骤2.1,得到图像h(x,y)的直方图q(z),并求出达到较大峰值的灰度值ZhStep 2.2, according to step 2.1, obtain the histogram q(z) of the image h(x, y), and calculate the gray value Z h that reaches a larger peak value;

步骤2.3、建立图像背景I(x,y)与直方图内较大波峰值对应灰度值间的线性斜率矩阵,得到Step 2.3, establish the linear slope matrix between the image background I (x, y) and the corresponding gray value of the larger wave peak in the histogram, and obtain

aa (( xx ,, ythe y )) == gg (( xx ,, ythe y )) -- hh (( xx ,, ythe y )) ZZ gg -- ZZ hh ;;

步骤2.4、根据步骤2.3得到图像背景I(x,y)与直方图内较大波峰值间的线性关系,为Step 2.4, obtain the linear relationship between the image background I (x, y) and the larger wave peak in the histogram according to step 2.3, as

I(x,y)=a(x,y)*(Zmax-Zh)+h(x,y),I(x,y)=a(x,y)*(Z max -Z h )+h(x,y),

其中,Zmax表示直方图内较大波峰值对应的灰度值。Wherein, Z max represents the gray value corresponding to the larger wave peak in the histogram.

所述步骤3包括如下步骤:Described step 3 comprises the steps:

步骤3.1、从上述N张第一样本图像、M张第二样本图像中均任选一张样本图像,统计所选第一样本图像、第二样本图像内对应灰度值的像素数,以建立所选第一样本图像、第二样本图像的直方图,得到所选第一样本图像、第二样本图像直方图内的较大波峰值对应的灰度值;Step 3.1, choose a sample image from the above N first sample images and M second sample images, count the number of pixels corresponding to the gray value in the selected first sample image and the second sample image, To establish the histogram of the selected first sample image and the second sample image, obtain the gray value corresponding to the larger wave peak value in the selected first sample image and the second sample image histogram;

步骤3.2、根据步骤2及较大波峰值对应的灰度值,求出所选第一样本图像、第二样本图像分别对应的背景分量I(x,y);Step 3.2, according to step 2 and the gray value corresponding to the larger wave peak value, obtain the background component I (x, y) respectively corresponding to the selected first sample image and the second sample image;

步骤3.3、根据

Figure BDA00001676593300032
求取所选第一样本图像、第二样本图像的反射分量,其中,k为常数,f(x,y)为所选第一样本图像或第二样本图像。Step 3.3, according to
Figure BDA00001676593300032
Calculating reflection components of the selected first sample image and the second sample image, where k is a constant, and f(x, y) is the selected first sample image or the second sample image.

所述步骤4包括如下步骤:Described step 4 comprises the steps:

步骤4.1、计算所选第一样本图像的反射分量的均值μ,得到Step 4.1, calculate the mean value μ of the reflection component of the selected first sample image, and obtain

μμ == 11 nno ** mm ΣΣ xx == 11 nno ΣΣ ythe y == 11 mm rr (( xx ,, ythe y )) ,,

其中,n*m表示反射分量图像的大小;Among them, n*m represents the size of the reflection component image;

步骤4.2、根据步骤4.1计算所选第一样本图像反射分量的标准差σn,得到Step 4.2, calculate the standard deviation σ n of the reflection component of the selected first sample image according to step 4.1, and obtain

σσ nno == 11 nno ** mm ΣΣ xx == 11 nno ΣΣ ythe y == 11 mm (( rr (( xx ,, ythe y )) -- μμ )) )) 22 ;;

步骤4.3、根据步骤4.1、步骤4.2计算所选第二样本图像反射分量的标准差σ0Step 4.3, calculate the standard deviation σ 0 of the reflection component of the selected second sample image according to steps 4.1 and 4.2;

步骤4.4、建立合格工件反射分量标准差与直方图内较大波峰值的灰度值Zmax对应关系式,得到,Step 4.4, establish the corresponding relationship between the standard deviation of the reflection component of the qualified workpiece and the gray value Z max of the larger wave peak in the histogram, and obtain,

σσ (( ZZ maxmax )) ≈≈ σσ nno -- σσ 00 ZZ maxmax __ nno -- ZZ maxmax __ 00 ** (( ZZ maxmax -- ZZ maxmax __ 00 )) ++ σσ 00

其中,σ(Zmax)表示合格工件的反射分量标准差,Zmax_n表示所选第一样本图像直方图中最大波峰值对应的灰度值,Zmax_0表示所选第二样本图像直方图中最大波峰值对应的灰度值。Among them, σ(Z max ) represents the standard deviation of the reflection component of a qualified workpiece, Z max_n represents the gray value corresponding to the maximum peak value in the histogram of the selected first sample image, and Z max_0 represents the gray value in the histogram of the selected second sample image The gray value corresponding to the maximum peak value.

所述步骤5包括如下步骤:Described step 5 comprises the steps:

步骤5.1、在工作光照条件下,采集工件检测图像t(x,y),并对检测图像t(x,y)进行中值滤波;Step 5.1. Under the working light conditions, collect the workpiece detection image t(x, y), and perform median filtering on the detection image t(x, y);

步骤5.2、建立中值滤波后,检测图像的直方图,根据检测图像的直方图,得到直方图内较大波峰值对应的灰度值ZtStep 5.2, after establishing the median filter, detect the histogram of the image, and obtain the gray value Z t corresponding to the larger wave peak in the histogram according to the histogram of the detected image;

步骤5.3、根据灰度值Zt及步骤2,得到检测图像的背景分量It(x,y);Step 5.3, according to the gray value Z t and step 2, obtain the background component I t (x, y) of the detected image;

步骤5.4、根据步骤5.3及步骤3,得到检测图像的反射分量rt(x,y);Step 5.4, according to step 5.3 and step 3, obtain the reflection component r t (x, y) of the detected image;

步骤5.5、对反射分量rt(x,y)进行高斯滤波,生成第二反射分量R(x,y);Step 5.5, performing Gaussian filtering on the reflection component r t (x, y) to generate a second reflection component R(x, y);

步骤5.6、根据灰度值Zt及步骤4.4得到检测图像的第一标准差σ(Zt);Step 5.6, obtain the first standard deviation σ(Z t ) of the detected image according to the gray value Z t and step 4.4;

步骤5.7、根据步骤4.1及步骤4.2计算第二反射分量R(x,y)的第二标准差σtStep 5.7. Calculate the second standard deviation σ t of the second reflection component R(x, y) according to Step 4.1 and Step 4.2.

所述步骤6包括如下步骤:Described step 6 comprises the steps:

步骤6.1、比较第一标准差σ(Zt)与第二标准差σt的关系,得到Step 6.1, compare the relationship between the first standard deviation σ(Z t ) and the second standard deviation σ t to get

sigmasigma == 22 σσ (( ZZ tt )) ,, σσ tt >> 22 σσ (( ZZ tt )) σσ tt ,, σσ tt ≤≤ 22 σσ (( ZZ tt ))

步骤6.2、设定分割上阈值T1、下阈值T2,得到Step 6.2. Set the segmentation upper threshold T 1 and lower threshold T 2 to obtain

TT 11 == ZZ tt ++ λλ ** sigmasigma TT 22 == ZZ tt -- λλ ** sigmasigma

其中,λ为调节系数;Among them, λ is the adjustment coefficient;

步骤6.3、利用上阈值T1、下阈值T2对第二背景分量R(x,y)进行阈值分割,得到二值图像b(x,y),得到Step 6.3, using the upper threshold T 1 and the lower threshold T 2 to perform threshold segmentation on the second background component R(x,y) to obtain a binary image b(x,y), and obtain

bb (( xx ,, ythe y )) == 00 ,, TT 22 ≤≤ RR (( xx ,, ythe y )) ≤≤ TT 11 11

其中,0为背景区域,1为待处理区域。Among them, 0 is the background area, and 1 is the area to be processed.

所述步骤7包括如下步骤:Described step 7 comprises the steps:

步骤7.1、扫描二值图像b(x,y),并对二值图像b(x,y)内的不同连通区域进行标记;Step 7.1, scan the binary image b(x, y), and mark the different connected regions in the binary image b(x, y);

步骤7.2、分别统计二值图像b(x,y)内不同连通区域的面积,设置所需的判断阈值S;二值图像b(x,y)内连通区域面积大于判断阈值S时,则相应连通区域为瑕疵区域;当二值图像b(x,y)内连通区域面积小于判断阈值S时,则相应连通区域为正常区域。Step 7.2, count the areas of different connected regions in the binary image b(x, y) respectively, and set the required judgment threshold S; when the area of connected regions in the binary image b(x, y) is greater than the judgment threshold S, then corresponding The connected area is a defective area; when the area of the connected area in the binary image b(x, y) is smaller than the judgment threshold S, the corresponding connected area is a normal area.

所述步骤5.5中,高斯滤波的卷积模板为In the step 5.5, the convolution template of the Gaussian filter is

hh == 11 1616 ** 11 22 11 22 44 22 11 22 11 ..

所述调节系数λ为3~4。The adjustment coefficient λ is 3-4.

本发明的优点:先在离线状态下学习分析被测工件在该工作状态下的亮度分布情况,以及合格工件的统计特征;然后在线检测时,能有效提取出被测工件的反射分量,并通过滤波、阈值分割等操作对工件进行实时、准确的瑕疵检测,操作方便,检测精度高,检测适应性好,稳定可靠。Advantages of the present invention: first learn and analyze the brightness distribution of the measured workpiece in the working state in the offline state, and the statistical characteristics of the qualified workpiece; Filtering, threshold segmentation and other operations are used to perform real-time and accurate defect detection on workpieces, with convenient operation, high detection accuracy, good detection adaptability, and stability and reliability.

附图说明 Description of drawings

图1为本发明用于采集图像的结构示意图。FIG. 1 is a schematic diagram of the structure of the present invention for collecting images.

图2为本发明的流程图。Fig. 2 is a flowchart of the present invention.

附图标记说明:100-工业相机、110-支撑架、120-被测工件、130-漫射平面光、140-底座及150-悬挂架。Explanation of reference numerals: 100-industrial camera, 110-support frame, 120-measured workpiece, 130-diffused plane light, 140-base and 150-suspension frame.

具体实施方式 Detailed ways

下面结合具体附图和实施例对本发明作进一步说明。The present invention will be further described below in conjunction with specific drawings and embodiments.

本发明目的在于对抛光金属弧状面进行瑕疵的实时检测,由于抛光金属弧状面表面光滑,漫反射率低,而且表面成弧状,不同空间位置的面所放射的光线强度不一,所以很难获得宽幅亮度均匀的图像。根据该问题,提出了一种基于离线学习知识实时检测抛光金属弧状面并能进行在线实时检测瑕疵的方法。The purpose of the present invention is to carry out real-time detection of flaws on polished metal arc-shaped surfaces. Since the surface of polished metal arc-shaped surfaces is smooth, the diffuse reflectance is low, and the surface is arc-shaped, the intensity of light emitted by surfaces at different spatial positions is different, so it is difficult to obtain Wide image with uniform brightness. According to this problem, a method based on offline learning knowledge for real-time detection of polished metal arc-shaped surfaces and online real-time detection of defects is proposed.

如图1所示,采集图像时,本发明包括底座140,所述底座140上设有竖直分布的支撑架110,通过支撑架110能够支撑金属弧状面;底座140上还设有悬挂架150,通过悬挂架150能够悬挂工业相机100;支撑架110的正上方设有漫射平面光130,通过漫射平面光130照射被测的金属弧状面,以能够工业相机100采集所需的图像。本发明实施例中采用X-Sight SV4-30m工业相机100采集柱形工件弧状侧表面图像,工业相机100采样单元为1/3英寸CMOS,分辨率为640*480(像素)。由于抛光金属弧状表面的反射率高,检测面不在一个空间平面上,采用直接照射、同轴照射的方式都只能得到非常窄的有效区域。采用了蓝色漫射平面LED光源与被测面垂直照射的方式照明;因为波长越短,表面的散射性越好,所以选择了波长在470nm的蓝色光源。As shown in Figure 1, when collecting images, the present invention includes a base 140, the base 140 is provided with a vertically distributed support frame 110, and the metal arc-shaped surface can be supported by the support frame 110; the base 140 is also provided with a suspension frame 150 The industrial camera 100 can be suspended through the suspension frame 150; a diffuse plane light 130 is provided directly above the support frame 110, and the diffuse plane light 130 illuminates the metal arc-shaped surface to be measured, so that the industrial camera 100 can collect the required image. In the embodiment of the present invention, the X-Sight SV4-30m industrial camera 100 is used to collect the arc-shaped side surface image of the cylindrical workpiece. The sampling unit of the industrial camera 100 is 1/3 inch CMOS, and the resolution is 640*480 (pixels). Due to the high reflectivity of the polished metal arc-shaped surface, the detection surface is not on the same spatial plane, and only a very narrow effective area can be obtained by direct irradiation or coaxial irradiation. A blue diffuse plane LED light source is used to illuminate the measured surface vertically; because the shorter the wavelength, the better the scattering of the surface, so a blue light source with a wavelength of 470nm is selected.

如图2所示:本发明对抛光金属弧状面瑕疵实时检测方法包括如下步骤:As shown in Figure 2: the present invention comprises the following steps to the real-time detection method of polished metal arc-shaped surface defect:

步骤1、离线情况下,获取N张合格工件在正常工作光照下的第一样本图像及M张合格工件在低光照下的第二样本图像,对N张第一样本图像分别进行中值滤波获得图像序列In,n=1,2,…,N,对M张第二样本图像分别进行中值滤波获得图像序列Im,m=1,2,…,M,对图像序列In、图像序列Im分别进行数据融合后得到图像g(x,y)、h(x,y);Step 1. Offline, obtain the first sample images of N qualified workpieces under normal working light and the second sample images of M qualified workpieces under low light, and perform median Filter to obtain image sequence I n , n=1,2,...,N, respectively perform median filtering on M second sample images to obtain image sequence I m ,m=1,2,...,M, for image sequence I n and the image sequence I m respectively carry out data fusion to obtain images g(x, y), h(x, y);

离线情况是指通过工业相机先采集合格工件的图像,通过对大量数据进行分析得到所需的结论,以用于在线检测,样本图像的作用一是分析背景分量,作为在线检测提取反射分量时的依据;二是提取特征,作为检测时阈值分割、决策时用。获取N张第一样本图像、M张第二样本图像是为了对样本图像进行数据融合,从而获得更可靠的背景分量,其中N可以等于M。低光照的范围最好在平均灰度在值20左右,正常光照的平均灰度值大概是在40左右。The offline situation means that the image of the qualified workpiece is first collected by the industrial camera, and the required conclusion is obtained by analyzing a large amount of data, which can be used for online detection. The basis; the second is to extract features, which are used for threshold segmentation and decision-making during detection. Acquiring N first sample images and M second sample images is to perform data fusion on the sample images, so as to obtain more reliable background components, where N may be equal to M. The range of low light is best when the average gray value is around 20, and the average gray value of normal light is about 40.

步骤1包括如下具体步骤:Step 1 includes the following specific steps:

步骤1.1、在离线情况下,采集N张合格工件在工作光照下的第一样本图像,然后降低至所需光照强度,采集M张合格工件在低光照强度下的第二样本图像;Step 1.1. In the offline situation, collect the first sample images of N qualified workpieces under working light, and then reduce to the required light intensity, and collect the second sample images of M qualified workpieces under low light intensity;

步骤1.2、对第一样本图像、第二样本图像进行中值滤波分别得到图像序列In,Im;其中,n=1,2,…,N,m=1,2,…M;Step 1.2, performing median filtering on the first sample image and the second sample image to obtain image sequences I n , I m respectively; where, n=1, 2,..., N, m=1, 2,...M;

中值滤波时,将每一像素点的灰度值设置为该点某邻域窗口内的所有像素点灰度值的中值,默认窗口采用25*25的邻域窗口,根据采集的样本图像大小可以进行相应调整,中值滤波为常规的滤波方式,为本技术领域人员所熟知,此处不再详述;During median filtering, the gray value of each pixel is set to the median value of all pixel gray values in a certain neighborhood window at that point. The default window is a 25*25 neighborhood window. According to the collected sample image The size can be adjusted accordingly. Median filtering is a conventional filtering method, which is well known to those skilled in the art and will not be described in detail here;

步骤1.3、根据

Figure BDA00001676593300061
将图像序列In进行数据融合,其中,(x,y)表示图像序列内的像素位置;Step 1.3, according to
Figure BDA00001676593300061
Carry out data fusion with the image sequence I n , wherein, (x, y) represents the pixel position in the image sequence;

步骤1.4、根据

Figure BDA00001676593300062
将图像序列Im进行数据融合。Step 1.4, according to
Figure BDA00001676593300062
The image sequence I m is subjected to data fusion.

步骤2、统计融合后图像g(x,y)、h(x,y)内相应灰度值及灰度值对应的像素个数,分别得到图像g(x,y)、h(x,y)的直方图,根据直方图相应的较大波峰值对应的灰度值建立图像背景I(x,y)与直方图内较大波峰值对应的灰度值间的线性关系式为Step 2. Count the corresponding gray value and the number of pixels corresponding to the gray value in the fused image g(x, y), h(x, y), and obtain the image g(x, y), h(x, y) respectively ) histogram, according to the gray value corresponding to the corresponding larger wave peak in the histogram, the linear relationship between the image background I(x, y) and the gray value corresponding to the larger wave peak in the histogram is established as

I(x,y)=a(x,y)*(Zmax-Zh)+h(x,y)I(x,y)=a(x,y)*(Z max -Z h )+h(x,y)

其中,Zmax表示直方图内较大波峰值对应的灰度值,a(x,y)为斜率矩阵;Among them, Z max represents the gray value corresponding to the larger wave peak in the histogram, and a(x, y) is the slope matrix;

所述步骤2包括如下步骤:Described step 2 comprises the following steps:

步骤2.1、图像灰度取0~255,统计图像g(x,y)对应灰度值的像素个数,然后除以图像g(x,y)的总像素个数,得到图像g(x,y)的直方图p(z),并求出达到较大波峰值的灰度值ZgStep 2.1, the grayscale of the image is 0~255, the number of pixels corresponding to the grayscale value of the image g(x,y) is counted, and then divided by the total number of pixels of the image g(x,y) to obtain the image g(x,y) y) histogram p(z), and calculate the gray value Z g that reaches the larger peak value;

建立直方图为本技术领域常用的技术手段,直方图的横坐标为图像灰度值,纵坐标为某个灰度值的像素个数与图像总相数个数的比值,此处不再详述;z为图像灰度值;Establishing a histogram is a commonly used technical means in this technical field. The abscissa of the histogram is the gray value of the image, and the ordinate is the ratio of the number of pixels of a certain gray value to the total number of phases of the image, which will not be detailed here. described; z is the gray value of the image;

步骤2.2、根据步骤2.1,得到图像h(x,y)的直方图q(z),并求出达到较大峰值的灰度值ZhStep 2.2, according to step 2.1, obtain the histogram q(z) of the image h(x, y), and calculate the gray value Z h that reaches a larger peak value;

步骤2.3、建立图像背景I(x,y)与直方图内较大波峰值对应灰度值间的线性斜率矩阵,得到Step 2.3, establish the linear slope matrix between the image background I (x, y) and the corresponding gray value of the larger wave peak in the histogram, and obtain

aa (( xx ,, ythe y )) == gg (( xx ,, ythe y )) -- hh (( xx ,, ythe y )) ZZ gg -- ZZ hh ;;

步骤2.4、根据步骤2.3得到图像背景I(x,y)与直方图内较大波峰值间的线性关系,为Step 2.4, obtain the linear relationship between the image background I (x, y) and the larger wave peak in the histogram according to step 2.3, as

I(x,y)=a(x,y)*(Zmax-Zh)+h(x,y),I(x,y)=a(x,y)*(Z max -Z h )+h(x,y),

其中,Zmax表示直方图内较大波峰值对应的灰度值。Wherein, Z max represents the gray value corresponding to the larger wave peak in the histogram.

步骤3、从上述第一样本图像、第二样本图像中均任选一张样本图像,并建立所选第一样本图像、第二样本图像的直方图,得到所选第一样本图像、第二样本图像直方图内的较大波峰值对应的灰度值,根据所述灰度值及步骤2的线性关系式,分别得到所选第一样本图像、第二样本图像的反射分量;Step 3. Select a sample image from the above-mentioned first sample image and the second sample image, and establish the histogram of the selected first sample image and the second sample image to obtain the selected first sample image , the gray value corresponding to the larger wave peak value in the histogram of the second sample image, according to the gray value and the linear relational expression in step 2, respectively obtain the reflection components of the selected first sample image and the second sample image;

所述步骤3包括如下步骤:Described step 3 comprises the steps:

步骤3.1、从上述N张第一样本图像、M张第二样本图像中均任选一张样本图像,统计所选第一样本图像、第二样本图像内对应灰度值的像素数,以建立所选第一样本图像、第二样本图像的直方图,得到所选第一样本图像、第二样本图像直方图内的较大波峰值对应的灰度值;Step 3.1, choose a sample image from the above N first sample images and M second sample images, count the number of pixels corresponding to the gray value in the selected first sample image and the second sample image, To establish the histogram of the selected first sample image and the second sample image, obtain the gray value corresponding to the larger wave peak value in the selected first sample image and the second sample image histogram;

步骤3.2、根据步骤2及较大波峰值对应的灰度值,求出所选第一样本图像、第二样本图像分别对应的背景分量I(x,y);Step 3.2, according to step 2 and the gray value corresponding to the larger wave peak value, obtain the background component I (x, y) respectively corresponding to the selected first sample image and the second sample image;

步骤3.3、根据

Figure BDA00001676593300071
求取所选第一样本图像、第二样本图像的反射分量,其中,k为常数,f(x,y)为所选第一样本图像或第二样本图像;k是取决于反射分量的常量,为了使反射分量的均值在0.5左右,一般k取0.5。Step 3.3, according to
Figure BDA00001676593300071
Find the reflection component of the selected first sample image and the second sample image, where k is a constant, f(x, y) is the selected first sample image or the second sample image; k depends on the reflection component The constant of , in order to make the average value of the reflection component around 0.5, generally k is 0.5.

步骤4、根据步骤3得到所选第一样本图像、第二样本图像的反射分量,建立合格工件反射分量标准差与直方图内较大波峰值对应的灰度值间的对应关系式为Step 4. Obtain the reflection components of the selected first sample image and the second sample image according to step 3, and establish the corresponding relationship between the standard deviation of the reflection component of the qualified workpiece and the gray value corresponding to the larger wave peak in the histogram:

σσ (( ZZ maxmax )) ≈≈ σσ nno -- σσ 00 ZZ maxmax __ nno -- ZZ maxmax __ 00 ** (( ZZ maxmax -- ZZ maxmax __ 00 )) ++ σσ 00

其中,σ(Zmax)表示合格工件的反射分量标准差,Zmax_n表示所选第一样本图像直方图中最大波峰值对应的灰度值,Zmax_0表示所选第二样本图像直方图中最大波峰值对应的灰度值,σn为所选第一样本图像的标准差,σ0为所选第二样本图像的标准差;Among them, σ(Z max ) represents the standard deviation of the reflection component of a qualified workpiece, Z max_n represents the gray value corresponding to the maximum peak value in the histogram of the selected first sample image, and Z max_0 represents the gray value in the histogram of the selected second sample image The gray value corresponding to the maximum peak value, σ n is the standard deviation of the selected first sample image, and σ 0 is the standard deviation of the selected second sample image;

所述步骤4包括如下步骤:Described step 4 comprises the steps:

步骤4.1、计算所选第一样本图像的反射分量的均值μ,得到Step 4.1, calculate the mean value μ of the reflection component of the selected first sample image, and obtain

μμ == 11 nno ** mm ΣΣ xx == 11 nno ΣΣ ythe y == 11 mm rr (( xx ,, ythe y )) ,,

其中,n*m表示反射分量图像的大小;Among them, n*m represents the size of the reflection component image;

步骤4.2、根据步骤4.1计算所选第一样本图像反射分量的标准差σn,得到Step 4.2, calculate the standard deviation σ n of the reflection component of the selected first sample image according to step 4.1, and obtain

σσ nno == 11 nno ** mm ΣΣ xx == 11 nno ΣΣ ythe y == 11 mm (( rr (( xx ,, ythe y )) -- μμ )) )) 22 ;;

步骤4.3、根据步骤4.1、步骤4.2计算所选第二样本图像反射分量的标准差σ0Step 4.3, calculate the standard deviation σ 0 of the reflection component of the selected second sample image according to steps 4.1 and 4.2;

步骤4.4、建立合格工件反射分量标准差与直方图内较大波峰值的灰度值Zmax对应关系式,得到,Step 4.4, establish the corresponding relationship between the standard deviation of the reflection component of the qualified workpiece and the gray value Z max of the larger wave peak in the histogram, and obtain,

σσ (( ZZ maxmax )) ≈≈ σσ nno -- σσ 00 ZZ maxmax __ nno -- ZZ maxmax __ 00 ** (( ZZ maxmax -- ZZ maxmax __ 00 )) ++ σσ 00

其中,σ(Zmax)表示合格工件的反射分量标准差,Zmax_n表示所选第一样本图像直方图中最大波峰值对应的灰度值,Zmax_0表示所选第二样本图像直方图中最大波峰值对应的灰度值。Among them, σ(Z max ) represents the standard deviation of the reflection component of a qualified workpiece, Z max_n represents the gray value corresponding to the maximum peak value in the histogram of the selected first sample image, and Z max_0 represents the gray value in the histogram of the selected second sample image The gray value corresponding to the maximum peak value.

步骤5、在线实时获取抛光金属弧状面工件在工作光照下的检测图像,对所述检测图像进行中值滤波,建立检测图像的直方图;根据直方图内较大波峰值对应的灰度值及上述步骤得到检测图像的反射分量;对获得检测图像的反射分量进行高斯滤波,得到第二反射分量,并计算第二反射分量的第二标准差,且根据步骤4计算得到检测图像在对应灰度水平的合格工件图像的第一标准差;Step 5. Obtain the detection image of the polished metal arc-shaped workpiece in real time online under the working light, perform median filtering on the detection image, and establish a histogram of the detection image; according to the gray value corresponding to the larger wave peak in the histogram and the above The first step is to obtain the reflection component of the detection image; Gaussian filtering is performed on the reflection component of the detection image to obtain the second reflection component, and the second standard deviation of the second reflection component is calculated, and according to step 4, the detection image is obtained at the corresponding gray level The first standard deviation of the qualified workpiece image;

在线检测是指获得检测图像后,通过对检测图像进行检测分析判断金属弧状面是否存在瑕疵;在线检测需要利用离线检测的结论及数据,在线检测利用到的技术手段与离线检测一致时,可以参考上述离线检测时的计算公式及方法。On-line detection means that after the detection image is obtained, the detection and analysis of the detection image is used to determine whether there is a flaw on the metal arc-shaped surface; the online detection needs to use the conclusion and data of the offline detection. When the technical means used in the online detection are consistent with the offline detection, you can refer to The above calculation formula and method for off-line detection.

所述步骤5包括如下步骤:Described step 5 comprises the following steps:

步骤5.1、在工作光照条件下,采集工件检测图像t(x,y),并对检测图像t(x,y)进行中值滤波;Step 5.1. Under the working light conditions, collect the workpiece detection image t(x, y), and perform median filtering on the detection image t(x, y);

步骤5.2、建立中值滤波后,检测图像的直方图,根据检测图像的直方图,得到直方图内较大波峰值对应的灰度值ZtStep 5.2, after establishing the median filter, detect the histogram of the image, and obtain the gray value Z t corresponding to the larger wave peak in the histogram according to the histogram of the detected image;

步骤5.3、根据灰度值Zt及步骤2,得到检测图像的背景分量It(x,y);Step 5.3, according to the gray value Z t and step 2, obtain the background component I t (x, y) of the detected image;

步骤5.4、根据步骤5.3及步骤3,得到检测图像的反射分量rt(x,y);Step 5.4, according to step 5.3 and step 3, obtain the reflection component r t (x, y) of the detected image;

步骤5.5、对反射分量rt(x,y)进行高斯滤波去噪,生成第二反射分量R(x,y),其中高斯滤波的卷积模板为Step 5.5. Perform Gaussian filtering on the reflection component r t (x, y) to generate the second reflection component R(x, y), where the convolution template of the Gaussian filtering is

hh == 11 1616 ** 11 22 11 22 44 22 11 22 11 ..

步骤5.6、根据灰度值Zt及步骤4.4得到检测图像的第一标准差σ(Zt);Step 5.6, obtain the first standard deviation σ(Z t ) of the detected image according to the gray value Z t and step 4.4;

步骤5.7、根据步骤4.1及步骤4.2计算第二反射分量R(x,y)的第二标准差σtStep 5.7. Calculate the second standard deviation σ t of the second reflection component R(x, y) according to Step 4.1 and Step 4.2.

步骤6、比较第一标准差及第二标准差,以选取分割阈值,通过分割阈值对第二反射分量进行阈值分割,得到对应的二值图像;Step 6. Comparing the first standard deviation and the second standard deviation to select a segmentation threshold, and performing threshold segmentation on the second reflection component through the segmentation threshold to obtain a corresponding binary image;

所述步骤6包括如下步骤:Described step 6 comprises the steps:

步骤6.1、比较第一标准差σ(Zt)与第二标准差σt的关系,得到Step 6.1, compare the relationship between the first standard deviation σ(Z t ) and the second standard deviation σ t to get

sigmasigma == 22 σσ (( ZZ tt )) ,, σσ tt >> 22 σσ (( ZZ tt )) σσ tt ,, σσ tt ≤≤ 22 σσ (( ZZ tt ))

步骤6.2、设定分割上阈值T1、下阈值T2,得到Step 6.2. Set the segmentation upper threshold T 1 and lower threshold T 2 to obtain

TT 11 == ZZ tt ++ λλ ** sigmasigma TT 22 == ZZ tt -- λλ ** sigmasigma

其中,λ为调节系数;所述调节系数λ为3~4。Wherein, λ is an adjustment coefficient; the adjustment coefficient λ is 3-4.

步骤6.3、利用上阈值T1、下阈值T2对第二背景分量R(x,y)进行阈值分割,得到二值图像b(x,y),得到Step 6.3, using the upper threshold T 1 and the lower threshold T 2 to perform threshold segmentation on the second background component R(x,y) to obtain a binary image b(x,y), and obtain

bb (( xx ,, ythe y )) == 00 ,, TT 22 ≤≤ RR (( xx ,, ythe y )) ≤≤ TT 11 11

其中,0为背景区域,1为待处理区域。Among them, 0 is the background area, and 1 is the area to be processed.

步骤7、扫描上述二值图像,并对二值图像内不同连通区域进行标记,统计连通区域面积,将连通区域面积与预设判断阈值比较,判断抛光金属弧状面的瑕疵。Step 7. Scanning the above binary image, marking different connected areas in the binary image, counting the area of the connected area, comparing the area of the connected area with a preset judgment threshold, and judging the flaws of the polished metal arc surface.

所述步骤7包括如下步骤:Described step 7 comprises the steps:

步骤7.1、扫描二值图像b(x,y),并对二值图像b(x,y)内的不同连通区域进行标记;Step 7.1, scan the binary image b(x, y), and mark the different connected regions in the binary image b(x, y);

本发明实施例中可以采用递归方法进行区域标记;In the embodiment of the present invention, a recursive method can be used for region marking;

步骤7.2、分别统计二值图像b(x,y)内不同连通区域的面积,设置所需的判断阈值S;二值图像b(x,y)内连通区域面积大于判断阈值S时,则相应连通区域为瑕疵区域;当二值图像b(x,y)内连通区域面积小于判断阈值S时,则相应连通区域为正常区域。通过判断二值图像b(x,y)内连通区域是否为瑕疵区域来判断金属弧状面是否存在瑕疵,由于金属抛光面及不同行业的加工要求,判断阈值S可以相应设置。Step 7.2: Count the areas of different connected regions in the binary image b(x, y) respectively, and set the required judgment threshold S; when the area of connected regions in the binary image b(x, y) is greater than the judgment threshold S, then corresponding The connected area is a defective area; when the area of the connected area in the binary image b(x, y) is smaller than the judgment threshold S, the corresponding connected area is a normal area. By judging whether the connected area in the binary image b(x, y) is a flawed area, it is judged whether there is a flaw on the metal arc surface. Due to the metal polishing surface and the processing requirements of different industries, the judgment threshold S can be set accordingly.

本发明先在离线状态下学习分析被测工件在该工作状态下的亮度分布情况,以及合格工件的统计特征;然后在线检测时,能有效提取出被测工件的反射分量,并通过滤波、阈值分割等操作对工件进行实时、准确的瑕疵检测。The invention first learns and analyzes the brightness distribution of the measured workpiece in the working state in the off-line state, and the statistical characteristics of the qualified workpiece; then, during the online detection, it can effectively extract the reflection component of the measured workpiece, and through filtering, threshold Segmentation and other operations are used to perform real-time and accurate defect detection on workpieces.

Claims (10)

1. polishing metal arcuation face flaw real-time detection method based on machine vision, it is characterized in that: said polishing metal arcuation face flaw real-time detection method comprises the steps:
Under step 1, the off-line case, obtain N opening and closing lattice workpiece, N is opened first sample image carry out medium filtering acquisition image sequence I respectively at first sample image under the operate as normal illumination and second sample image of M opening and closing lattice workpiece under low light shines n, n=1,2 ..., N opens second sample image to M and carries out medium filtering acquisition image sequence I respectively m, m=1,2 ..., M is to image sequence I n, image sequence I mCarry out respectively obtaining after the data fusion image g (x, y), h (x, y);
Step 2, statistics fused image g (x; Y), h (x, y) in the corresponding number of pixels of corresponding gray-scale value and gray-scale value, obtain image g (x respectively; Y), h (x; Y) histogram, (x y) and in the histogram than the linear relation between big crest value corresponding gray does to set up image background I according to the corresponding big crest value corresponding gray of histogram
I(x,y)=a(x,y)*(Z max-Z h)+h(x,y)
Wherein, Z MaxBig crest value corresponding gray in the expression histogram, (x y) is the slope matrix to a;
Step 3, from above-mentioned first sample image, second sample image all optional sample image; And set up the histogram of selected first sample image, second sample image; Obtain the big crest value corresponding gray in selected first sample image, the second sample image histogram; According to the linear relation of said gray-scale value and step 2, obtain the reflecting component of selected first sample image, second sample image respectively;
Step 4, obtain the reflecting component of selected first sample image, second sample image, set up that the corresponding relation formula between big crest value corresponding gray does in qualified workpiece reflecting component standard deviation and the histogram according to step 3
σ ( Z max ) ≈ σ n - σ 0 Z max _ n - Z max _ 0 * ( Z max - Z max _ 0 ) + σ 0
Wherein, σ (Z Max) expression qualified workpiece the reflecting component standard deviation, Z Max_nRepresent maxima of waves peak value corresponding gray in the selected first sample image histogram, Z Max_0Represent maxima of waves peak value corresponding gray in the selected second sample image histogram, σ nBe the standard deviation of selected first sample image, σ 0Standard deviation for selected second sample image;
Step 5, online in real time are obtained the detected image of polishing metal arcuation face workpiece under work illumination, and said detected image is carried out medium filtering, set up the histogram of detected image; Obtain the reflecting component of detected image according to big crest value corresponding gray and above-mentioned steps in the histogram; Reflecting component to obtaining detected image carries out gaussian filtering, obtains second reflecting component, and calculates second standard deviation of second reflecting component, and calculate first standard deviation of detected image at the qualified workpiece image of corresponding grey scale level according to step 4;
Step 6, comparison first standard deviation and second standard deviation to choose segmentation threshold, are carried out Threshold Segmentation through segmentation threshold to second reflecting component, obtain corresponding bianry image;
Step 7, scan above-mentioned bianry image, and different connected regions in the bianry image are carried out mark, statistics connected region area, with connected region area and preset judgment threshold relatively, the flaw of judgement polishing metal arcuation face.
2. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 1 is characterized in that said step 1 comprises the steps:
Step 1.1, under off-line case, gather N opening and closing lattice workpiece at work illumination first sample image down, be reduced to required intensity of illumination then, gather second sample image of M opening and closing lattice workpiece under low light photograph intensity;
Step 1.2, first sample image, second sample image are carried out medium filtering obtain image sequence I respectively n, I mWherein, n=1,2 ..., N, m=1,2 ... M;
Step 1.3, basis
Figure FDA00001676593200021
With image sequence I nCarry out data fusion, wherein, (x, y) location of pixels in the presentation video sequence;
Step 1.4, basis
Figure FDA00001676593200022
With image sequence I mCarry out data fusion.
3. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 1 is characterized in that said step 2 comprises the steps:
Step 2.1, gradation of image get 0 ~ 255, and ((x, total number of pixels y) obtain image g (x, histogram p (z) y), and obtain the gray-scale value Z that reaches big crest value to statistical picture g divided by image g then for x, the y) number of pixels of corresponding grey scale value g
Step 2.2, according to step 2.1, obtain image h (x, histogram q (z) y), and obtain the gray-scale value Z that reaches big peak value h
Step 2.3, (x, the linear gradient matrix between big crest value corresponding grey scale value y) and in the histogram obtains to set up image background I
a ( x , y ) = g ( x , y ) - h ( x , y ) Z g - Z h ;
Step 2.4, according to step 2.3 obtain image background I (x, the linear relationship between big crest value y) and in the histogram, for
I(x,y)=a(x,y)*(Z max-Z h)+h(x,y),
Wherein, Z MaxBig crest value corresponding gray in the expression histogram.
4. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 1 is characterized in that said step 3 comprises the steps:
Step 3.1, open first sample image, M from above-mentioned N and open all optional sample image second sample image; Add up the pixel count of corresponding grey scale value in selected first sample image, second sample image; To set up the histogram of selected first sample image, second sample image, obtain the big crest value corresponding gray in selected first sample image, the second sample image histogram;
Step 3.2, according to step 2 and big crest value corresponding gray, obtain the corresponding respectively background component I of selected first sample image, second sample image (x, y);
Step 3.3, basis
Figure FDA00001676593200024
are asked for the reflecting component of selected first sample image, second sample image; Wherein, K is a constant; (x y) is selected first sample image or second sample image to f.
5. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 1 is characterized in that said step 4 comprises the steps:
The average μ of the reflecting component of step 4.1, selected first sample image of calculating obtains
μ = 1 n * m Σ x = 1 n Σ y = 1 m r ( x , y ) ,
Wherein, n*m representes the size of reflecting component image;
Step 4.2, calculate the standard deviation sigma of the selected first sample image reflecting component according to step 4.1 n, obtain
σ n = 1 n * m Σ x = 1 n Σ y = 1 m ( r ( x , y ) - μ ) ) 2 ;
Step 4.3, calculate the standard deviation sigma of the selected second sample image reflecting component according to step 4.1, step 4.2 0
Step 4.4, set up the gray-scale value Z of big crest value in qualified workpiece reflecting component standard deviation and the histogram MaxThe corresponding relation formula obtains,
σ ( Z max ) ≈ σ n - σ 0 Z max _ n - Z max _ 0 * ( Z max - Z max _ 0 ) + σ 0
Wherein, σ (Z Max) expression qualified workpiece the reflecting component standard deviation, Z Max_nRepresent maxima of waves peak value corresponding gray in the selected first sample image histogram, Z Max_0Represent maxima of waves peak value corresponding gray in the selected second sample image histogram.
6. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 5 is characterized in that said step 5 comprises the steps:
Step 5.1, under the work illumination condition, gather workpiece sensing image t (x, y), and to detected image t (x y) carries out medium filtering;
Step 5.2, set up medium filtering after, the histogram of detected image according to the histogram of detected image, obtains big crest value corresponding gray Z in the histogram t
Step 5.3, according to gray-scale value Z tReach step 2, obtain the background component I of detected image t(x, y);
Step 5.4, according to step 5.3 and step 3, obtain the reflecting component r of detected image t(x, y);
Step 5.5, to reflecting component r t(x y) carries out gaussian filtering, generate the second reflecting component R (x, y);
Step 5.6, according to gray-scale value Z tAnd step 4.4 obtains the first standard deviation sigma (Z of detected image t);
Step 5.7, calculate the second reflecting component R (x, second standard deviation sigma y) according to step 4.1 and step 4.2 t
7. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 6 is characterized in that said step 6 comprises the steps:
Step 6.1, the comparison first standard deviation sigma (Z t) and second standard deviation sigma tRelation, obtain
sigma = 2 σ ( Z t ) , σ t > 2 σ ( Z t ) σ t , σ t ≤ 2 σ ( Z t )
Upper threshold value T is cut apart in step 6.2, setting 1, lower threshold value T 2, obtain
T 1 = Z t + λ * sigma T 2 = Z t - λ * sigma
Wherein, λ is an adjustment factor;
Step 6.3, utilize upper threshold value T 1, lower threshold value T 2(x y) carries out Threshold Segmentation, and (x y), obtains to obtain bianry image b to the second background component R
b ( x , y ) = 0 , T 2 ≤ R ( x , y ) ≤ T 1 1
Wherein, 0 is the background area, and 1 is pending zone.
8. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 7 is characterized in that said step 7 comprises the steps:
Step 7.1, scanning bianry image b (x, y), and to bianry image b (x, the different connected regions in y) are carried out mark;
Step 7.2, respectively add up bianry image b (x, y) in the area of different connected regions, required judgment threshold S is set; Bianry image b (x, when y) interior connected region area was greater than judgment threshold S, then corresponding connected region was a defect areas; (x, when y) interior connected region area was less than judgment threshold S, then corresponding connected region was the normal region as bianry image b.
9. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 6, it is characterized in that: in the said step 5.5, the convolution template of gaussian filtering does
h = 1 16 * 1 2 1 2 4 2 1 2 1 .
10. the polishing metal arcuation face flaw real-time detection method based on machine vision according to claim 7, it is characterized in that: said adjustment factor λ is 3 ~ 4.
CN201210163710.7A 2012-05-24 2012-05-24 Based on arcuation face, the polishing metal flaw real-time detection method of machine vision Active CN102680494B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210163710.7A CN102680494B (en) 2012-05-24 2012-05-24 Based on arcuation face, the polishing metal flaw real-time detection method of machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210163710.7A CN102680494B (en) 2012-05-24 2012-05-24 Based on arcuation face, the polishing metal flaw real-time detection method of machine vision

Publications (2)

Publication Number Publication Date
CN102680494A true CN102680494A (en) 2012-09-19
CN102680494B CN102680494B (en) 2015-08-26

Family

ID=46812752

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210163710.7A Active CN102680494B (en) 2012-05-24 2012-05-24 Based on arcuation face, the polishing metal flaw real-time detection method of machine vision

Country Status (1)

Country Link
CN (1) CN102680494B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105741298A (en) * 2016-02-03 2016-07-06 浙江工商大学 Image segmenting method for defect detection of thin film labels
CN106783580A (en) * 2016-12-29 2017-05-31 上海集成电路研发中心有限公司 A kind of method of chemical mechanical polishing of metals
CN104458783B (en) * 2014-11-05 2017-08-29 深圳市华唯计量技术开发有限公司 Analytical instrument measurement result automatic judging method based on limitation management and control application
CN112834517A (en) * 2020-12-31 2021-05-25 慈溪迅蕾轴承有限公司 Bearing appearance image detection method
CN113177924A (en) * 2021-05-10 2021-07-27 南通大学 Industrial production line product flaw detection method
WO2022142162A1 (en) * 2020-12-29 2022-07-07 华侨大学 Method for measuring gloss uniformity of arc-shaped surface
CN115922553A (en) * 2022-11-24 2023-04-07 浙江工业大学 A method for on-line monitoring of silicon carbide wafer polishing processing status
WO2023097491A1 (en) * 2021-11-30 2023-06-08 宁德时代新能源科技股份有限公司 Machine vision inspection method, and inspection apparatus and inspection system therefor

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108827181B (en) * 2018-03-14 2021-04-09 浙江大学山东工业技术研究院 A Vision-Based Plate Surface Detection Method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6269194B1 (en) * 1997-11-24 2001-07-31 Cognex Corporation Method and apparatus using image subtraction and dynamic thresholding
US6721461B1 (en) * 1997-11-24 2004-04-13 Cognex Technology And Investment Corporation Method and apparatus using image subtraction and dynamic thresholding
CN101526484A (en) * 2009-04-13 2009-09-09 江南大学 Bearing defect detecting technique based on embedded-type machine vision
CN101153851B (en) * 2007-06-15 2011-06-08 中国农业大学 Apple detection classification method based on machine vision

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6269194B1 (en) * 1997-11-24 2001-07-31 Cognex Corporation Method and apparatus using image subtraction and dynamic thresholding
US6721461B1 (en) * 1997-11-24 2004-04-13 Cognex Technology And Investment Corporation Method and apparatus using image subtraction and dynamic thresholding
CN101153851B (en) * 2007-06-15 2011-06-08 中国农业大学 Apple detection classification method based on machine vision
CN101526484A (en) * 2009-04-13 2009-09-09 江南大学 Bearing defect detecting technique based on embedded-type machine vision

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杜斌等: "基于机器视觉的经编机在线瑕疵检测技术", 《江南大学学报(自然科学版)》, vol. 11, no. 1, 29 February 2012 (2012-02-29), pages 19 - 22 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104458783B (en) * 2014-11-05 2017-08-29 深圳市华唯计量技术开发有限公司 Analytical instrument measurement result automatic judging method based on limitation management and control application
CN105741298A (en) * 2016-02-03 2016-07-06 浙江工商大学 Image segmenting method for defect detection of thin film labels
CN105741298B (en) * 2016-02-03 2018-08-14 浙江工商大学 A kind of image partition method for film label Defect Detection
CN106783580A (en) * 2016-12-29 2017-05-31 上海集成电路研发中心有限公司 A kind of method of chemical mechanical polishing of metals
WO2022142162A1 (en) * 2020-12-29 2022-07-07 华侨大学 Method for measuring gloss uniformity of arc-shaped surface
CN112834517A (en) * 2020-12-31 2021-05-25 慈溪迅蕾轴承有限公司 Bearing appearance image detection method
CN112834517B (en) * 2020-12-31 2024-01-16 慈溪迅蕾轴承有限公司 Image detection method for bearing appearance
CN113177924A (en) * 2021-05-10 2021-07-27 南通大学 Industrial production line product flaw detection method
WO2023097491A1 (en) * 2021-11-30 2023-06-08 宁德时代新能源科技股份有限公司 Machine vision inspection method, and inspection apparatus and inspection system therefor
US12437461B2 (en) 2021-11-30 2025-10-07 Contemporary Amperex Technology (Hong Kong) Limited Machine vision detection method, detection device thereof, and detection system thereof
CN115922553A (en) * 2022-11-24 2023-04-07 浙江工业大学 A method for on-line monitoring of silicon carbide wafer polishing processing status

Also Published As

Publication number Publication date
CN102680494B (en) 2015-08-26

Similar Documents

Publication Publication Date Title
CN102680494B (en) Based on arcuation face, the polishing metal flaw real-time detection method of machine vision
CN108332689B (en) Optical measurement system and method for detecting surface roughness and surface damage
CN101256157B (en) Surface defect detection method and device
CN108230324B (en) Visual detection method for microdefect on surface of magnetic shoe
CN107886500A (en) A kind of production monitoring method and system based on machine vision and machine learning
CN111815572A (en) A detection method of lithium battery welding quality based on convolutional neural network
CN106248686A (en) Glass surface defects based on machine vision detection device and method
CN106018422B (en) Based on matched special-shaped stamping parts profile defects vision detection system and method
CN108355981A (en) A kind of battery connector quality determining method based on machine vision
CN106600593B (en) A method for detecting surface defects of medium-aluminum ceramic balls
CN103163141A (en) Strip steel surface online detection system and method based on embedded image processing system
CN115690387A (en) Alloy surface detection system based on image recognition
CN112862744A (en) Intelligent detection method for internal defects of capacitor based on ultrasonic image
CN102374996A (en) Multicast detection device and method for full-depth tooth side face defects of bevel gear
CN103308525A (en) Online detection method and device for metal wire production
CN112858351A (en) X-ray nondestructive inspection method based on machine vision
CN111307812A (en) Appearance inspection method of solder joints based on machine vision
CN110096980A (en) Character machining identifying system
CN119251230B (en) Welding quality visual inspection method and system applied to welding machine
WO2023168985A1 (en) Laser scanning-based copper cathode quality detection system and method
CN111672773A (en) Product surface defect detection system and detection method based on machine vision
CN117495846B (en) Image detection method, device, electronic equipment and storage medium
CN106353340A (en) Surface defect detection method for rod-like high-reflectance part
CN109461156A (en) The threaded closure plug assembly and detection method of view-based access control model
CN103091332A (en) Detection method and detection system of U-shaped powder pipe based on machine vision

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20161122

Address after: 214029 floor, building A1, high wave East Road, Binhu District, Jiangsu, Wuxi, 9, China

Patentee after: Jiangsu blue creative intelligent Polytron Technologies Inc

Address before: 1800 No. 214122 Jiangsu city of Wuxi Province Li Lake Avenue

Patentee before: Jiangnan University

CP02 Change in the address of a patent holder

Address after: 214122 1-5 / F, building 8, 2018 Lihu Avenue, Wuxi City, Jiangsu Province

Patentee after: JIANGSU LANCHUANG INTELLIGENT TECHNOLOGY Co.,Ltd.

Address before: 214029 9th floor, building A1, 999 gaolang East Road, Binhu District, Wuxi City, Jiangsu Province

Patentee before: JIANGSU LANCHUANG INTELLIGENT TECHNOLOGY Co.,Ltd.

CP02 Change in the address of a patent holder