CN105954301A - Bottleneck quality detection method based on machine vision - Google Patents

Bottleneck quality detection method based on machine vision Download PDF

Info

Publication number
CN105954301A
CN105954301A CN201610464135.2A CN201610464135A CN105954301A CN 105954301 A CN105954301 A CN 105954301A CN 201610464135 A CN201610464135 A CN 201610464135A CN 105954301 A CN105954301 A CN 105954301A
Authority
CN
China
Prior art keywords
ring
center
detected
image
outer ring
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
CN201610464135.2A
Other languages
Chinese (zh)
Other versions
CN105954301B (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.)
Institute of Intelligent Manufacturing of Guangdong Academy of Sciences
Original Assignee
Guangdong Institute of Intelligent Manufacturing
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 Guangdong Institute of Intelligent Manufacturing filed Critical Guangdong Institute of Intelligent Manufacturing
Priority to CN201610464135.2A priority Critical patent/CN105954301B/en
Publication of CN105954301A publication Critical patent/CN105954301A/en
Application granted granted Critical
Publication of CN105954301B publication Critical patent/CN105954301B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • G01N21/958Inspecting transparent materials or objects, e.g. windscreens

Landscapes

  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • General Health & Medical Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Image Analysis (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

本发明公开了一种基于机器视觉的瓶口质量检测方法,包括如下步骤:采集待检测瓶口的图像,并转化为灰度图;计算灰度图的每一个像素点的梯度矢量,得到待检测瓶口灰度图的边缘图像;根据灰度值阈值范围把边缘分割出来;利用面积作为特征来分割待检测瓶口的内环和外环;分别计算内环和外环圆心坐标及半径,把圆心坐标求平均值得到待检测瓶口的圆心坐标,根据外环和内环半径设定半径取值范围;根据待检测瓶口圆心坐标以及半径取值范围得到圆的参数方程,根据圆的参数方程对圆环进行圆周扫描,计算平均灰度值,画平均灰度值曲线;对平均灰度值曲线进行分析,圆环的变化范围在一定范围内,则判定圆环不存在破损,本发明提高了瓶口质量检测效率。

The invention discloses a machine vision-based bottle mouth quality inspection method, comprising the following steps: collecting the image of the bottle mouth to be inspected and converting it into a grayscale image; calculating the gradient vector of each pixel in the grayscale image to obtain the Detect the edge image of the bottle mouth grayscale image; segment the edge according to the gray value threshold range; use the area as a feature to segment the inner and outer rings of the bottle mouth to be detected; calculate the center coordinates and radii of the inner and outer rings respectively, Calculate the average value of the center coordinates to obtain the center coordinates of the bottle mouth to be detected, and set the radius value range according to the outer and inner ring radii; obtain the parameter equation of the circle according to the center coordinates of the bottle mouth to be detected and the radius value range, The parametric equation scans the ring circularly, calculates the average gray value, and draws the average gray value curve; analyzes the average gray value curve, and if the change range of the ring is within a certain range, it is determined that the ring is not damaged. The invention improves the efficiency of bottle mouth quality detection.

Description

一种基于机器视觉的瓶口质量检测方法A method of bottle mouth quality inspection based on machine vision

技术领域technical field

本发明涉及质量检测技术领域,具体涉及一种基于机器视觉的瓶口质量检测方法。The invention relates to the technical field of quality detection, in particular to a machine vision-based bottle finish quality detection method.

背景技术Background technique

酒类、饮料、医药、食品等制造行业在生产中大量采用了灌装生产线,并且大都使用玻璃瓶作为产品的包装。但是玻璃瓶由于在生产、运输过程中难免要受到污染和损坏,尤其像啤酒等行业需要使用可回收的玻璃瓶,因而玻璃瓶必须经过清洗、检测等工序,才能进入灌装工序。为了克服异物和损坏所带来的危害,必须对灌装前的玻璃瓶进行细致的检测,行业中称为实瓶检测。这种检测通常是在暗室中在灯光下由人工进行的。Wine, beverage, medicine, food and other manufacturing industries have adopted a large number of filling production lines in production, and most of them use glass bottles as product packaging. However, glass bottles are inevitably polluted and damaged during production and transportation, especially in industries such as beer that need to use recyclable glass bottles. Therefore, glass bottles must go through cleaning, testing and other processes before entering the filling process. In order to overcome the harm caused by foreign matter and damage, it is necessary to carry out meticulous inspection on the glass bottle before filling, which is called full bottle inspection in the industry. This detection is usually performed manually in a dark room under light.

视觉检测机器人主要是利用机器视觉的理论和技术,来对灌装生产线上空瓶质量进行检测。机器视觉作为一门综合性的前沿学科,近年来得到人们广泛关注,是研究热点之一,对其的研究和应用都相当活跃。The visual detection robot mainly uses the theory and technology of machine vision to detect the quality of empty bottles on the filling production line. As a comprehensive frontier subject, machine vision has attracted widespread attention in recent years, and it is one of the research hotspots, and its research and application are quite active.

现有的瓶口检测只能靠人工检测,不仅效率低,而且精度低,严重影响生产线效率。Existing bottleneck detection can only rely on manual detection, which not only has low efficiency, but also has low precision, which seriously affects the efficiency of the production line.

发明内容Contents of the invention

有鉴于此,本发明的目的在于克服现有技术的上述缺陷,提供一种基于机器视觉的瓶口质量检测方法,解决了以往依靠人工检测精度和效率低的问题,提高了国内制造业检测的技术含量。In view of this, the purpose of the present invention is to overcome the above-mentioned defects of the prior art, provide a kind of bottle mouth quality detection method based on machine vision, solve the problem of relying on manual detection accuracy and low efficiency in the past, and improve the detection efficiency of the domestic manufacturing industry. technical content.

本发明通过以下技术手段解决上述问题:The present invention solves the above problems by the following technical means:

一种基于机器视觉的瓶口质量检测方法,包括如下步骤:A method for detecting the quality of bottle finish based on machine vision, comprising the steps of:

S1、采集待检测瓶口的图像,并转化为灰度图;S1. Collect the image of the bottle mouth to be detected and convert it into a grayscale image;

S2、利用Sobel边缘检测算子计算灰度图的每一个像素点的梯度矢量,得到待检测瓶口灰度图的边缘图像;S2, using the Sobel edge detection operator to calculate the gradient vector of each pixel of the grayscale image, to obtain the edge image of the grayscale image of the bottle mouth to be detected;

S3、设定灰度值阈值范围,根据灰度值阈值范围把边缘分割出来;S3, setting the threshold range of the gray value, and segmenting the edges according to the threshold range of the gray value;

S4、根据分割后的区域,利用面积作为特征来分割待检测瓶口的内环和外环;S4, according to the segmented area, use the area as a feature to segment the inner ring and outer ring of the bottle mouth to be detected;

S5、利用重心法分别计算内环和外环圆心坐标及半径,把外环和内环的圆心坐标求平均值,得到待检测瓶口的圆心坐标,根据外环和内环半径设定半径取值范围;S5. Use the center of gravity method to calculate the center coordinates and radii of the inner ring and the outer ring respectively, average the center coordinates of the outer ring and the inner ring to obtain the center coordinates of the bottle mouth to be detected, and set the radius according to the radius of the outer ring and the inner ring. range of values;

S6、根据待检测瓶口圆心坐标以及半径取值范围得到圆的参数方程,根据圆的参数方程对圆环进行圆周扫描,计算平均灰度值,画平均灰度值曲线;S6. Obtain the parametric equation of the circle according to the coordinates of the center of the bottle mouth to be detected and the value range of the radius, scan the circle according to the parametric equation of the circle, calculate the average gray value, and draw the average gray value curve;

S7、对平均灰度值曲线进行分析,圆环的变化范围在一定范围内,则判定圆环不存在破损,否则,判定圆环存在破损,列为不及格产品。S7. Analyze the average gray value curve. If the variation range of the ring is within a certain range, it is determined that the ring is not damaged; otherwise, it is determined that the ring is damaged, and it is classified as an unqualified product.

进一步地,步骤S1中,利用照明检测系统采集待检测瓶口的图像,所述照明检测系统包括待检测瓶口、LED光源、挡板、CCD工业相机,所述挡板对应于待检测瓶口处有一开口,LED光源将光照射到待检测瓶口,经反射通过开口进入CCD工业相机,得到待检测瓶口的图像。Further, in step S1, the image of the bottle mouth to be detected is collected by using the lighting detection system. The lighting detection system includes the bottle mouth to be detected, an LED light source, a baffle, and a CCD industrial camera, and the baffle corresponds to the bottle mouth to be detected. There is an opening at the center, and the LED light source irradiates the light to the mouth of the bottle to be inspected. After reflection, it enters the CCD industrial camera through the opening to obtain the image of the mouth of the bottle to be inspected.

进一步地,步骤S2中,利用Sobel边缘检测算子计算灰度图的每一个像素点的梯度矢量具体方法如下:Further, in step S2, the specific method of calculating the gradient vector of each pixel of the grayscale image using the Sobel edge detection operator is as follows:

Sobel边缘检测算子包含两组3*3的矩阵,分别为横向卷积因子及纵向卷积因子 The Sobel edge detection operator contains two sets of 3*3 matrices, which are horizontal convolution factors and vertical convolution factor

以A代表原始图像,Gx及Gy分别代表经横向及纵向边缘检测的图像灰度值,其公式如下:Let A represent the original image, Gx and Gy represent the gray value of the image detected by horizontal and vertical edges respectively, and the formula is as follows:

GG xx == -- 11 00 ++ 11 -- 22 00 ++ 22 -- 11 00 ++ 11 ** AA

GG ythe y == ++ 11 ++ 22 ++ 11 00 00 00 -- 11 -- 22 -- 11 ** AA

图像的每一个像素点的梯度值大小通过以下公式计算: The gradient value of each pixel of the image is calculated by the following formula:

其中,为了提高效率使用不开平方的近似值:Among them, an approximation without the square root is used for efficiency:

|G|=|Gx|+|Gy|,|G| = |G x | + |G y |,

用以下公式计算梯度方向:Calculate the gradient direction with the following formula:

θθ == aa rr cc tt aa nno GG ythe y GG xx

如果以上的角度θ等于零,即代表图像该点处拥有纵向边缘,左方较右方暗。If the above angle θ is equal to zero, it means that the image has a vertical edge at this point, and the left side is darker than the right side.

进一步地,步骤S3中,所述灰度值阈值范围为(25,255)。Further, in step S3, the gray value threshold range is (25, 255).

进一步地,步骤S4中,设定一个阈值,如果面积大于阈值的视为待检测瓶口出现裂纹,直接判断为不及格。Further, in step S4, a threshold is set, and if the area is greater than the threshold, it is considered that there is a crack at the mouth of the bottle to be inspected, and it is directly judged as a failure.

进一步地,所述阈值为60000。Further, the threshold is 60000.

进一步地,步骤S5中,具体过程如下:Further, in step S5, the specific process is as follows:

计算外环外接最小矩形得到外环上、下、左、右四个点的坐标,然后通过重心法计算中点即外环圆心坐标:Calculate the smallest rectangle circumscribed by the outer ring to obtain the coordinates of the four points above, below, left, and right on the outer ring, and then calculate the midpoint, which is the coordinates of the center of the outer ring, by the center of gravity method:

外环半径计算公式:The formula for calculating the radius of the outer ring:

其中,x2为外环右边点的横坐标,x1为外环左边点的横坐标,y2为外环下边点的纵坐标,y1为外环上边点的纵坐标;Wherein, x 2 is the abscissa of the right point of the outer ring, x 1 is the abscissa of the left point of the outer ring, y 2 is the ordinate of the lower edge of the outer ring, and y 1 is the ordinate of the upper edge of the outer ring;

按照上述方法同理可得内环圆心坐标:(centerX(内),centerY(内))及内环半径RAccording to the above method, the coordinates of the center of the inner ring can be obtained in the same way: (center X (inner) , center Y (inner) ) and inner ring radius R;

把外环和内环的圆心坐标求平均值,得到待检测瓶口的圆心坐标:(centerX,centerY);Calculate the average value of the center coordinates of the outer ring and the inner ring to obtain the center coordinates of the bottle mouth to be detected: (center X , center Y );

根据外环和内环半径设定半径取值范围为R。Set the radius value range as R according to the outer and inner ring radii.

进一步地,步骤S6中,圆的参数方程为:Further, in step S6, the parametric equation of the circle is:

xx == centercenter Xx ++ RR ** coscos ψψ ythe y == centercenter YY -- RR ** sinsin ψψ

其中,R为[R–3,R+3],圆心角ψ为[0,360°];Among them, R is [R inner –3, R outer +3], and the central angle ψ is [0,360°];

I(x,y)为圆环(x,y)坐标点对应的灰度值,则:I(x,y) is the gray value corresponding to the coordinate point of the ring (x,y), then:

meanI为平均灰度值。mean I is the average gray value.

进一步地,步骤S7中,圆环的变化范围在40个像素点以内,则判定圆环不存在破损。Further, in step S7, if the variation range of the ring is within 40 pixels, it is determined that the ring is not damaged.

本发明的基于机器视觉的瓶口质量检测方法解决了以往依靠人工检测精度和效率低的问题,提高了国内制造业检测的技术含量。同时,该方法的成功实行对工业机器人手眼系统、物流运输业、包装业、光学检测与加工等领域具有很好的应用前景。The bottle mouth quality detection method based on machine vision of the present invention solves the problems of low accuracy and efficiency of relying on manual detection in the past, and improves the technical content of detection in the domestic manufacturing industry. At the same time, the successful implementation of this method has good application prospects in the fields of industrial robot hand-eye system, logistics transportation, packaging industry, optical detection and processing.

附图说明Description of drawings

图1为本发明基于机器视觉的瓶口质量检测方法的流程图;Fig. 1 is the flowchart of the bottleneck quality detection method based on machine vision of the present invention;

图2为本发明的基于机器视觉的瓶口质量检测方法所采用的照明检测系统结构示意图;Fig. 2 is the structural representation of the lighting detection system adopted in the bottle finish quality detection method based on machine vision of the present invention;

图3为本发明的实施例中采用图2所采集的瓶口灰度图;Fig. 3 adopts the grayscale image of the bottle mouth collected in Fig. 2 in the embodiment of the present invention;

图4为图3中每幅瓶口灰度图对应的平均灰度曲线图。FIG. 4 is an average grayscale graph corresponding to each bottle mouth grayscale image in FIG. 3 .

具体实施方式detailed description

为使本发明的上述目的、特征和优点能够更加明显易懂,下面将结合附图和具体的实施例对本发明的技术方案进行详细说明。需要指出的是,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例,基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the above objects, features and advantages of the present invention more comprehensible, the technical solutions of the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be pointed out that the described embodiments are only a part of the embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all those skilled in the art can obtain all without creative work. Other embodiments all belong to the protection scope of the present invention.

如图1所示,一种基于机器视觉的瓶口质量检测方法,包括如下步骤:As shown in Figure 1, a machine vision-based bottle mouth quality detection method includes the following steps:

S1、采集待检测瓶口的图像,并转化为灰度图;S1. Collect the image of the bottle mouth to be detected and convert it into a grayscale image;

如图2所示,利用照明检测系统采集待检测瓶口的图像,所述照明检测系统包括待检测瓶口、LED光源、挡板、CCD工业相机,所述挡板对应于待检测瓶口处有一开口,LED光源将光照射到待检测瓶口,经反射通过开口进入CCD工业相机,得到待检测瓶口的图像,并转化为灰度图,如图3所示。As shown in Figure 2, the image of the bottle mouth to be detected is collected using the lighting detection system. There is an opening, and the LED light source irradiates the light to the mouth of the bottle to be inspected. After reflection, it enters the CCD industrial camera through the opening, and the image of the mouth of the bottle to be inspected is obtained and converted into a grayscale image, as shown in Figure 3.

S2、利用Sobel边缘检测算子计算灰度图的每一个像素点的梯度矢量,得到待检测瓶口灰度图的边缘图像;S2, using the Sobel edge detection operator to calculate the gradient vector of each pixel of the grayscale image, to obtain the edge image of the grayscale image of the bottle mouth to be detected;

在技术上,它是一离散性差分算子,用来运算图像亮度函数的灰度之近似值。在图像的任何一点使用此算子,将会产生对应的灰度矢量或是其法矢量;Technically, it is a discrete difference operator, which is used to calculate the approximate value of the gray level of the image brightness function. Using this operator at any point of the image will generate the corresponding grayscale vector or its normal vector;

Sobel边缘检测算子包含两组3*3的矩阵,分别为横向卷积因子及纵向卷积因子将之与图像作平面卷积,即可分别得出横向及纵向的亮度差分近似值;The Sobel edge detection operator contains two sets of 3*3 matrices, which are horizontal convolution factors and vertical convolution factor Convolve it with the image plane to obtain the approximate value of the horizontal and vertical brightness difference respectively;

如果以A代表原始图像,Gx及Gy分别代表经横向及纵向边缘检测的图像灰度值,其公式如下:If A represents the original image, Gx and Gy represent the gray value of the image detected by horizontal and vertical edges respectively, the formula is as follows:

GG xx == -- 11 00 ++ 11 -- 22 00 ++ 22 -- 11 00 ++ 11 ** AA

GG ythe y == ++ 11 ++ 22 ++ 11 00 00 00 -- 11 -- 22 -- 11 ** AA

图像的每一个像素点的梯度值通过以下公式计算:通常,为了提高效率使用不开平方的近似值:The gradient value of each pixel of the image is calculated by the following formula: Usually, an approximation without the square root is used for efficiency:

|G|=|Gx+Gy|,|G|=|G x +G y |,

然后可用以下公式计算梯度方向:The gradient direction can then be calculated using the following formula:

θθ == aa rr cc tt aa nno GG ythe y GG xx

如果以上的角度θ等于零,即代表图像该处拥有纵向边缘,左方较右方暗。If the above angle θ is equal to zero, it means that the image has a vertical edge, and the left side is darker than the right side.

S3、设定灰度值阈值范围,根据灰度值阈值范围把边缘分割出来;S3, setting the threshold range of the gray value, and segmenting the edges according to the threshold range of the gray value;

所述灰度值阈值范围为(25,255)。The gray value threshold range is (25, 255).

S4、根据分割后的区域,利用面积作为特征来分割待检测瓶口的内环和外环;S4, according to the segmented area, use the area as a feature to segment the inner ring and outer ring of the bottle mouth to be detected;

根据分割后的区域,利用面积作为特征来分割瓶口的内环和外环。一般来说,同一批瓶子在相同的照明检测系统下,圆环面积是有固定范围的,即边缘的面积也是有固定范围的。当瓶口出现裂纹时,边缘分割后的内环和外环会连在一起,从图3中的b可以看出;这里可以设定一个阈值判断,如果面积大于阈值的视为出现裂纹的情况,可以直接判断为不及格,根据实验数据,这里设定面积阈值为60000。According to the segmented area, the area is used as a feature to segment the inner and outer rings of the bottle mouth. Generally speaking, under the same lighting detection system for the same batch of bottles, the area of the ring has a fixed range, that is, the area of the edge also has a fixed range. When there is a crack at the mouth of the bottle, the inner ring and the outer ring after edge segmentation will be connected together, as can be seen from b in Figure 3; here you can set a threshold to judge, if the area is greater than the threshold, it will be regarded as a crack , can be directly judged as failing. According to the experimental data, the area threshold is set to 60000 here.

S5、利用重心法分别计算内环和外环圆心坐标及半径,把外环和内环的圆心坐标求平均值,得到待检测瓶口的圆心坐标,根据外环和内环半径设定半径取值范围;S5. Use the center of gravity method to calculate the center coordinates and radii of the inner ring and the outer ring respectively, average the center coordinates of the outer ring and the inner ring to obtain the center coordinates of the bottle mouth to be detected, and set the radius according to the radius of the outer ring and the inner ring. range of values;

提取圆环边缘后,计算外环外接最小矩形得到外环上、下、左、右四个点的坐标,然后通过重心法计算中点即外环圆心坐标:After extracting the edge of the ring, calculate the smallest rectangle circumscribing the outer ring to obtain the coordinates of the upper, lower, left, and right points of the outer ring, and then use the center of gravity method to calculate the midpoint, which is the coordinates of the center of the outer ring:

外环半径计算公式:The formula for calculating the radius of the outer ring:

其中,x2为外环右边点的横坐标,x1为外环左边点的横坐标,y2为外环下边点的纵坐标,y1为外环上边点的纵坐标;Wherein, x 2 is the abscissa of the right point of the outer ring, x 1 is the abscissa of the left point of the outer ring, y 2 is the ordinate of the lower edge of the outer ring, and y 1 is the ordinate of the upper edge of the outer ring;

按照上述方法同理可得内环圆心坐标:(centerX(内),centerY(内))及内环半径RAccording to the above method, the coordinates of the center of the inner ring can be obtained in the same way: (center X (inner) , center Y (inner) ) and inner ring radius R;

把外环和内环的圆心坐标求平均值,得到待检测瓶口的圆心坐标:(centerX,centerY);Calculate the average value of the center coordinates of the outer ring and the inner ring to obtain the center coordinates of the bottle mouth to be detected: (center X , center Y );

根据外环和内环半径设定半径取值范围为R。Set the radius value range as R according to the outer and inner ring radii.

S6、根据待检测瓶口圆心坐标以及半径取值范围得到圆的参数方程,根据圆的参数方程对圆环进行圆周扫描,计算平均灰度值,画平均灰度值曲线;S6. Obtain the parametric equation of the circle according to the coordinates of the center of the bottle mouth to be detected and the value range of the radius, scan the circle according to the parametric equation of the circle, calculate the average gray value, and draw the average gray value curve;

由于瓶口图像可以大致看成一个标准的圆环,根据圆的参数方程对该圆环进行圆周扫描,计算平均灰度值,画平均灰度值曲线,如图4所示,Since the image of the bottle mouth can be roughly regarded as a standard ring, the circle is scanned according to the parameter equation of the circle, the average gray value is calculated, and the average gray value curve is drawn, as shown in Figure 4.

圆的参数方程为:The parametric equation of a circle is:

xx == centercenter Xx ++ RR ** coscos ψψ ythe y == centercenter YY -- RR ** sinsin ψψ

其中,R为(R–3,R+3),圆心角ψ为(0,360°);Among them, R is (R inside –3, R outside +3), and the central angle ψ is (0,360°);

I(x,y)为圆环(x,y)坐标点对应的灰度值,则:I(x,y) is the gray value corresponding to the coordinate point of the ring (x,y), then:

meanI为平均灰度值。mean I is the average gray value.

S7、对平均灰度值曲线进行分析,圆环的变化范围在一定范围内,则判定圆环不存在破损,否则,判定圆环存在破损,列为不及格产品。S7. Analyze the average gray value curve. If the variation range of the ring is within a certain range, it is determined that the ring is not damaged; otherwise, it is determined that the ring is damaged, and it is classified as an unqualified product.

圆环的变化范围在40个像素点以内,则判定圆环不存在破损。If the variation range of the ring is within 40 pixels, it is determined that the ring is not damaged.

图3中的a是标准的圆环图,从它的平均灰度曲线图图4中的a可以看出,它的变化范围是16个像素点,为及格产品;而其余4幅圆环图的变化范围都较大,可知那几幅图的圆环都存在破损,因此对应的瓶口可列为不及格产品。A in Figure 3 is a standard donut diagram. It can be seen from its average grayscale curve in Fig. 4 a that its variation range is 16 pixels, which is a qualified product; while the other four donut diagrams The range of change is relatively large. It can be seen that the rings in those pictures are all damaged, so the corresponding bottle mouths can be listed as unqualified products.

本发明的基于机器视觉的瓶口质量检测方法解决了以往依靠人工检测精度和效率低的问题,提高了国内制造业检测的技术含量。同时,该方法的成功实行对工业机器人手眼系统、物流运输业、包装业、光学检测与加工等领域具有很好的应用前景。The bottle mouth quality detection method based on machine vision of the present invention solves the problems of low accuracy and efficiency of relying on manual detection in the past, and improves the technical content of detection in the domestic manufacturing industry. At the same time, the successful implementation of this method has good application prospects in the fields of industrial robot hand-eye system, logistics transportation, packaging industry, optical detection and processing.

以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but should not be construed as limiting the patent scope of the present invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.

Claims (9)

1.一种基于机器视觉的瓶口质量检测方法,其特征在于,包括如下步骤:1. a bottle finish quality detection method based on machine vision, is characterized in that, comprises the steps: S1、采集待检测瓶口的图像,并转化为灰度图;S1. Collect the image of the bottle mouth to be detected and convert it into a grayscale image; S2、利用Sobel边缘检测算子计算灰度图的每一个像素点的梯度矢量,得到待检测瓶口灰度图的边缘图像;S2, using the Sobel edge detection operator to calculate the gradient vector of each pixel of the grayscale image, to obtain the edge image of the grayscale image of the bottle mouth to be detected; S3、设定灰度值阈值范围,根据灰度值阈值范围把边缘分割出来;S3, setting the threshold range of the gray value, and segmenting the edges according to the threshold range of the gray value; S4、根据分割后的区域,利用面积作为特征来分割待检测瓶口的内环和外环;S4, according to the segmented area, use the area as a feature to segment the inner ring and outer ring of the bottle mouth to be detected; S5、利用重心法分别计算内环和外环圆心坐标及半径,把外环和内环的圆心坐标求平均值,得到待检测瓶口的圆心坐标,根据外环和内环半径设定半径取值范围;S5. Use the center of gravity method to calculate the center coordinates and radii of the inner ring and the outer ring respectively, average the center coordinates of the outer ring and the inner ring to obtain the center coordinates of the bottle mouth to be detected, and set the radius according to the radius of the outer ring and the inner ring. range of values; S6、根据待检测瓶口圆心坐标以及半径取值范围得到圆的参数方程,根据圆的参数方程对圆环进行圆周扫描,计算平均灰度值,画平均灰度值曲线;S6. Obtain the parametric equation of the circle according to the coordinates of the center of the bottle mouth to be detected and the value range of the radius, scan the circle according to the parametric equation of the circle, calculate the average gray value, and draw the average gray value curve; S7、对平均灰度值曲线进行分析,圆环的变化范围在一定范围内,则判定圆环不存在破损,否则,判定圆环存在破损,列为不及格产品。S7. Analyze the average gray value curve. If the variation range of the ring is within a certain range, it is determined that the ring is not damaged; otherwise, it is determined that the ring is damaged, and it is classified as an unqualified product. 2.根据权利要求1所述的基于机器视觉的瓶口质量检测方法,其特征在于,步骤S1中,利用照明检测系统采集待检测瓶口的图像,所述照明检测系统包括待检测瓶口、LED光源、挡板、CCD工业相机,所述挡板对应于待检测瓶口处有一开口,LED光源将光照射到待检测瓶口,经反射通过开口进入CCD工业相机,得到待检测瓶口的图像。2. the bottle finish quality detection method based on machine vision according to claim 1, is characterized in that, in step S1, utilizes the image of the bottle finish to be detected to be collected by an illumination detection system, and said illumination detection system comprises a bottleneck to be detected, LED light source, baffle, and CCD industrial camera, the baffle corresponds to an opening at the mouth of the bottle to be detected, the LED light source irradiates the light to the mouth of the bottle to be detected, and enters the CCD industrial camera through the opening through reflection to obtain the image of the bottle mouth to be detected image. 3.根据权利要求2所述的基于机器视觉的瓶口质量检测方法,其特征在于,步骤S2中,利用Sobel边缘检测算子计算灰度图的每一个像素点的梯度矢量具体方法如下:3. the bottleneck quality detection method based on machine vision according to claim 2, is characterized in that, in step S2, utilizes the gradient vector concrete method of each pixel point of Sobel edge detection operator to calculate gray scale image as follows: Sobel边缘检测算子包含两组3*3的矩阵,分别为横向卷积因子及纵向卷积因子 The Sobel edge detection operator contains two sets of 3*3 matrices, which are horizontal convolution factors and vertical convolution factor 以A代表原始图像,Gx及Gy分别代表经横向及纵向边缘检测的图像灰度值,其公式如下:Let A represent the original image, Gx and Gy represent the gray value of the image detected by horizontal and vertical edges respectively, and the formula is as follows: GG xx == -- 11 00 ++ 11 -- 22 00 ++ 22 -- 11 00 ++ 11 ** AA GG ythe y == ++ 11 ++ 22 ++ 11 00 00 00 -- 11 -- 22 -- 11 ** AA 图像的每一个像素点的灰度值通过以下公式计算: The gray value of each pixel of the image is calculated by the following formula: 其中,为了提高效率使用不开平方的近似值:Among them, an approximation without the square root is used for efficiency: |G|=|Gx+Gy|,|G|=|G x +G y |, 用以下公式计算梯度方向:Calculate the gradient direction with the following formula: θθ == arctanarctan GG ythe y GG xx 如果以上的角度θ等于零,即代表图像该处拥有纵向边缘,左方较右方暗。If the above angle θ is equal to zero, it means that the image has a vertical edge, and the left side is darker than the right side. 4.根据权利要求3所述的基于机器视觉的瓶口质量检测方法,其特征在于,步骤S3中,所述灰度值阈值范围为(25,255)。4. The machine vision-based bottle finish quality detection method according to claim 3, characterized in that, in step S3, the gray value threshold range is (25, 255). 5.根据权利要求4所述的基于机器视觉的瓶口质量检测方法,其特征在于,步骤S4中,设定一个阈值,如果面积大于阈值的视为待检测瓶口出现裂纹,直接判断为不及格。5. the bottleneck quality detection method based on machine vision according to claim 4, is characterized in that, in step S4, set a threshold value, if area is greater than threshold value, it is deemed that there is a crack in the bottleneck to be detected, and it is directly judged as not pass. 6.根据权利要求5所述的基于机器视觉的瓶口质量检测方法,其特征在于,所述阈值为60000。6 . The machine vision-based bottle finish quality detection method according to claim 5 , wherein the threshold is 60,000. 7.根据权利要求6所述的基于机器视觉的瓶口质量检测方法,其特征在于,步骤S5中,具体过程如下:7. the bottleneck quality detection method based on machine vision according to claim 6, is characterized in that, in step S5, concrete process is as follows: 计算外环外接最小矩形得到外环上、下、左、右四个点的坐标,然后通过重心法计算中点即外环圆心坐标:Calculate the smallest rectangle circumscribed by the outer ring to obtain the coordinates of the four points above, below, left, and right on the outer ring, and then calculate the midpoint, which is the coordinates of the center of the outer ring, by the center of gravity method: 外环半径计算公式:The formula for calculating the radius of the outer ring: 其中,x2为外环右边点的横坐标,x1为外环左边点的横坐标,y2为外环下边点的纵坐标,y1为外环上边点的纵坐标;Wherein, x 2 is the abscissa of the right point of the outer ring, x 1 is the abscissa of the left point of the outer ring, y 2 is the ordinate of the lower edge of the outer ring, and y 1 is the ordinate of the upper edge of the outer ring; 按照上述方法同理可得内环圆心坐标:(centerX(内),centerY(内))及内环半径RAccording to the above method, the coordinates of the center of the inner ring can be obtained in the same way: (center X (inner) , center Y (inner) ) and inner ring radius R; 把外环和内环的圆心坐标求平均值,得到待检测瓶口的圆心坐标:(centerX,centerY);Calculate the average value of the center coordinates of the outer ring and the inner ring to obtain the center coordinates of the bottle mouth to be detected: (center X , center Y ); 根据外环和内环半径设定半径取值范围为R。Set the radius value range as R according to the outer and inner ring radii. 8.根据权利要求7所述的基于机器视觉的瓶口质量检测方法,其特征在于,步骤S6中,圆的参数方程为:8. the bottleneck quality detection method based on machine vision according to claim 7, is characterized in that, in step S6, the parametric equation of circle is: xx == centercenter Xx ++ RR ** cc oo sthe s ψψ ythe y == centercenter YY -- RR ** sthe s ii nno ψψ 其中,R为(R–3,R+3),圆心角ψ为(0,360°);Among them, R is (R inside –3, R outside +3), and the central angle ψ is (0,360°); I(x,y)为圆环(x,y)坐标点对应的灰度值,则:I(x,y) is the gray value corresponding to the coordinate point of the ring (x,y), then: meanI为平均灰度值。mean I is the average gray value. 9.根据权利要求8所述的基于机器视觉的瓶口质量检测方法,其特征在于,步骤S7中,圆环的变化范围在40个像素点以内,则判定圆环不存在破损。9. The machine vision-based bottleneck quality detection method according to claim 8, characterized in that, in step S7, if the variation range of the ring is within 40 pixels, it is determined that the ring is not damaged.
CN201610464135.2A 2016-06-22 2016-06-22 A method of bottle mouth quality detection based on machine vision Active CN105954301B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610464135.2A CN105954301B (en) 2016-06-22 2016-06-22 A method of bottle mouth quality detection based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610464135.2A CN105954301B (en) 2016-06-22 2016-06-22 A method of bottle mouth quality detection based on machine vision

Publications (2)

Publication Number Publication Date
CN105954301A true CN105954301A (en) 2016-09-21
CN105954301B CN105954301B (en) 2019-08-06

Family

ID=56903750

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610464135.2A Active CN105954301B (en) 2016-06-22 2016-06-22 A method of bottle mouth quality detection based on machine vision

Country Status (1)

Country Link
CN (1) CN105954301B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106546605A (en) * 2016-10-26 2017-03-29 湖南大学 A kind of medicated beer bottle mouth defect detection method for utilizing 4 circumferential registrations and hysteresis threshold
CN106824816A (en) * 2016-12-20 2017-06-13 浙江工业大学 A kind of PE based on machine vision bottles of detection and method for sorting
CN106841229A (en) * 2016-12-20 2017-06-13 浙江工业大学 A kind of online PE bottles of detection method of bottle sealing defect based on machine vision
CN108876773A (en) * 2018-06-06 2018-11-23 杭州电子科技大学 LED glass lamp cup aperture online test method based on machine vision
CN109406539A (en) * 2018-11-28 2019-03-01 广州番禺职业技术学院 A kind of transparent medicine bottle bottom buildup defect detecting system and method
CN110060239A (en) * 2019-04-02 2019-07-26 广州大学 A kind of defect inspection method for bottle bottleneck
CN110132974A (en) * 2018-02-08 2019-08-16 克朗斯股份公司 Monitoring method of bottle unit and bottle washing machine
CN110431405A (en) * 2017-02-06 2019-11-08 东洋玻璃株式会社 Inspection device for glass bottles
CN113532320A (en) * 2021-07-20 2021-10-22 武汉华工激光工程有限责任公司 Image-based light spot diffraction ring analysis method, storage medium and chip
CN115018849A (en) * 2022-08-09 2022-09-06 江苏万容机械科技有限公司 Bottle body askew cover identification method based on edge detection
CN116625262A (en) * 2023-04-12 2023-08-22 天津科技大学 A machine vision-based monitoring system and method for bridge pier deformation

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102519973A (en) * 2011-12-10 2012-06-27 山东明佳包装检测科技有限公司 Method for detecting lip defect of PET bottle or bottle parison
CN103729632A (en) * 2014-01-22 2014-04-16 哈尔滨工业大学 Round Mark point positioning method based on connected region filtering
CN105334219A (en) * 2015-09-16 2016-02-17 湖南大学 Bottleneck defect detection method adopting residual analysis and dynamic threshold segmentation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102519973A (en) * 2011-12-10 2012-06-27 山东明佳包装检测科技有限公司 Method for detecting lip defect of PET bottle or bottle parison
CN103729632A (en) * 2014-01-22 2014-04-16 哈尔滨工业大学 Round Mark point positioning method based on connected region filtering
CN105334219A (en) * 2015-09-16 2016-02-17 湖南大学 Bottleneck defect detection method adopting residual analysis and dynamic threshold segmentation

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
张田田: "基于机器视觉的啤酒瓶瓶口检测系统的研究", 《中国优秀硕士学位论文全文数据库》 *
黄韶杰: "基于灰度阈值法的煤岩界面识别研究", 《工矿自动化》 *
龚金云,全思博: "基于灰度图像直方图的边缘检测", 《制备制造技术》 *

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106546605A (en) * 2016-10-26 2017-03-29 湖南大学 A kind of medicated beer bottle mouth defect detection method for utilizing 4 circumferential registrations and hysteresis threshold
CN106546605B (en) * 2016-10-26 2019-07-16 湖南大学 A beer bottle mouth defect detection method using 4-circle positioning and hysteresis threshold
CN106824816A (en) * 2016-12-20 2017-06-13 浙江工业大学 A kind of PE based on machine vision bottles of detection and method for sorting
CN106841229A (en) * 2016-12-20 2017-06-13 浙江工业大学 A kind of online PE bottles of detection method of bottle sealing defect based on machine vision
CN106824816B (en) * 2016-12-20 2019-11-05 浙江工业大学 A kind of detection of PE bottle and method for sorting based on machine vision
CN110431405A (en) * 2017-02-06 2019-11-08 东洋玻璃株式会社 Inspection device for glass bottles
CN110132974A (en) * 2018-02-08 2019-08-16 克朗斯股份公司 Monitoring method of bottle unit and bottle washing machine
CN108876773A (en) * 2018-06-06 2018-11-23 杭州电子科技大学 LED glass lamp cup aperture online test method based on machine vision
CN109406539A (en) * 2018-11-28 2019-03-01 广州番禺职业技术学院 A kind of transparent medicine bottle bottom buildup defect detecting system and method
CN109406539B (en) * 2018-11-28 2024-04-09 广州番禺职业技术学院 A system and method for detecting material accumulation defects at the bottom of a transparent medicine bottle
CN110060239A (en) * 2019-04-02 2019-07-26 广州大学 A kind of defect inspection method for bottle bottleneck
CN113532320A (en) * 2021-07-20 2021-10-22 武汉华工激光工程有限责任公司 Image-based light spot diffraction ring analysis method, storage medium and chip
CN115018849A (en) * 2022-08-09 2022-09-06 江苏万容机械科技有限公司 Bottle body askew cover identification method based on edge detection
CN115018849B (en) * 2022-08-09 2022-11-08 江苏万容机械科技有限公司 Bottle body cover-tilting identification method based on edge detection
CN116625262A (en) * 2023-04-12 2023-08-22 天津科技大学 A machine vision-based monitoring system and method for bridge pier deformation

Also Published As

Publication number Publication date
CN105954301B (en) 2019-08-06

Similar Documents

Publication Publication Date Title
CN105954301B (en) A method of bottle mouth quality detection based on machine vision
CN105334219B (en) A kind of bottle mouth defect detection method of residual analysis dynamic threshold segmentation
CN106370659B (en) A kind of bottle body package quality visible detection method
CN102162797B (en) Algorithm for detecting glass bottle neck damage and bottle bottom dirt
CN108465648A (en) A kind of magnetic core Automated Sorting System based on machine vision
CN103698337B (en) A kind of adhesion defect of label of flat wine bottle automatic testing method
CN104118609B (en) Labeling quality determining method and device
CN103063137B (en) A kind of medicine bottle measuring system based on machine vision and measuring method thereof
CN105403147A (en) Embedded bottle pre-form detection system and detection method
CN110108712A (en) Multifunctional visual defect detection system
CN105157563A (en) Beer bottleneck positioning method based on visual sense of machine
CN105158268A (en) Intelligent online detection method, system and device for defects of fine-blanked parts
CN108550138A (en) Refractory brick surface scratch recognition methods based on frequency filtering enhancing
CN115311294A (en) Glass bottle body flaw identification and detection method based on image processing
CN104952754B (en) Sorting method of coated silicon wafers based on machine vision
CN115752969A (en) Method, system and equipment for detecting sealing performance of aluminum foil seal
CN110060239B (en) A kind of defect detection method for bottle mouth
US12480886B2 (en) Curved substrate bubble detection method and detection system
Sanver et al. An image processing application to detect faulty bottle packaging
Farhangi et al. Machine vision for detecting defects in liquid bottles: An industrial application for food and packaging sector
CN106546605B (en) A beer bottle mouth defect detection method using 4-circle positioning and hysteresis threshold
CN105004323B (en) A kind of cap like wine bottle cap rotation angle measurement based on machine vision and modification method
CN116051531A (en) Intelligent detection method for injection molding object
Xu et al. Research on real-time quality inspection of PET bottle caps
CN108171691B (en) Detection method of plastic container

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510000 building 15, 100 Hall of martyrs Road, Guangzhou, Guangdong

Applicant after: GUANGDONG INSTITUTE OF INTELLIGENT MANUFACTURING

Address before: 510000 building 13, 100 martyrs Road, Yuexiu District, Guangzhou, Guangdong.

Applicant before: Guangdong Institute of Automation

GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Wei Qianzhou

Inventor after: Ling Xiang

Inventor after: Liu Zhi

Inventor after: Lin Libin

Inventor after: Zhang Yu

Inventor before: Zhang Yu

Inventor before: Wei Qianzhou

CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 510000 building 15, 100 Hall of martyrs Road, Guangzhou, Guangdong

Patentee after: Institute of intelligent manufacturing, Guangdong Academy of Sciences

Address before: 510000 building 15, 100 Hall of martyrs Road, Guangzhou, Guangdong

Patentee before: GUANGDONG INSTITUTE OF INTELLIGENT MANUFACTURING