Bottle mouth defect detection method, device, equipment and storage medium

By segmenting and edge detection of the grayscale image of the bottle opening, combined with the comparison of the fitted circle radius and the screening of abnormal scattered points, the problems of accuracy and efficiency in bottle opening defect detection are solved, and the accurate identification and rapid location of minute defects are achieved.

CN117036273BActive Publication Date: 2025-11-25INNOVATION QIZHI (QINGDAO) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310986829.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-07
Publication Date
2025-11-25
Estimated Expiration
2043-08-07

AI Technical Summary

Technical Problem

In existing technologies, bottle mouth defect detection relies on manual visual inspection, which is inefficient and easily affected by subjective factors. Furthermore, traditional visual inspection methods cannot cover all bottle mouth defects, especially minor deformation defects.

Method used

By acquiring a grayscale image of the bottle opening, identifying the bottle opening region and dividing it into multiple image segmentation units, using an edge detection algorithm to obtain scattered points on the bottle opening edge, and combining the comparison of fitted circle radii and the screening of abnormal scattered points, the defect detection of the bottle opening is achieved.

Benefits of technology

It improves the accuracy and efficiency of bottle mouth defect detection, can identify minute defects, and facilitates subsequent defect location and improvement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117036273B_ABST
    Figure CN117036273B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a bottle mouth defect detection method, device and equipment, and a storage medium, and relate to the technical field of defect detection. The method comprises: acquiring a bottle mouth grayscale image of a bottle to be detected; identifying a bottle mouth region of the bottle mouth grayscale image and determining a reference fitting circle corresponding to the bottle mouth region; dividing the bottle mouth grayscale image into a plurality of image segmentation units according to a preset center angle unit based on the center of the reference fitting circle; acquiring bottle mouth edge scatter points corresponding to each image segmentation unit according to a preset edge detection algorithm; and performing defect detection on the bottle to be detected based on the bottle mouth edge scatter points corresponding to each image segmentation unit. According to the embodiments of the present application, the bottle mouth image is divided into a plurality of segmentation units, and the bottle mouth defect is detected according to the bottle mouth edge scatter points identified in each segmentation unit, so that the minute defect condition of the bottle mouth can be accurately identified, and the accuracy of the bottle mouth defect detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of defect detection, in particular to a bottle mouth defect detection method, device, equipment and storage medium. BACKGROUND

[0002] In the process of bottle blow molding, due to process errors of the production line, the bottle mouth may have size abnormalities, protrusions or defects, etc. which may cause the problem that the bottle cap cannot be matched.

[0003] At present, the traditional detection method mainly relies on manual visual inspection, which is low in efficiency and easy to be affected by subjective factors; in addition, some visual detection technologies use area comparison method for automatic defect detection, but this method can only detect the defect condition of obvious deformation of the bottle mouth, and cannot cover all the defect conditions of the bottle mouth. In summary, there is an urgent need for a solution that can improve the accuracy of bottle mouth defect detection. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide a bottle mouth defect detection method, device, equipment and storage medium to improve the accuracy of bottle mouth defect detection.

[0005] In a first aspect, the embodiments of the present application provide a bottle mouth defect detection method, comprising:

[0006] Obtaining a bottle mouth gray image of a bottle to be detected;

[0007] Identifying a bottle mouth region of the bottle mouth gray image and determining a reference fitting circle corresponding to the bottle mouth region;

[0008] Based on the center of the reference fitting circle, the bottle mouth gray image is divided into a plurality of image segmentation units according to a preset center angle unit;

[0009] Obtaining a bottle mouth edge scatter point corresponding to each image segmentation unit according to a preset edge detection algorithm;

[0010] Based on the bottle mouth edge scatter point corresponding to each image segmentation unit, defect detection is performed on the bottle to be detected.

[0011] In the embodiments of the present application, the bottle mouth image is divided into a plurality of segmentation units, and the bottle mouth edge scatter point in each segmentation unit is identified, and finally the bottle mouth defect detection is realized according to these bottle mouth edge scatter points, so that the micro defect condition of the bottle mouth can be accurately identified, and the accuracy of the bottle mouth defect detection is improved.

[0012] In some possible embodiments, based on the bottle mouth edge scatter point corresponding to each image segmentation unit, the defect detection is performed on the bottle to be detected, comprising:

[0013] acquire the bottle mouth inner side edge scatter points and the bottle mouth outer side edge scatter points corresponding to each of the image segmentation units;

[0014] determine a bottle mouth inner side fitting circle of the bottle to be detected based on all the bottle mouth inner side edge scatter points, and determine a bottle mouth outer side fitting circle of the bottle to be detected based on all the bottle mouth outer side edge scatter points;

