Method for detecting out-of-roundness and concave-convex defects of glass bottle body

CN119737887AInactive Publication Date: 2025-04-01FOSHAN SANLI INTELLIGENT EQUIPMENT TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411902504.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

[0005]为了克服现有技术存在的缺陷,本发明提供一种玻璃瓶瓶身不圆度及凹凸缺陷的检测方法,以解决上述的问题

Benefits of technology

图1为本发明的一个实施例中玻璃瓶瓶身不圆度及凹凸缺陷的检测方法的流程图;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119737887A_ABST
    Figure CN119737887A_ABST
Patent Text Reader

Abstract

The invention discloses a method for detecting out-of-roundness and concave-convex defects of a glass bottle body, which belongs to the technical field of glass bottle defect detection and comprises the following steps: acquiring a picture of a standard glass bottle; setting an out-of-roundness detection area during detection by using the picture of the standard glass bottle; setting a bottle body edge concave-convex detection area during detection by using a picture of the standard glass bottle; detecting the out-of-roundness of the bottle body of the target glass bottle according to the out-of-roundness detection area, and detecting the edge depression defect of the bottle body of the target glass bottle according to the bottle body edge concave-convex detection area. The method for detecting the out-of-roundness and concave-convex defects of the bottle body of the glass bottle solves the problems that defective products are difficult to reduce and the quality of products is reduced due to the fact that deformation of the glass bottle produced by an existing production line is difficult to distinguish and recognize by naked eyes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of glass bottle defect detection, and in particular to a method for detecting out-of-roundness and concave-convex defects of a glass bottle body. Background Art

[0002] With the continuous growth of the glass bottle market and production scale, end customers have higher and higher requirements for the quality of glass bottle production. The current ever-increasing production speed and intelligent assembly line operations have put forward higher requirements on traditional quality inspection processes.

[0003] During the forming process of glass bottles, uneven cooling of the bottle body may cause the cross-section of the bottle body to change from a round shape to an elliptical or concave-convex shape. The deformed bottle body has changed its structural characteristics, and the wall thickness and structural strength at different positions will change accordingly, which may cause damage to the bottle body or explosion due to uneven pressure during the canning or transportation process.

[0004] Currently, it is difficult to distinguish and identify deformed glass bottles with the naked eye, and it is impossible to achieve high-precision online measurement with instruments on the production line, making it difficult to reduce defective products and reducing product quality. Summary of the invention

[0005] In order to overcome the defects of the prior art, the present invention provides a method for detecting the out-of-roundness and concave-convex defects of a glass bottle body to solve the above-mentioned problems.

[0006] The technical solution adopted by the present invention to solve the technical problem is: a method for detecting the out-of-roundness and concave-convex defects of a glass bottle body, comprising the following steps: S1: Get a photo of a standard glass bottle; S2: Use the photo of the standard glass bottle to set the out-of-roundness detection area during the inspection; S3: Use the photo of the standard glass bottle to set the convex and concave detection area of ​​the bottle edge during the inspection; S4: detecting the out-of-roundness of the target glass bottle body according to the out-of-roundness detection area, and detecting the edge concave defect of the target glass bottle body according to the bottle edge concave-convex detection area.

[0007] Preferably, in step S1, a standard glass bottle is placed in the image acquisition area, a bottle body image bodyImg_0 corresponding to the standard glass bottle is acquired, and a rectangular frame ROI_Rect is selected in the bottle body image bodyImg_0 as a region of interest to be detected; The rectangular frame ROI_Rect includes the left edge of the bottle body, the right edge of the bottle body and the area of ​​the bottle body that is prone to deformation and needs to be detected; After obtaining the photo of the standard glass bottle, the bottle body image bodyImg_0 is cropped according to the size parameter of the rectangular frame ROI_Rect to obtain the image ROI_Image.

[0008] Optionally, in the step S2, three bottle width detection areas widthCheck_Rect1, widthCheck_Rect2 and widthCheck_Rect3 are drawn in the image ROI_Image; wherein the bottle width detection area widthCheck_Rect1, the bottle width detection area widthCheck_Rect2 and the bottle width detection area widthCheck_Rect3 all include the left edge of the standard glass bottle body and the right edge of the standard glass bottle body, and the parameters of the bottle width detection area widthCheck_Rect1, the bottle width detection area widthCheck_Rect2 and the bottle width detection area widthCheck_Rect3 are applied in defect detection as out-of-roundness detection areas.

[0009] Specifically, in step S3, a left edge detection area EdgeCheck_RectLeft is drawn at the left edge of the image ROI_Image, and a right edge detection area EdgeCheck_RectRight is drawn at the right edge of the image ROI_Image, and the parameters of the left edge detection area EdgeCheck_RectLeft and the right edge detection area EdgeCheck_RectRight are applied in defect detection as bottle body edge convexity detection areas; wherein the left edge detection area EdgeCheck_RectLeft includes the left edge of the standard glass bottle body, and the right edge detection area EdgeCheck_RectRight includes the right edge of the standard glass bottle body.

[0010] It is worth noting that in step S3, the horizontal coordinate value posX_Left of the left edge of the bottle body and the horizontal coordinate value posX_Right of the right edge of the bottle body are calculated in the bottle width detection area widthCheck_Rect1 according to the edge approximation algorithm, and the pixel distance width_Pix=|posX_Right-posX_Left| of the left and right edges is obtained, and then the conversion coefficient rate=distance / width_Pix of the image pixel to the actual size is calculated according to the actual width distance of the bottle.