[0015] acquire a first to-be-detected radius corresponding to the bottle mouth inner side fitting circle and a second to-be-detected radius of the bottle mouth outer side fitting circle;

[0016] compare the first to-be-detected radius and the second to-be-detected radius with a preset standard radius respectively, and determine whether the bottle to be detected has defects according to a comparison result.

[0017] In the embodiments of the present application, the bottle mouth edge fitting circle is acquired through all the bottle mouth edge scatter points, and the bottle mouth defect detection is performed by judging the difference degree of the radius of the bottle mouth edge fitting circle and the standard radius, thereby improving the accuracy and efficiency of the bottle mouth defect detection.

[0018] In some possible embodiments, the defect detection of the bottle to be detected based on the bottle mouth edge scatter points corresponding to each of the image segmentation units comprises:

[0019] acquire the bottle mouth inner side edge scatter points and the bottle mouth outer side edge scatter points corresponding to each of the image segmentation units;

[0020] determine a bottle mouth inner side fitting circle of the bottle to be detected based on all the bottle mouth inner side edge scatter points, and determine a bottle mouth outer side fitting circle of the bottle to be detected based on all the bottle mouth outer side edge scatter points;

[0021] screen bottle mouth inner side edge abnormal scatter points deviating from the bottle mouth inner side fitting circle and having a deviation degree exceeding a preset first threshold from all the bottle mouth inner side edge scatter points, and determine whether the bottle to be detected has defects according to a proportion of the bottle mouth inner side edge abnormal scatter points in all the bottle mouth inner side edge scatter points;

[0022] screen bottle mouth outer side edge abnormal scatter points deviating from the bottle mouth outer side fitting circle and having a deviation degree exceeding a preset second threshold from all the bottle mouth outer side edge scatter points, and determine whether the bottle to be detected has defects according to a proportion of the bottle mouth outer side edge abnormal scatter points in all the bottle mouth outer side edge scatter points.

[0023] In the embodiments of the present application, the bottle mouth edge fitting circle is acquired according to the bottle mouth edge scatter points, then the abnormal scatter points deviating greatly from the fitting circle in the bottle mouth edge scatter points are screened, and the bottle mouth defect detection is performed according to the proportion of the abnormal scatter points in all the scatter points. The accuracy of the bottle mouth defect detection is further improved.

[0024] In some possible embodiments, the defect detection of the bottle to be detected based on the bottle mouth edge scatter points corresponding to each of the image segmentation units further includes:

[0025] Obtain the bottle anchor point information from the grayscale image of the bottle opening;

[0026] The defect location information of the bottle to be inspected is generated based on the positional correspondence between each of the abnormal scattered points on the bottle mouth edge and the bottle anchor point information; wherein, the abnormal scattered points on the bottle mouth edge include abnormal scattered points on the inner edge of the bottle mouth and abnormal scattered points on the outer edge of the bottle mouth.

[0027] In this embodiment of the application, by acquiring the anchor point information of the bottle mouth image, and then generating the defect location information of the bottle based on the positional correspondence between the detected abnormal scattered points and the anchor points, the subsequent defect location and improvement are facilitated, thereby improving the convenience of bottle mouth defect detection.

[0028] In some possible embodiments, acquiring the grayscale image of the bottle opening of the bottle to be detected includes:

[0029] Acquire an initial image of the bottle to be detected, and identify the location of the bottle mouth region in the initial image;

[0030] When the location of the bottle opening area is determined to be within the preset target detection range, a grayscale image of the bottle opening of the bottle to be detected is acquired.

[0031] In this embodiment of the application, the system determines whether the bottle opening area has entered a specific detection area based on the initial image of the bottle. Once the bottle has entered the specific area, the subsequent detection process begins. This allows the system to automatically determine whether the bottle opening has entered the optimal detection position, eliminating the need for manual placement of the bottle opening into a specific position and further improving the efficiency of bottle opening defect detection.

[0032] In some possible embodiments, identifying the bottle mouth region of the grayscale image of the bottle mouth and determining the reference fitted circle corresponding to the bottle mouth region includes:

[0033] Identify the outer edge of the bottle mouth region in the grayscale image of the bottle mouth, and use a preset circle fitting operator to determine the reference fitting circle corresponding to the bottle mouth region based on the outer edge of the bottle mouth region.

[0034] In this embodiment, the fitting circle corresponding to the bottle mouth region is determined by identifying the outer edge of the bottle mouth region. The fitting circle of the bottle mouth region can be accurately identified by utilizing the difference between the outer edge of the bottle mouth and the detection background in the grayscale image, thereby further improving the accuracy of bottle mouth defect detection.

[0035] In some possible embodiments, obtaining the bottle mouth edge scatter points corresponding to each image segmentation unit according to a preset edge detection algorithm includes:

[0036] Based on at least one line connecting the center of the reference fitted circle to the image edge, the pixel gradient value in each image segmentation unit is calculated in the line direction.

[0037] The calculated pixel gradient values ​​are compared with the preset gradient threshold, and the bottle mouth edge scatter points corresponding to each image segmentation unit are obtained based on the comparison results.

[0038] In this embodiment, the pixel gradient value is calculated based on at least one line connecting the center of the circle and the edge of the image, and the scattered points at the edge of the bottle opening are obtained based on the pixel gradient value, thereby further improving the accuracy of bottle opening defect detection.

[0039] Secondly, embodiments of this application provide a bottle mouth defect detection device, comprising:

[0040] The image acquisition module is used to acquire a grayscale image of the bottle opening of the bottle to be detected;

[0041] The benchmark fitting module is used to identify the bottle mouth region of the grayscale image of the bottle mouth and determine the benchmark fitting circle corresponding to the bottle mouth region.

[0042] The unit segmentation module is used to divide the bottle mouth grayscale image into several image segmentation units based on the center of the fitted circle and according to the preset central angle.

[0043] The edge detection module is used to obtain the bottle mouth edge scatter points corresponding to each image segmentation unit according to the preset edge detection algorithm;

[0044] The defect detection module is used to perform defect detection on the bottle to be detected based on the scattered points of the bottle mouth edge corresponding to each of the image segmentation units.

[0045] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the method described in any embodiment of the first aspect.

[0046] Fourthly, embodiments of this application provide a computer program product, which includes a computer program, wherein the computer program, when executed by a processor, can implement the method described in any embodiment of the first aspect.

[0047] Fifthly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the method described in any embodiment of the first aspect. Attached Figure Description

[0048] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0049] Figure 1 This is one of the flowcharts illustrating the bottle mouth defect detection method provided in the embodiments of this application;

[0050] Figure 2 The second schematic flowchart of the bottle mouth defect detection method provided in the embodiments of this application;

[0051] Figure 3 This is a schematic diagram of bottle mouth edge detection provided in an embodiment of this application;

[0052] Figure 4 This is a schematic diagram of the structure of a bottle mouth defect detection device provided in an embodiment of this application;

[0053] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0054] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0055] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0056] like Figure 1 As shown in the figure, this application provides a method for detecting defects at the bottle opening, which may include the following steps:

[0057] S1. Obtain the grayscale image of the bottle opening of the bottle to be detected;

[0058] S2. Identify the bottle mouth region of the grayscale image of the bottle mouth and determine the reference fitting circle corresponding to the bottle mouth region;

[0059] S3. Based on the center of the fitted circle, the grayscale image of the bottle opening is divided into several image segmentation units according to the preset central angle.

[0060] S4. Obtain the bottle mouth edge scatter points corresponding to each image segmentation unit according to the preset edge detection algorithm;

[0061] S5. Based on the scattered points at the bottle mouth edge corresponding to each of the image segmentation units, perform defect detection on the bottle to be detected.

[0062] In this embodiment of the application, a grayscale image of the bottle opening of the bottle to be inspected is first acquired. The bottle is captured by a pre-set specific position, and the image is converted into a grayscale image. It can be verified whether the entire bottle opening is included in the image. In addition, in order to improve the accuracy of bottle opening defect detection, the bottle opening image is usually acquired in a top view. That is, the camera of the image acquisition device is vertically downward and aimed at the bottle opening area to acquire the image. Therefore, the bottle opening area in the acquired image is a circle.

[0063] Step S2 involves coarsely identifying the bottle opening grayscale image. The bottle opening region in the image is then mapped to a circle (reference fitted circle), primarily to determine the center of the circle corresponding to the bottle opening region in the current image. After determining the center of the reference fitted circle, using this center as the vertex and the two sides corresponding to the central angle as tangent lines, the bottle opening grayscale image is divided into image segmentation units. It can be understood that when the bottle opening grayscale image is rectangular, since one or two sides are opposite the central angle, the resulting image segmentation units are triangles or quadrilaterals; when the bottle opening grayscale image is circular, since an arc is opposite the central angle, the resulting image segmentation units are sectors. It should be noted that, for ease of detection, the bottle opening grayscale image can be set as a circular image slightly larger than the bottle opening region. When segmenting the image, 360° can be divided into several equal parts, for example, 360 parts. Then, the central angle of each image segmentation unit is 1°, and the bottle opening grayscale image is divided into 360 image segmentation units.