[0011] Preferably, step S4 comprises the following steps: S41: First, the target glass bottle is rotated at the rotating station. Every time the bottle rotates 6°, a glass bottle image is taken using a camera to obtain 60 glass bottle images. ; where i represents the i-th glass bottle image; then the bottle body image is rectified according to the size parameter of the rectangular frame ROI_Rect Cut to get the image ; S42: Based on the out-of-roundness detection area set in step S2, Get the corresponding bottle width detection area widthCheck_Rect1, image Corresponding bottle width detection area widthCheck_Rect2 and image The corresponding bottle width detection area widthCheck_Rect3; Extracting images using edge approximation algorithms The horizontal coordinate values ​​of the left and right edges of the corresponding bottle width detection area widthCheck_Rect1, the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect2, and the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect3; Then get the image The pixel distance width_Pix1 of the corresponding bottle width detection area widthCheck_Rect1, and the glass bottle image are obtained The pixel distance width_Pix2 of the corresponding bottle width detection area widthCheck_Rect2 and the obtained glass bottle image The pixel distance width_Pix3 of the corresponding bottle width detection area widthCheck_Rect3; Finally, the image The corresponding bottle width detection area widthCheck_Rect1 bottle width real_width1=width_Pix1*rate, get the image The corresponding bottle width detection area widthCheck_Rect2 bottle width real_width2=width_Pix2*rate and the image obtained The corresponding bottle width detection area widthCheck_Rect3 bottle width real_width3 = width_Pix3*rate; where rate is the conversion factor from image pixels to actual size; S43: Based on the detection area of ​​the bottle body edge concave-convex detection set in step S3, the image of the target glass bottle Get the corresponding left edge detection area EdgeCheck_RectLeft and right edge detection area EdgeCheck_RectRight; The left edge detection area EdgeCheck_RectLeft is extracted using the sobel edge extraction algorithm to extract the left edge EdgeLeft of the target glass bottle, and the two ends of the left edge EdgeLeft of the bottle body are connected to obtain the left straight line EdgeLineLeft, and the maximum left deviation pixel distance DisLeft_Pix from the left edge EdgeLeft of the bottle body to the left straight line EdgeLineLeft is calculated, and the maximum left deviation actual distance DisLeft_Actual=DisLeft_Pix*rate is obtained; where rate is the conversion coefficient from image pixels to actual size; The right edge detection area EdgeCheck_RectRight is extracted by using the sobel edge extraction algorithm to extract the right edge EdgeRight of the target glass bottle, and the two end edges of the right edge EdgeRight of the bottle body are connected to obtain the right straight line EdgeLineRight, and the maximum right deviation pixel distance DisRight_Pix from the right edge EdgeRight of the bottle body to the right straight line EdgeLineRight is calculated, and the maximum right deviation actual distance DisRight_Actual=DisRight_Pix*rate is obtained; wherein rate is the conversion coefficient from image pixels to actual size.

[0012] Specifically, the edge approximation algorithm includes the following steps: Divide the bottle width detection area widthCheck_Rect1 into several slice rectangles according to the slice width step; Starting from the left side of the bottle width detection area widthCheck_Rect1, calculate the average grayscale value LGray(i) and the center horizontal coordinate value LposX(i) of the slice rectangle between the left side of the bottle width detection area widthCheck_Rect1 and the horizontal center position of the bottle width detection area widthCheck_Rect1; Take LposX(i) as the coordinate value X of the coordinate point and LGray(i) as the coordinate value Y of the coordinate point, and calculate the first-order derivative of the coordinate point ; Draw a first-order derivative line graph with LposX(i) as the coordinate value X of the coordinate point and LGray(i) as the coordinate value Y of the coordinate point, calculate the extreme point of the first-order derivative line graph, and the LposX(i) corresponding to the extreme point is the horizontal coordinate value posX_Left of the left edge; Starting from the right side of the bottle width detection area widthCheck_Rect1, calculate the average grayscale value RGray(i) and the center horizontal coordinate value RposX(i) of the slice rectangle between the right side of the bottle width detection area widthCheck_Rect1 and the horizontal center position of the bottle width detection area widthCheck_Rect1; Take RposX(i) as the coordinate value X of the coordinate point and RGray(i) as the coordinate value Y of the coordinate point, and calculate the first-order derivative of the coordinate point ; Draw a first-order derivative line graph with RposX(i) as the coordinate value X of the coordinate point and Rf(i) as the coordinate value Y of the coordinate point, calculate the extreme point of the first-order derivative line graph, and RposX(i) corresponding to the extreme point is the horizontal coordinate value posX_Right of the left edge.

[0013] It is worth noting that in step S43, the sobel edge extraction algorithm performs convolution calculation on each pixel on the target image through the sobel convolution factor to obtain a gray gradient, and takes the pixel point corresponding to the gray gradient greater than the set threshold as the edge point of the target image; wherein the target image is the left edge detection area EdgeCheck_RectLeft or the right edge detection area EdgeCheck_RectRight; In step S43, the sobel convolution factor includes a lateral convolution factor and the vertical convolution factor ; Substitute the horizontal convolution factor into the pixel (x, y) of the target image to obtain the horizontal convolution grayscale value of the pixel (x, y) , ; Substitute the vertical convolution factor into the pixel of the target image to obtain the vertical convolution gray value of the pixel , ; Where f(x,y) is the gray value of the pixel (x,y) of the target image; Calculate the gray value of the pixel (x,y) ; Obtain the grayscale image EdgeAmplitude after the target image is subjected to the Sobel transformation, and use threshold segmentation on the grayscale image EdgeAmplitude to extract the edge points of the target image.