[0064] Then, using a preset edge detection algorithm, edge detection can be performed on each image segmentation unit to obtain scattered points corresponding to the bottle mouth edge contour in that image segmentation unit (bottle mouth edge scattered points). Each image segmentation unit can have one or more bottle mouth edge scattered points, depending on the balance between detection accuracy and efficiency. The number of bottle mouth edge scattered points can be adjusted according to the number of image segmentation units. Generally, the more image segmentation units (indicating finer detection), the fewer bottle mouth edge scattered points should be corresponding to each image segmentation unit (while achieving a certain level of detection accuracy, avoiding excessive computation due to excessive precision). It is understood that bottle mouth edge scattered points can include both the inner and outer edges of the bottle mouth, specifically set according to detection requirements.

[0065] Finally, bottle mouth defects can be detected based on the scattered points at the bottle mouth edge corresponding to each image segmentation unit. For example, the distance between the scattered points at the bottle mouth edge and the center of the circle can be considered close to a set distance threshold (allowing for a certain error range). If the distance exceeds the distance threshold within a certain error range, the bottle mouth is determined to have a defect, and the corresponding defect location is recorded according to the image segmentation unit. The distance threshold can be calculated by averaging the distances between all the scattered points at the bottle mouth edge and the center of the circle, or it can be obtained by pre-detecting a certain number of defect-free bottles and obtaining the correct threshold parameters.

[0066] Compared to existing defect detection methods that compare the overall area of ​​the bottle opening, this embodiment divides the bottle opening image into multiple segments for defect detection, thus accurately identifying minute defects at the bottle opening and improving the accuracy of bottle opening defect detection.

[0067] In some possible embodiments, S5 (the defect detection of the bottle to be detected based on the scatter points of the bottle mouth edge corresponding to each of the image segmentation units) may include:

[0068] S501. Obtain the scatter points of the inner edge of the bottle opening and the scatter points of the outer edge of the bottle opening corresponding to each of the image segmentation units.

[0069] S502. Determine the inner fitting circle of the bottle opening of the bottle to be tested based on the obtained scatter points of all inner edge points of the bottle opening, and determine the outer fitting circle of the bottle opening of the bottle to be tested based on the obtained scatter points of all outer edge points of the bottle opening.

[0070] S503. Obtain the first radius to be measured corresponding to the fitting circle inside the bottle opening and the second radius to be measured corresponding to the fitting circle outside the bottle opening;

[0071] S504. Compare the first radius to be tested and the second radius to be tested with the preset standard radius respectively, and determine whether the bottle to be tested has a defect based on the comparison result.

[0072] It should be noted that the scattered points on the inner and outer edges of the bottle opening in each image segmentation unit can be identified separately. Based on all the scattered points, fitted circles are created for the inner and outer edges of the bottle opening (the fitting method can be, for example, least squares fitting). Then, the corresponding first and second measured radii are calculated. Finally, these are compared with a preset standard radius to detect bottle opening defects. For example, if the difference between the first or second measured radius and the preset standard radius is greater than a set threshold, the bottle opening is determined to have a deformation defect.

[0073] In this embodiment, a fitted circle for the bottle mouth edge is obtained by using all scattered points on the bottle mouth edge, and the bottle mouth defect is detected by judging the difference between the radius of the fitted circle and the standard radius. This allows for a quick overall assessment of whether the bottle mouth has deformed, thereby improving the accuracy and efficiency of bottle mouth defect detection.

[0074] In some possible embodiments, S5 (the defect detection of the bottle to be detected based on the scatter points of the bottle mouth edge corresponding to each of the image segmentation units) may include:

[0075] S511. Obtain the scatter points of the inner edge of the bottle mouth and the scatter points of the outer edge of the bottle mouth corresponding to each of the image segmentation units;

[0076] S512. Determine the inner fitting circle of the bottle opening of the bottle to be tested based on the obtained scatter points of all inner edge points of the bottle opening, and determine the outer fitting circle of the bottle opening of the bottle to be tested based on the obtained scatter points of all outer edge points of the bottle opening.

[0077] S513. Select abnormal scattered points on the inner edge of the bottle opening from all scattered points on the inner edge of the bottle opening that deviate from the fitted circle on the inner edge of the bottle opening and whose deviation exceeds a preset first threshold, and determine whether the bottle to be tested has a defect based on the proportion of abnormal scattered points on the inner edge of the bottle opening to all scattered points on the inner edge of the bottle opening.

[0078] S514. Select abnormal scattered points on the outer edge of the bottle opening from all scattered points on the outer edge of the bottle opening that deviate from the fitted circle on the outer edge of the bottle opening and whose deviation exceeds a preset second threshold, and determine whether the bottle to be tested has a defect based on the proportion of abnormal scattered points on the outer edge of the bottle opening to all scattered points on the outer edge of the bottle opening.

[0079] It should be noted that after fitting the scattered points on the inner and outer edges of the bottle opening into inner and outer fitted circles respectively, the deviation of each scattered point on the inner and outer edges of the bottle opening from the fitted circles is compared. Abnormal scattered points whose deviation exceeds a preset first threshold are screened out, and the presence of a bottle opening defect is determined based on the proportion of abnormal scattered points to all scattered points. When the proportion of abnormal scattered points to all scattered points exceeds a certain threshold, it is determined that there is a defect in the bottle opening.

[0080] In this embodiment of the application, a fitted circle for the bottle mouth edge is obtained based on the scattered points at the bottle mouth edge. Then, abnormal scattered points that deviate significantly from the fitted circle are selected from the scattered points at the bottle mouth edge. Finally, bottle mouth defect detection is performed based on the proportion of abnormal scattered points to all scattered points, which further improves the accuracy of bottle mouth defect detection.

[0081] In some possible embodiments, S5 (the defect detection of the bottle to be detected based on the scatter points of the bottle mouth edge corresponding to each of the image segmentation units) may include:

[0082] S521. Obtain the bottle anchor point information of the grayscale image of the bottle mouth;

[0083] S522. Based on the positional correspondence between each of the abnormal scattered points on the bottle mouth edge and the bottle anchor point information, generate the defect location information of the bottle to be inspected; wherein, the abnormal scattered points on the bottle mouth edge include abnormal scattered points on the inner edge of the bottle mouth and abnormal scattered points on the outer edge of the bottle mouth.

[0084] It should be noted that since the bottle inspection process and subsequent defect handling are usually carried out at different workstations and on different production lines, it is often impossible to pinpoint the exact location of the defect at the bottle opening during defect handling, causing significant inconvenience to the inspection and defect handling process. In this embodiment, anchor point markers, such as bottle labels, can be pre-set on the bottle. During inspection, the relative positional relationship between the detected defect location (the location of abnormal scattered points on the bottle opening edge) and the anchor point information can be recorded. This relative positional relationship can then be used to quickly and conveniently determine the specific defect location during subsequent defect handling, facilitating subsequent defect localization and improvement, and enhancing the convenience of bottle opening defect inspection.

[0085] In some possible embodiments, step S1 (acquiring the grayscale image of the bottle opening of the bottle to be detected) may include:

[0086] S101. Obtain an initial image of the bottle to be detected, and identify the location of the bottle mouth area in the initial image;

[0087] S102. When it is determined that the bottle opening area is within the preset target detection range, the grayscale image of the bottle opening of the bottle to be detected is obtained.

[0088] In this embodiment of the application, the system determines whether the bottle opening area has entered a specific detection area based on the initial image of the bottle. Once the bottle has entered the specific area, the subsequent detection process begins. This allows the system to automatically determine whether the bottle opening has entered the optimal detection position, eliminating the need for manual placement of the bottle opening into a specific position and further improving the efficiency of bottle opening defect detection.

[0089] In some possible embodiments, step S2 (identifying the bottle mouth region of the grayscale image of the bottle mouth and determining the reference fitting circle corresponding to the bottle mouth region) may include:

[0090] S201. Identify the outer edge of the bottle mouth region in the grayscale image of the bottle mouth, and use a preset circle fitting operator to determine the reference fitting circle corresponding to the bottle mouth region based on the outer edge of the bottle mouth region.

[0091] In this embodiment, the fitting circle corresponding to the bottle mouth region is determined by identifying the outer edge of the bottle mouth region. The fitting circle of the bottle mouth region can be accurately identified by utilizing the difference between the outer edge of the bottle mouth and the detection background in the grayscale image, thereby further improving the accuracy of bottle mouth defect detection.

[0092] In some possible embodiments, step S4 (obtaining the bottle mouth edge scatter points corresponding to each image segmentation unit according to a preset edge detection algorithm) may include:

[0093] S401. Based on at least one line direction connecting the center of the reference fitted circle and the image edge, calculate the pixel gradient value in each image segmentation unit in the line direction.

[0094] S402. The calculated pixel gradient values ​​are compared with the preset gradient threshold, and the bottle mouth edge scatter points corresponding to each image segmentation unit are obtained according to the comparison results.