[0014] Preferably, the step S4 further comprises the following steps: S44: obtaining the maximum value MaxWidth1 of the bottle width and the minimum value MinWidth1 of the bottle width detection area widthCheck_Rect1, and then calculating the bottle width difference offsetWidth1=MaxWidth1-MinWidth1 corresponding to the bottle width detection area widthCheck_Rect1; Get the maximum value MaxWidth2 of the bottle width in the bottle width detection area widthCheck_Rect2 and the minimum value MinWidth2 of the bottle width, and then calculate the bottle width difference offsetWidth2=MaxWidth2-MinWidth2 corresponding to the bottle width detection area widthCheck_Rect2; Get the maximum value MaxWidth3 of the bottle width in the bottle width detection area widthCheck_Rect3 and the minimum value MinWidth3 of the bottle width, and then calculate the bottle width difference offsetWidth3=MaxWidth3-MinWidth3 corresponding to the bottle width detection area widthCheck_Rect3; S45: performing out-of-roundness judgment, wherein the out-of-roundness judgment includes maximum bottle width judgment, minimum bottle width judgment and bottle width difference judgment; The maximum bottle width determination step is: when the maximum bottle width MaxWidth1 is greater than a preset standard threshold MaxWidthStandard1, the maximum bottle width MaxWidth2 is greater than a preset standard threshold MaxWidthStandard2, or the maximum bottle width MaxWidth3 is greater than a preset standard threshold MaxWidthStandard3, it is determined that the maximum bottle width of the target glass bottle exceeds the standard; The minimum bottle width determination step is as follows: when the minimum bottle width MinWidth1 is greater than a preset standard threshold MinWidthStandard1, the minimum bottle width MinWidth2 is greater than a preset standard threshold MinWidthStandard2, or the minimum bottle width MinWidth3 is greater than a preset standard threshold MinWidthStandard3, it is determined that the minimum bottle width of the target glass bottle exceeds the standard; The bottle width difference judgment step is: when the bottle width difference offsetWidth1 is greater than a preset standard threshold offsetWidthStandard1, the bottle width difference offsetWidth2 is greater than a preset standard threshold offsetWidthStandard2, or the bottle width difference offsetWidth3 is greater than a preset standard threshold offsetWidthStandard3, it is determined that the bottle width difference of the target glass bottle exceeds the standard; When the target glass bottle is determined to have a maximum bottle width that exceeds the standard, a minimum bottle width that exceeds the standard, or a bottle width difference that exceeds the standard during the out-of-roundness judgment process, it means that the out-of-roundness of the target glass bottle body exceeds the standard.

[0015] Optionally, the step S4 further includes the following steps: S46: 60 images of target glass bottles The maximum value among the left maximum deviation actual distance DisLeft_Actual corresponding to the left edge detection area EdgeCheck_RectLeft is selected as the maximum value DisLeft_Max of the left maximum deviation actual distance; 60 images of glass bottles of target glass bottles The maximum value among the right side maximum deviation actual distance DisRight_Actual corresponding to the right edge detection area EdgeCheck_RectRight is selected as the maximum value DisLeft_Max of the right side maximum deviation actual distance; S47: When the maximum value DisLeft_Max of the actual distance of the maximum deviation on the left exceeds the set threshold Left_Standard, it is determined that there is a concave-convex defect on the left edge of the target glass bottle body; when the maximum value DisRight_Max of the actual distance of the maximum deviation on the right exceeds the set threshold Right_Standard, it is determined that there is a concave-convex defect on the right edge of the target glass bottle body.

[0016] The beneficial effect of the present invention is that in the method for detecting the out-of-roundness and concave-convex defects of the glass bottle body, multiple visual images are obtained by rotating the bottle body to extract the edge of the bottle body, and then the width of the bottle body and the defects of the left and right edges of the bottle body are calculated, and finally the out-of-roundness and concave-convex defects of the bottle body are detected online by visual detection, and the out-of-roundness and edge concave-convex defects of the bottle body are detected online, so as to realize high-speed and efficient online detection of bottle body defects, thereby improving production efficiency, reducing the flow of defective products to downstream customers, and improving product quality. Figure 1 It is a flow chart of a method for detecting out-of-roundness and concave-convex defects of a glass bottle body in one embodiment of the present invention; Figure 2 is a schematic diagram of a bottle body image bodyImg_0 in one embodiment of the present invention; Figure 3 is a schematic diagram of a left edge detection area EdgeCheck_RectLeft in one embodiment of the present invention; Figure 4 FIG. 4 is a schematic diagram of an edge approximation algorithm in one embodiment of the present invention. DETAILED DESCRIPTION