[0095] In this embodiment, in each image segmentation unit, at least one line connecting the center of the reference fitted circle and the image edge can be determined. Pixel gradient values ​​are calculated progressively along this line. When a pixel gradient value is within a preset gradient threshold range, it indicates that the location is a bottle mouth edge region, and the corresponding pixel is marked as a bottle mouth edge scatter point. The pixel gradient detection sequence can be from the center away from the center or from the image edge towards the center. By calculating pixel gradient values ​​based on at least one line connecting the center and the image edge, and obtaining bottle mouth edge scatter points based on these pixel gradient values, the accuracy of bottle mouth defect detection is further improved because bottle mouth edge scatter points can be identified at the pixel level.

[0096] Based on the above scheme, and to facilitate a better understanding of the bottle mouth defect detection method provided in the embodiments of this application, the following detailed description is provided:

[0097] Please see Figure 2 The embodiments of this application can be implemented through the following steps:

[0098] Before starting the production line to inspect the bottle mouth for defects, a certain number of defect-free bottles can be identified on the production line first, and the correct threshold parameters can be calculated based on the inspection data of these normal bottles as a basis for determining whether the bottle mouth is abnormal.

[0099] Step 1: Obtain images of the bottle necks on the production line;

[0100] Step 1: Perform target segmentation on the bottle opening image; you can call the deep learning model inference interface and use a pre-trained target segmentation network to identify the location of the bottle opening in the image;

[0101] Step 2: Determine whether the bottle opening area has entered a specific location; the specific determination method can be divided into two types: (1) Determine the distance between the center point of the bottle opening area and the center point of the specific area; if the distance is less than the threshold, it is considered to have entered the specific range, and then proceed to step 3, otherwise proceed to step 0; (2) Use a target detection network to quickly locate the rectangular box where the bottle opening is located; determine whether the rectangular box has entered the specific area;

[0102] Step 3: Identify defects at the bottle neck:

[0103] 3.1. Reference Figure 3 First, the outer edge of the bottle opening area is extracted, and then a preset circle fitting operator is used to fit it into a circle; the circle is divided into a certain number of image units on average, for example, 360 parts on average; at the same time, the original image is converted into a grayscale image.

[0104] 3.2 Identifying the inner edge of the bottle opening: In each image unit, based on the line connecting the center point of the arc and the center of the circle, along the direction away from the center of the circle, the pixel gradient value is calculated step by step from the inner side of the arc; when the gradient value is within a certain threshold range, the point is considered to be a point on the inner edge of the bottle opening; by fitting all these points, the circle containing the inner edge of the bottle opening is obtained.

[0105] 3.3 Identifying the outer edge of the bottle opening: Based on the same method as in 3.2, continue to calculate the pixel gradient along the direction away from the center of the circle on the line connecting the center point of each arc and the center of the circle, and then the circle containing the outer edge of the bottle opening can be obtained;

[0106] 3.4 Determine if the size of the inner side of the bottle opening is normal: Determine the difference between the radius of the fitted inner circle of the bottle opening and the standard radius. If the difference exceeds a certain threshold, it is judged as abnormal.

[0107] 3.5. Using the same method as 3.4, it can be determined whether the size of the outer part of the bottle opening is normal;

[0108] 3.6 Determine if there is a notch or protruding defect on the inside of the bottle opening: Calculate the distance between all the identified scatter points on the inside of the bottle opening and the fitted center of the inner circle of the bottle opening, and then calculate the proportion of scatter points with significantly abnormal distances from the center of the circle among all scatter points; when this proportion exceeds a certain range, it is considered that there is a notch or protruding defect on the inside of the bottle opening; the location of the defect can be determined based on these deviated scatter points.

[0109] 3.7. Based on the same method as 3.6, it can be determined whether there is a notch or protruding defect on the outside of the bottle opening.

[0110] Step 4: If a defect exists, proceed to step 5; otherwise, proceed to step 0.

[0111] Step 5: Send an alarm; the alarm message includes the defect category (abnormal size, gap, or protrusion); if it is a gap or protrusion at the bottle neck, the location of the defect will also be indicated.

[0112] Please refer to Figure 4 , Figure 4 A block diagram illustrating the composition of a bottle neck defect detection device provided in some embodiments of this application is shown. It should be understood that this bottle neck defect detection device is similar to the one described above. Figure 1 Corresponding to the method embodiments, it is able to perform each step involved in the above method embodiments. The specific functions of the bottle mouth defect detection device can be found in the description above. To avoid repetition, detailed descriptions are appropriately omitted here.

[0113] Figure 4 The bottle mouth defect detection device includes at least one software function module that can be stored in a memory or embedded in the bottle mouth defect detection device in the form of software or firmware. The bottle mouth defect detection device includes:

[0114] Image acquisition module 410 is used to acquire a grayscale image of the bottle opening of the bottle to be detected;

[0115] The benchmark fitting module 420 is used to identify the bottle mouth region of the bottle mouth grayscale image and determine the benchmark fitting circle corresponding to the bottle mouth region.

[0116] The unit segmentation module 430 is used to divide the bottle mouth grayscale image into several image segmentation units based on the center of the reference fitted circle and according to the preset central angle.

[0117] Edge detection module 440 is used to obtain the bottle mouth edge scatter points corresponding to each image segmentation unit according to a preset edge detection algorithm;

[0118] The defect detection module 450 is used to perform defect detection on the bottle to be detected based on the bottle mouth edge scatter points corresponding to each of the image segmentation units.

[0119] It is understood that the above-described device embodiments correspond to the method embodiments of the present invention. The bottle mouth defect detection device provided by the embodiments of the present invention can realize the bottle mouth defect detection method provided by any one of the method embodiments of the present invention.

[0120] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the aforementioned method, and will not be elaborated further here.

[0121] like Figure 5As shown, some embodiments of this application provide an electronic device 500, which includes a memory 510, a processor 520, and a computer program stored in the memory 510 and executable on the processor 520. When the processor 520 reads the program from the memory 510 via a bus 530 and executes the program, it can implement any of the methods included in the above-described bottle mouth defect detection method.

[0122] Processor 520 can process digital signals and can include various computing architectures. For example, it can be a complex instruction set computer architecture, a reduced instruction set computer architecture, or an architecture that implements multiple instruction set combinations. In some examples, processor 520 can be a microprocessor.

[0123] The memory 510 can be used to store instructions executed by the processor 520 or data related to the execution of instructions. These instructions and / or data may include code for implementing some or all of the functions of one or more modules described in the embodiments of this application. The processor 520 of this disclosure embodiment can be used to execute the instructions in the memory 510 to implement the methods shown above. The memory 510 includes dynamic random access memory, static random access memory, flash memory, optical memory, or other memories well known to those skilled in the art.

[0124] Some embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, describes the method described in the method embodiments.

[0125] Some embodiments of this application also provide a computer program product that, when run on a computer, causes the computer to perform the methods described in the method embodiments.

[0126] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0127] It should be understood, in the several embodiments provided in this application, that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0128] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0129] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0130] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0131] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0132] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for detecting defects at the bottle mouth, characterized in that, include: Obtain the grayscale image of the bottle opening of the bottle to be inspected; Identify the bottle mouth region of the grayscale image of the bottle mouth and determine the reference fitting circle corresponding to the bottle mouth region; Based on the center of the reference fitted circle, the grayscale image of the bottle opening is divided into several image segmentation units according to the preset central angle. The bottle mouth edge scatter points corresponding to each image segmentation unit are obtained according to the preset edge detection algorithm; Based on the scattered points at the bottle mouth edge corresponding to each of the image segmentation units, defect detection is performed on the bottle to be detected. The step of obtaining the bottle mouth edge scatter points corresponding to each image segmentation unit according to the preset edge detection algorithm includes: Based on at least one line connecting the center of the reference fitted circle to the image edge, the pixel gradient value in each image segmentation unit is calculated in the line direction. The calculated pixel gradient values ​​are compared with the preset gradient threshold, and the bottle mouth edge scatter points corresponding to each image segmentation unit are obtained based on the comparison results. The defect detection of the bottle to be inspected based on the scatter points of the bottle mouth edge corresponding to each of the image segmentation units includes: Obtain the scatter points of the inner edge of the bottle opening and the scatter points of the outer edge of the bottle opening corresponding to each image segmentation unit; The inner fitting circle of the bottle opening of the bottle to be tested is determined based on the scatter points of all the inner edges of the bottle opening, and the outer fitting circle of the bottle opening of the bottle to be tested is determined based on the scatter points of all the outer edges of the bottle opening. Obtain the first radius to be measured corresponding to the fitted circle inside the bottle opening and the second radius to be measured corresponding to the fitted circle outside the bottle opening; compare the first radius to be measured and the second radius to be measured with the preset standard radius respectively, and determine whether the bottle to be tested has defects based on the comparison results; or, From all the scattered points on the inner edge of the bottle opening, abnormal scattered points on the inner edge of the bottle opening that deviate from the fitted circle on the inner edge of the bottle opening and whose deviation exceeds a preset first threshold are selected. The presence of a defect in the bottle to be tested is determined based on the proportion of abnormal scattered points on the inner edge of the bottle opening to all scattered points on the inner edge of the bottle opening. From all the scattered points on the outer edge of the bottle opening, abnormal scattered points on the outer edge of the bottle opening that deviate from the fitted circle on the outer edge of the bottle opening and whose deviation exceeds a preset second threshold are selected. The presence of a defect in the bottle to be tested is determined based on the proportion of abnormal scattered points on the outer edge of the bottle opening to all scattered points on the outer edge of the bottle opening.