[0017] The specific embodiments of the present invention are further described below in conjunction with the accompanying drawings. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0018] like Figure 1-4 As shown, a method for detecting the out-of-roundness and concave-convex defects of a glass bottle body comprises the following steps: S1: Obtain a photo of a standard glass bottle; in this embodiment, the standard glass bottle is a glass bottle without out-of-roundness and concave-convex defects on the bottle body; In the step S1, a standard glass bottle is placed in the image acquisition area, a bottle body image bodyImg_0 corresponding to the standard glass bottle is acquired, and a rectangular frame ROI_Rect is selected in the bottle body image bodyImg_0 as a region of interest to be detected; In step S1, the rectangular frame ROI_Rect includes the left edge of the bottle body, the right edge of the bottle body and the area where the bottle body is prone to deformation and needs to be detected; in this embodiment, the glass bottle is standing on a horizontal plane, the left edge of the bottle body is located on the left side of the glass bottle at this time, and the right edge of the bottle body is located on the right side of the glass bottle at this time. According to the production data statistics, the position where the deformation rate is higher than the set threshold is taken as the area where the bottle body is prone to deformation and needs to be detected; After obtaining the photo of the standard glass bottle in step S1, the bottle body image bodyImg_0 is cropped according to the size parameter of the rectangular frame ROI_Rect to obtain the image ROI_Image; S2: Use the photo of the standard glass bottle to set the out-of-roundness detection area during the inspection; like Figure 2As shown, in the step S2, three bottle width detection areas widthCheck_Rect1, widthCheck_Rect2 and widthCheck_Rect3 are drawn in the image ROI_Image; wherein the bottle width detection area widthCheck_Rect1, the bottle width detection area widthCheck_Rect2 and the bottle width detection area widthCheck_Rect3 all include the left edge of the standard glass bottle body and the right edge of the standard glass bottle body, and the parameters of the bottle width detection area widthCheck_Rect1, the bottle width detection area widthCheck_Rect2 and the bottle width detection area widthCheck_Rect3 are applied in defect detection as out-of-roundness detection areas; in this embodiment, the width of the bottle width detection area is in the interval [20,30], and the unit is pixel, and the three bottle width detection areas are evenly distributed in order from top to bottom to improve the reasonable distribution of the detection results. Since this detection method is based on the same glass bottle for detection, after marking the parameters of the bottle width detection area widthCheck_Rect1, bottle width detection area widthCheck_Rect2 and bottle width detection area widthCheck_Rect3 in the image ROI_Image corresponding to the standard quasi-glass bottle body, it can be applied to the glass bottles that need to be detected next, thereby improving the efficiency of obtaining the bottle width detection area widthCheck_Rect1, bottle width detection area widthCheck_Rect2 and bottle width detection area widthCheck_Rect3.

[0019] S3: Use the photo of the standard glass bottle to set the convex and concave detection area of ​​the bottle edge during the inspection; In the step S3, a left edge detection area EdgeCheck_RectLeft is drawn at the left edge of the image ROI_Image, and a right edge detection area EdgeCheck_RectRight is drawn at the right edge of the image ROI_Image. The parameters of the left edge detection area EdgeCheck_RectLeft and the right edge detection area EdgeCheck_RectRight are applied in defect detection as the bottle body edge convexity detection area; wherein the left edge detection area EdgeCheck_RectLeft includes the left edge of the glass bottle body, and the right edge detection area EdgeCheck_RectRight includes the right edge of the glass bottle body.

[0020] In step S3, the horizontal coordinate value posX_Left of the left edge of the bottle and the horizontal coordinate value posX_Right of the right edge of the bottle are calculated according to the edge approximation algorithm in the bottle width detection area widthCheck_Rect1 obtained in step S2, and the pixel distance width_Pix=|posX_Right-posX_Left| of the left and right edges is obtained, and then the conversion coefficient rate=distance / width_Pix from the image pixel to the actual size is calculated according to the actual width distance of the bottle, and the unit of rate is mm / pix.

[0021] S4: detecting the out-of-roundness of the target glass bottle body according to the out-of-roundness detection area, and detecting the edge concave defect of the target glass bottle body according to the bottle edge concave-convex detection area.

[0022] The step S4 comprises the following steps: S41: First, the target glass bottle is rotated at the rotating station. Every time the bottle rotates 6°, a glass bottle image is taken using a camera to obtain 60 glass bottle images. ; where i represents the i-th glass bottle image; then the bottle body image is rectified according to the size parameter of the rectangular frame ROI_Rect Cut to get the image ; S42: Based on the out-of-roundness detection area set in step S2, Get the corresponding bottle width detection area widthCheck_Rect1, image Corresponding bottle width detection area widthCheck_Rect2 and image The corresponding bottle width detection area widthCheck_Rect3; Extracting images using edge approximation algorithms The horizontal coordinate values ​​of the left and right edges of the corresponding bottle width detection area widthCheck_Rect1, the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect2, and the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect3; Then get the image The pixel distance width_Pix1 of the corresponding bottle width detection area widthCheck_Rect1, and the glass bottle image are obtained The pixel distance width_Pix2 of the corresponding bottle width detection area widthCheck_Rect2 and the obtained glass bottle image The corresponding pixel distance width_Pix3 of the bottle width detection area widthCheck_Rect3; wherein the pixel distance width_Pix1 is obtained by taking the absolute value of the difference between the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect1, the pixel distance width_Pix2 is obtained by taking the absolute value of the difference between the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect2, and the pixel distance width_Pix3 is obtained by taking the absolute value of the difference between the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect3; Finally, the image The corresponding bottle width detection area widthCheck_Rect1 bottle width real_width1=width_Pix1*rate, get the image The corresponding bottle width detection area widthCheck_Rect2 bottle width real_width2=width_Pix2*rate and the image obtained The corresponding bottle width detection area widthCheck_Rect3 bottle width real_width3 = width_Pix3*rate; where rate is the conversion factor from image pixels to actual size; like Figure 4 As shown, the edge approximation algorithm mentioned in step S3 and step S42 includes the following steps: Divide the bottle width detection area widthCheck_Rect1 into several slice rectangles according to the slice width step. The slice width step is set according to the recognition accuracy. The smaller the width, the higher the accuracy. Here, the slice width step is set to 1; Starting from the left side of the bottle width detection area widthCheck_Rect1, calculate the average grayscale value LGray(i) and the center horizontal coordinate value LposX(i) of the slice rectangle between the left side of the bottle width detection area widthCheck_Rect1 and the horizontal center position of the bottle width detection area widthCheck_Rect1; Take LposX(i) as the coordinate value X of the coordinate point and LGray(i) as the coordinate value Y of the coordinate point, and calculate the first-order derivative of the coordinate point ; Draw a first-order derivative line graph with LposX(i) as the coordinate value X of the coordinate point and Lf(i) as the coordinate value Y of the coordinate point, calculate the extreme point of the first-order derivative line graph, and LposX(i) corresponding to the extreme point is the horizontal coordinate value posX_Left of the left edge; Starting from the right side of the bottle width detection area widthCheck_Rect1, calculate the average grayscale value RGray(i) and the center horizontal coordinate value RposX(i) of the slice rectangle between the right side of the bottle width detection area widthCheck_Rect1 and the horizontal center position of the bottle width detection area widthCheck_Rect1; Take RposX(i) as the coordinate value X of the coordinate point and RGray(i) as the coordinate value Y of the coordinate point, and calculate the first-order derivative of the coordinate point ; Draw a first-order derivative line graph with RposX(i) as the coordinate value X of the coordinate point and Rf(i) as the coordinate value Y of the coordinate point, calculate the extreme point of the first-order derivative line graph, and RposX(i) corresponding to the extreme point is the horizontal coordinate value posX_Right of the left edge.

[0023] S43: Based on the detection area of ​​the bottle body edge concave-convex detection set in step S3, the image of the target glass bottle Get the corresponding left edge detection area EdgeCheck_RectLeft and right edge detection area EdgeCheck_RectRight; like Figure 3 As shown, the left edge detection area EdgeCheck_RectLeft is extracted using the sobel edge extraction algorithm to extract the left edge EdgeLeft of the target glass bottle, the two ends of the left edge EdgeLeft of the bottle body are connected to obtain the left straight line EdgeLineLeft, the maximum left deviation pixel distance DisLeft_Pix from the left edge EdgeLeft of the bottle body to the left straight line EdgeLineLeft is calculated, and the maximum left deviation actual distance DisLeft_Actual=DisLeft_Pix*rate is obtained; wherein rate is the conversion coefficient from image pixels to actual size; The right edge detection area EdgeCheck_RectRight is extracted by using the sobel edge extraction algorithm to extract the right edge EdgeRight of the target glass bottle, and the two ends of the right edge EdgeRight of the bottle body are connected to obtain the right straight line EdgeLineRight, and the right maximum deviation pixel distance DisRight_Pix from the right edge EdgeRight of the bottle body to the right straight line EdgeLineRight is calculated, and the right maximum deviation actual distance DisRight_Actual is obtained = DisRight_Pix*rate; where rate is the conversion coefficient from image pixels to actual size; In step S43, the sobel edge extraction algorithm performs convolution calculation on each pixel on the target image through the sobel convolution factor to obtain a gray gradient, and takes the pixel point corresponding to the gray gradient greater than the set threshold as the edge point of the target image; wherein the target image is the left edge detection area EdgeCheck_RectLeft or the right edge detection area EdgeCheck_RectRight; In step S43, the sobel convolution factor includes a lateral convolution factor and the vertical convolution factor ; Substitute the horizontal convolution factor into the pixel (x, y) of the target image to obtain the horizontal convolution grayscale value of the pixel (x, y) , ; Substitute the vertical convolution factor into the pixel of the target image to obtain the vertical convolution gray value of the pixel , ; Where f(x,y) is the gray value of the pixel (x,y) of the target image; Calculate the gray value of the pixel (x,y) ; Obtain the grayscale image EdgeAmplitude after the target image is subjected to the Sobel transformation. At this time, the non-edge pixels in the target image are convolved away, and the grayscale image EdgeAmplitude is segmented using threshold value to extract the edge points of the target image.

[0024] S44: obtaining the maximum value MaxWidth1 of the bottle width and the minimum value MinWidth1 of the bottle width detection area widthCheck_Rect1, and then calculating the bottle width difference offsetWidth1=MaxWidth1-MinWidth1 corresponding to the bottle width detection area widthCheck_Rect1; Get the maximum value MaxWidth2 of the bottle width in the bottle width detection area widthCheck_Rect2 and the minimum value MinWidth2 of the bottle width, and then calculate the bottle width difference offsetWidth2=MaxWidth2-MinWidth2 corresponding to the bottle width detection area widthCheck_Rect2; Get the maximum value MaxWidth3 of the bottle width in the bottle width detection area widthCheck_Rect3 and the minimum value MinWidth3 of the bottle width, and then calculate the bottle width difference offsetWidth3=MaxWidth3-MinWidth3 corresponding to the bottle width detection area widthCheck_Rect3; S45: Perform out-of-roundness judgment, wherein the out-of-roundness judgment includes maximum bottle width judgment, minimum bottle width judgment and bottle width difference judgment; The maximum bottle width determination step is: when the maximum bottle width MaxWidth1 is greater than a preset standard threshold MaxWidthStandard1, the maximum bottle width MaxWidth2 is greater than a preset standard threshold MaxWidthStandard2, or the maximum bottle width MaxWidth3 is greater than a preset standard threshold MaxWidthStandard3, it is determined that the maximum bottle width of the target glass bottle exceeds the standard; The minimum bottle width determination step is as follows: when the minimum bottle width MinWidth1 is greater than a preset standard threshold MinWidthStandard1, the minimum bottle width MinWidth2 is greater than a preset standard threshold MinWidthStandard2, or the minimum bottle width MinWidth3 is greater than a preset standard threshold MinWidthStandard3, it is determined that the minimum bottle width of the target glass bottle exceeds the standard; The bottle width difference judgment step is: when the bottle width difference offsetWidth1 is greater than a preset standard threshold offsetWidthStandard1, the bottle width difference offsetWidth2 is greater than a preset standard threshold offsetWidthStandard2, or the bottle width difference offsetWidth3 is greater than a preset standard threshold offsetWidthStandard3, it is determined that the bottle width difference of the target glass bottle exceeds the standard; When the target glass bottle is determined to have a maximum bottle width that exceeds the standard, a minimum bottle width that exceeds the standard, or a bottle width difference that exceeds the standard during the out-of-roundness judgment process, it means that the out-of-roundness of the target glass bottle body exceeds the standard.