2. The method for detecting bottle mouth defects according to claim 1, characterized in that, The step of performing defect detection on the bottle to be inspected based on the bottle mouth edge scatter points corresponding to each of the image segmentation units further includes: Obtain the bottle anchor point information from the grayscale image of the bottle opening; The defect location information of the bottle to be inspected is generated based on the positional correspondence between each of the abnormal scattered points on the bottle mouth edge and the bottle anchor point information; wherein, the abnormal scattered points on the bottle mouth edge include abnormal scattered points on the inner edge of the bottle mouth and abnormal scattered points on the outer edge of the bottle mouth.

3. The method for detecting bottle mouth defects according to claim 1, characterized in that, The step of acquiring the grayscale image of the bottle opening of the bottle to be detected includes: Acquire an initial image of the bottle to be detected, and identify the location of the bottle mouth region in the initial image; When the location of the bottle opening area is determined to be within the preset target detection range, a grayscale image of the bottle opening of the bottle to be detected is acquired.

4. The method for detecting bottle mouth defects according to claim 1, characterized in that, The step of identifying the bottle mouth region of the grayscale image of the bottle mouth and determining the reference fitting circle corresponding to the bottle mouth region includes: Identify the outer edge of the bottle mouth region in the grayscale image of the bottle mouth, and use a preset circle fitting operator to determine the reference fitting circle corresponding to the bottle mouth region based on the outer edge of the bottle mouth region.

5. A bottle mouth defect detection device, characterized in that, include: The image acquisition module is used to acquire a grayscale image of the bottle opening of the bottle to be detected; The benchmark fitting module is used to identify the bottle mouth region of the grayscale image of the bottle mouth and determine the benchmark fitting circle corresponding to the bottle mouth region. The unit segmentation module is used to divide the bottle mouth grayscale image into several image segmentation units based on the center of the fitted circle and according to the preset central angle. The edge detection module is used to obtain the bottle mouth edge scatter points corresponding to each image segmentation unit according to the preset edge detection algorithm; The defect detection module is used to perform defect detection on the bottle to be detected based on the bottle mouth edge scatter points corresponding to each of the image segmentation units; The edge detection module is specifically used for: Based on at least one line connecting the center of the reference fitted circle to the image edge, the pixel gradient value in each image segmentation unit is calculated in the line direction. The calculated pixel gradient values ​​are compared with the preset gradient threshold, and the bottle mouth edge scatter points corresponding to each image segmentation unit are obtained based on the comparison results. The defect detection module is specifically used for: Obtain the scatter points of the inner edge of the bottle opening and the scatter points of the outer edge of the bottle opening corresponding to each image segmentation unit; The inner fitting circle of the bottle opening of the bottle to be tested is determined based on the scatter points of all the inner edges of the bottle opening, and the outer fitting circle of the bottle opening of the bottle to be tested is determined based on the scatter points of all the outer edges of the bottle opening. Obtain the first radius to be measured corresponding to the fitted circle inside the bottle opening and the second radius to be measured corresponding to the fitted circle outside the bottle opening; compare the first radius to be measured and the second radius to be measured with the preset standard radius respectively, and determine whether the bottle to be tested has defects based on the comparison results; or, From all the scattered points on the inner edge of the bottle opening, abnormal scattered points on the inner edge of the bottle opening that deviate from the fitted circle on the inner edge of the bottle opening and whose deviation exceeds a preset first threshold are selected. The presence of a defect in the bottle to be tested is determined based on the proportion of abnormal scattered points on the inner edge of the bottle opening to all scattered points on the inner edge of the bottle opening. From all the scattered points on the outer edge of the bottle opening, abnormal scattered points on the outer edge of the bottle opening that deviate from the fitted circle on the outer edge of the bottle opening and whose deviation exceeds a preset second threshold are selected. The presence of a defect in the bottle to be tested is determined based on the proportion of abnormal scattered points on the outer edge of the bottle opening to all scattered points on the outer edge of the bottle opening.

6. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the bottle mouth defect detection method according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the bottle mouth defect detection method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • PE bottle detecting and sorting method based on machine vision

    CN106824816A

  • Machine vision-based online detection method for sealing defect of PE bottle opening

    CN106841229A