[0025] Glass bottle production cannot ensure that the bottle body is 100% round, and the bottle body diameter is allowed to have positive and negative deviations. The manufacturer has three indicators for the detection of bottle body out-of-roundness: 1. The maximum diameter of the bottle body cannot be greater than the standard diameter plus the positive deviation (in this embodiment, since the standard diameter of the bottle body corresponding to each bottle width detection area is not necessarily the same, each bottle width detection area corresponds to a preset standard threshold, namely MaxWidthStandard1, MaxWidthStandard2 and MaxWidthStandard3); 2. The minimum diameter of the bottle body cannot be less than the standard diameter minus the negative deviation (in this embodiment, since the standard diameter of the bottle body corresponding to each bottle width detection area is not the same, each bottle width detection area corresponds to a preset standard threshold, namely MaxWidthStandard1, MaxWidthStandard2 and MaxWidthStandard3); The difference between the maximum diameter and the minimum diameter of a bottle cannot be greater than the out-of-roundness deviation (uniformity) (in this embodiment, since the standard diameter of the bottle body corresponding to each bottle width detection area is not necessarily the same, each bottle width detection area corresponds to a preset standard threshold, namely, offsetWidthStandard1, offsetWidthStandard2 and offsetWidthStandard3).

[0026] S46: 60 images of target glass bottles The maximum value among the left maximum deviation actual distance DisLeft_Actual corresponding to the left edge detection area EdgeCheck_RectLeft is selected as the maximum value DisLeft_Max of the left maximum deviation actual distance; 60 images of glass bottles of target glass bottles The maximum value among the right side maximum deviation actual distance DisRight_Actual corresponding to the right edge detection area EdgeCheck_RectRight is selected as the maximum value DisLeft_Max of the right side maximum deviation actual distance; S47: When the maximum value DisLeft_Max of the actual distance of the maximum deviation on the left side exceeds the set threshold Left_Standard, it is determined that there is a concave-convex defect on the left edge of the target glass bottle body, and a bottle rejection signal is sent to the bottle rejection mechanism; when the maximum value DisRight_Max of the actual distance of the maximum deviation on the right side exceeds the set threshold Right_Standard, it is determined that there is a concave-convex defect on the right edge of the target glass bottle body, and a bottle rejection signal is sent to the bottle rejection mechanism. In this embodiment, since the passing lines of the left and right edges of the glass bottle body are not the same in actual detection, the left and right edges correspond to a preset standard threshold, namely Left_Standard and Right_Standard.

[0027] In the method for detecting the out-of-roundness and concave-convex defects of the glass bottle body, multiple visual images are obtained by rotating the bottle body to extract the edge of the bottle body, and then the width of the bottle body and the defects of the left and right edges of the bottle body are calculated, and finally the online detection of the out-of-roundness and concave-convex defects of the bottle body is realized. Through visual detection, the out-of-roundness and edge concave-convexity of the bottle body are detected online, and high-speed and efficient online detection of bottle body defects is realized, thereby improving production efficiency, reducing the flow of defective products to downstream customers, and improving product quality.

[0028] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.

Claims

1. A method for detecting the out-of-roundness and concave-convex defects of a glass bottle, characterized in that: The following steps are involved: S1: Get a photo of a standard glass bottle; S2: Use the photo of the standard glass bottle to set the out-of-roundness detection area during the detection; S3: Use the photo of the standard glass bottle to set the convex and concave detection area of ​​the bottle edge during the inspection; S4: detecting the out-of-roundness of the target glass bottle body according to the out-of-roundness detection area, and detecting the edge concave defect of the target glass bottle body according to the bottle edge concave-convex detection area.

2. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 1, characterized in that: In the step S1, a standard glass bottle is placed in the image acquisition area, a bottle body image bodyImg_0 corresponding to the standard glass bottle is acquired, and a rectangular frame ROI_Rect is selected in the bottle body image bodyImg_0 as a region of interest to be detected; The rectangular frame ROI_Rect includes the left edge of the bottle body, the right edge of the bottle body and the area of ​​the bottle body that is prone to deformation and needs to be detected; After obtaining the photo of the standard glass bottle, the bottle body image bodyImg_0 is cropped according to the size parameter of the rectangular frame ROI_Rect to obtain the image ROI_Image.

3. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 2, characterized in that: In the step S2, three bottle width detection areas widthCheck_Rect1, widthCheck_Rect2 and widthCheck_Rect3 are drawn in the image ROI_Image; wherein the bottle width detection area widthCheck_Rect1, the bottle width detection area widthCheck_Rect2 and the bottle width detection area widthCheck_Rect3 all include the left edge of the standard glass bottle body and the right edge of the standard glass bottle body, and the parameters of the bottle width detection area widthCheck_Rect1, the bottle width detection area widthCheck_Rect2 and the bottle width detection area widthCheck_Rect3 are applied in defect detection as out-of-roundness detection areas.

4. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 3, characterized in that: In the step S3, a left edge detection area EdgeCheck_RectLeft is drawn at the left edge of the image ROI_Image, and a right edge detection area EdgeCheck_RectRight is drawn at the right edge of the image ROI_Image. The parameters of the left edge detection area EdgeCheck_RectLeft and the right edge detection area EdgeCheck_RectRight are applied in defect detection as bottle body edge convexity detection areas; wherein the left edge detection area EdgeCheck_RectLeft includes the left edge of the standard glass bottle body, and the right edge detection area EdgeCheck_RectRight includes the right edge of the standard glass bottle body.

5. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 4, characterized in that: In step S3, the horizontal coordinate value posX_Left of the left edge of the bottle body and the horizontal coordinate value posX_Right of the right edge of the bottle body are calculated in the bottle width detection area widthCheck_Rect1 according to the edge approximation algorithm, and the pixel distance width_Pix=|posX_Right-posX_Left| of the left and right edges is obtained, and then the conversion coefficient rate=distance / width_Pix of the image pixel to the actual size is calculated according to the actual width distance of the bottle.

6. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 5, characterized in that: The step S4 comprises the following steps: S41: First, the target glass bottle is rotated at the rotating station. Every time the bottle rotates 6°, a glass bottle image is taken using a camera to obtain 60 glass bottle images. ; where i represents the i-th glass bottle image; then the bottle body image is rectified according to the size parameter of the rectangular frame ROI_Rect Cut to get the image ; S42: Based on the out-of-roundness detection area set in step S2, Get the corresponding bottle width detection area widthCheck_Rect1, image Corresponding bottle width detection area widthCheck_Rect2 and image The corresponding bottle width detection area widthCheck_Rect3; Extracting images using edge approximation algorithms The horizontal coordinate values ​​of the left and right edges of the corresponding bottle width detection area widthCheck_Rect1, the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect2, and the horizontal coordinate values ​​of the left and right edges of the bottle width detection area widthCheck_Rect3; Then get the image The pixel distance width_Pix1 of the corresponding bottle width detection area widthCheck_Rect1, and the glass bottle image are obtained The pixel distance width_Pix2 of the corresponding bottle width detection area widthCheck_Rect2 and the obtained glass bottle image The pixel distance width_Pix3 of the corresponding bottle width detection area widthCheck_Rect3; Finally, the image The corresponding bottle width detection area widthCheck_Rect1 bottle width real_width1=width_Pix1*rate, get the image The corresponding bottle width detection area widthCheck_Rect2 bottle width real_width2=width_Pix2*rate and the image obtained The corresponding bottle width detection area widthCheck_Rect3 bottle width real_width3 = width_Pix3*rate; where rate is the conversion factor from image pixels to actual size; S43: Based on the detection area of ​​the bottle body edge concave-convex detection set in step S3, the image of the target glass bottle Get the corresponding left edge detection area EdgeCheck_RectLeft and right edge detection area EdgeCheck_RectRight; The left edge detection area EdgeCheck_RectLeft is extracted using the sobel edge extraction algorithm to extract the left edge EdgeLeft of the target glass bottle, and the two ends of the left edge EdgeLeft of the bottle body are connected to obtain the left straight line EdgeLineLeft, and the maximum left deviation pixel distance DisLeft_Pix from the left edge EdgeLeft of the bottle body to the left straight line EdgeLineLeft is calculated, and the maximum left deviation actual distance DisLeft_Actual=DisLeft_Pix*rate is obtained; where rate is the conversion coefficient from image pixels to actual size; The right edge detection area EdgeCheck_RectRight is extracted by using the sobel edge extraction algorithm to extract the right edge EdgeRight of the target glass bottle, and the two end edges of the right edge EdgeRight of the bottle body are connected to obtain the right straight line EdgeLineRight, and the maximum right deviation pixel distance DisRight_Pix from the right edge EdgeRight of the bottle body to the right straight line EdgeLineRight is calculated, and the maximum right deviation actual distance DisRight_Actual=DisRight_Pix*rate is obtained; wherein rate is the conversion coefficient from image pixels to actual size.

7. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 6, characterized in that: The edge approximation algorithm comprises the following steps: Divide the bottle width detection area widthCheck_Rect1 into several slice rectangles according to the slice width step; Starting from the left side of the bottle width detection area widthCheck_Rect1, calculate the average grayscale value LGray(i) and the center horizontal coordinate value LposX(i) of the slice rectangle between the left side of the bottle width detection area widthCheck_Rect1 and the horizontal center position of the bottle width detection area widthCheck_Rect1; Take LposX(i) as the coordinate value X of the coordinate point and LGray(i) as the coordinate value Y of the coordinate point, and calculate the first-order derivative of the coordinate point ; Draw a first-order derivative line graph with LposX(i) as the coordinate value X of the coordinate point and LGray(i) as the coordinate value Y of the coordinate point, calculate the extreme point of the first-order derivative line graph, and the LposX(i) corresponding to the extreme point is the horizontal coordinate value posX_Left of the left edge; Starting from the right side of the bottle width detection area widthCheck_Rect1, calculate the average grayscale value RGray(i) and the center horizontal coordinate value RposX(i) of the slice rectangle between the right side of the bottle width detection area widthCheck_Rect1 and the horizontal center position of the bottle width detection area widthCheck_Rect1; Take RposX(i) as the coordinate value X of the coordinate point and RGray(i) as the coordinate value Y of the coordinate point, and calculate the first-order derivative of the coordinate point ; Draw a first-order derivative line graph with RposX(i) as the coordinate value X of the coordinate point and Rf(i) as the coordinate value Y of the coordinate point, calculate the extreme point of the first-order derivative line graph, and RposX(i) corresponding to the extreme point is the horizontal coordinate value posX_Right of the left edge.

8. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 7, characterized in that: In step S43, the sobel edge extraction algorithm performs convolution calculation on each pixel on the target image through the sobel convolution factor to obtain a gray gradient, and takes the pixel point corresponding to the gray gradient greater than the set threshold as the edge point of the target image; wherein the target image is the left edge detection area EdgeCheck_RectLeft or the right edge detection area EdgeCheck_RectRight; In step S43, the sobel convolution factor includes a lateral convolution factor and the vertical convolution factor ; Substitute the horizontal convolution factor into the pixel (x, y) of the target image to obtain the horizontal convolution gray value of the pixel (x, y) , ; Substitute the vertical convolution factor into the pixel of the target image to obtain the vertical convolution gray value of the pixel , ; Where f(x,y) is the gray value of the pixel (x,y) of the target image; Calculate the gray value of the pixel (x,y) ; Obtain the grayscale image EdgeAmplitude after the target image is subjected to the Sobel transformation, and use threshold segmentation on the grayscale image EdgeAmplitude to extract the edge points of the target image.

9. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 8, characterized in that: The step S4 further comprises the following steps: S44: obtaining the maximum value MaxWidth1 of the bottle width and the minimum value MinWidth1 of the bottle width detection area widthCheck_Rect1, and then calculating the bottle width difference offsetWidth1=MaxWidth1-MinWidth1 corresponding to the bottle width detection area widthCheck_Rect1; Get the maximum value MaxWidth2 of the bottle width in the bottle width detection area widthCheck_Rect2 and the minimum value MinWidth2 of the bottle width, and then calculate the bottle width difference offsetWidth2=MaxWidth2-MinWidth2 corresponding to the bottle width detection area widthCheck_Rect2; Get the maximum value MaxWidth3 of the bottle width in the bottle width detection area widthCheck_Rect3 and the minimum value MinWidth3 of the bottle width, and then calculate the bottle width difference offsetWidth3=MaxWidth3-MinWidth3 corresponding to the bottle width detection area widthCheck_Rect3; S45: Perform out-of-roundness judgment, wherein the out-of-roundness judgment includes maximum bottle width judgment, minimum bottle width judgment and bottle width difference judgment; The maximum bottle width determination step is: when the maximum bottle width MaxWidth1 is greater than a preset standard threshold MaxWidthStandard1, the maximum bottle width MaxWidth2 is greater than a preset standard threshold MaxWidthStandard2, or the maximum bottle width MaxWidth3 is greater than a preset standard threshold MaxWidthStandard3, it is determined that the maximum bottle width of the target glass bottle exceeds the standard; The minimum bottle width determination step is as follows: when the minimum bottle width MinWidth1 is greater than a preset standard threshold MinWidthStandard1, the minimum bottle width MinWidth2 is greater than a preset standard threshold MinWidthStandard2, or the minimum bottle width MinWidth3 is greater than a preset standard threshold MinWidthStandard3, it is determined that the minimum bottle width of the target glass bottle exceeds the standard; The bottle width difference judgment step is: when the bottle width difference offsetWidth1 is greater than a preset standard threshold offsetWidthStandard1, the bottle width difference offsetWidth2 is greater than a preset standard threshold offsetWidthStandard2, or the bottle width difference offsetWidth3 is greater than a preset standard threshold offsetWidthStandard3, it is determined that the bottle width difference of the target glass bottle exceeds the standard; When the target glass bottle is determined to have a maximum bottle width that exceeds the standard, a minimum bottle width that exceeds the standard, or a bottle width difference that exceeds the standard during the out-of-roundness judgment process, it means that the out-of-roundness of the target glass bottle body exceeds the standard.

10. A method for detecting out-of-roundness and concave-convex defects of a glass bottle body according to claim 9, characterized in that: The step S4 further comprises the following steps: S46: 60 images of target glass bottles The maximum value among the left maximum deviation actual distance DisLeft_Actual corresponding to the left edge detection area EdgeCheck_RectLeft is selected as the maximum value DisLeft_Max of the left maximum deviation actual distance; 60 images of glass bottles of target glass bottles The maximum value among the right side maximum deviation actual distance DisRight_Actual corresponding to the right edge detection area EdgeCheck_RectRight is selected as the maximum value DisLeft_Max of the right side maximum deviation actual distance; S47: When the maximum value DisLeft_Max of the actual distance of the maximum deviation on the left exceeds the set threshold Left_Standard, it is determined that there is a concave-convex defect on the left edge of the target glass bottle body; when the maximum value DisRight_Max of the actual distance of the maximum deviation on the right exceeds the set threshold Right_Standard, it is determined that there is a concave-convex defect on the right edge of the target glass bottle body.

Citation Information

Patent Citations

  • Image edge point acquisition method and device

    CN111968144A

  • Multi-target optical fiber position accurate detection and positioning system and method

    CN112734847A

  • Omnibearing medicine bottle appearance defect detection method

    CN113324993A

  • Heat exchanger fin pitch measuring method and device based on machine vision and medium

    CN114199148A

  • Liquid crystal screen scratch detection method and device and storage medium

    CN115456956A