Cap sealing visual detection method, device and system applied to beverage bottle cap

By extracting and analyzing the edge feature points of the beverage bottle cap, calculating the gradient distribution index and feature key, combining edge symmetry, and determining the mass discrimination coefficient, the problem of high computational complexity of traditional detection methods is solved, and more efficient and accurate detection is achieved.

CN119741546AActive Publication Date: 2025-04-01KUNSHAN BAOSHUN PLASTIC COVER CO LTD

Patent Information

Application Number
CN202411811017.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-01
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

When processing the image of the beverage bottle cap, the traditional cap detection method has high computational complexity, resulting in a large matching time consumption, affecting the accuracy and efficiency of the detection.

Method used

By collecting standard cover images and cover images to be tested, edge feature points are extracted, gradient distribution index and feature keys are calculated, feature keys are screened, feature keys are combined with edge symmetry, quality discrimination coefficient is determined, and iterative processing is carried out to detect defects.

Benefits of technology

It improves the accuracy and efficiency of beverage bottle cap quality detection, reduces noise interference, and improves the efficiency of image matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741546A_ABST
    Figure CN119741546A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a cap sealing visual detection method, device and system applied to a beverage bottle cap, and the method comprises the steps: collecting a standard cap sealing image after a beverage bottle is sealed, and a to-be-detected cap sealing image in each direction; respectively extracting feature points on the edge contours in the standard seal cover image and the to-be-detected seal cover image to form a standard edge sequence and a to-be-detected edge sequence; determining a gradient distribution index of any edge feature point; determining the feature criticality of any edge feature point; determining the edge symmetry degree of the to-be-detected sealing cover image in each direction; obtaining each feature key point; determining a quality discrimination coefficient of the beverage bottle cap; and performing iteration processing on the edge feature points in the to-be-detected edge sequence, re-screening feature key points, and based on the quality discrimination coefficient of each iteration, detecting the defect of the beverage bottle sealing cover. According to the invention, the accuracy of beverage bottle cap quality detection can be improved, and the image matching efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a cap visual inspection method, device and system for beverage bottle caps. Background Art

[0002] Beverage bottle caps are a common packaging material, widely used in food, medicine, and beverage industries. Therefore, there will be some defects in the capping process of beverage bottle caps, such as high caps, crooked caps, and no caps. These defects will affect the sealing performance of beverage bottles, not only affecting the quality of the product, but may even cause food and beverages to be contaminated.

[0003] With the development of industrial automation, in the process of detecting the caps of beverage bottle caps, the traditional cap detection method mainly matches the image through feature point detection; when matching the cap images of beverage bottles, due to the excessive and dense feature points extracted, not only will unimportant feature points such as noise in the image be mistakenly regarded as valid, resulting in incorrect matching results, but also the matching process will have high computational complexity and consume a lot of matching time, which will affect the accuracy of matching and the accuracy and efficiency of quality inspection of beverage bottle caps. Summary of the invention

[0004] In order to solve the above technical problems, a capping visual inspection method, device and system for beverage bottle caps are provided to solve the existing problems.

[0005] The solution to the technical problem of this application is to provide a capping visual inspection method, device and system for beverage bottle caps, including the following steps:

[0006] In a first aspect, an embodiment of the present application provides a cap visual inspection method for beverage bottle caps, the method comprising the following steps:

[0007] Collect the standard capping image of the beverage bottle after capping, and the capping image to be tested in each orientation; respectively extract the feature points located on the edge contour of the standard capping image and the capping image to be tested in each orientation to form a standard edge sequence and an edge sequence to be tested corresponding to the capping image to be tested in each orientation;

[0008] Determine the gradient distribution index of any edge feature point in the edge sequence to be tested corresponding to the capping image to be tested in each orientation and the gradient difference of the edge feature points in its local neighborhood, and the discreteness of its gradient distribution;

[0009] Analyze the change of the bending angle of any edge feature point on the corresponding edge contour, and determine the feature criticality of any edge feature point in combination with the gradient distribution index;

[0010] Determining the edge symmetry of the capping image to be tested in each orientation according to the degree of symmetric change of the gradients of all edge feature points in the edge sequence to be tested;

[0011] Based on the feature criticality, the edge feature points in the edge sequence to be tested are screened to obtain each feature key point; the distance difference between the feature key points between the cover image to be tested and the standard cover image in all directions is analyzed, and the quality discrimination coefficient of the beverage bottle cap is determined in combination with the edge symmetry; the edge feature points in the edge sequence to be tested are iteratively processed, the feature key points are re-screened, and the defects of the beverage bottle cap are detected based on the quality discrimination coefficient obtained after each iteration.

[0012] Preferably, the method for acquiring the standard edge sequence and the edge sequence to be tested corresponding to the capping image to be tested in each orientation is:

[0013] A feature point detection algorithm is used to extract feature points from the standard capping image and the capping image to be tested at each orientation. Edge detection is performed on the standard capping image and the capping image to be tested at each orientation, and the edge contour with the largest area is recorded as the boundary contour. Feature points located on the boundary contour are selected and recorded as edge feature points.

[0014] Taking the edge feature points at preset positions in the standard capping image and the capping image to be tested in each orientation as starting points, all edge feature points in the standard capping image and the capping image to be tested in each orientation are sequentially combined into a standard edge sequence and an edge sequence to be tested corresponding to the capping image to be tested in each orientation.

[0015] Preferably, determining the gradient distribution index of any edge feature point includes:

[0016] Taking any edge feature point as the center, a local window of a preset size is set; calculating the discrete degree of the gradients of all edge feature points within the local window of any edge feature point;

[0017] Calculate the difference between the gradient of any edge feature point and the gradient of each edge feature point in its local window, record it as the gradient difference, and record the average of the gradient differences between any edge feature point and all edge feature points in its local window as the average gradient difference of any edge feature point;

[0018] The product of the discrete degree and the average gradient difference is used as the gradient distribution index of any edge feature point.

[0019] Preferably, determining the feature criticality of any edge feature point includes:

[0020] A rectangular coordinate system is constructed by taking the pixel point at a preset position in the capping image to be tested in each orientation as the coordinate origin;

[0021] Linearly fit the position coordinates of multiple edge pixel points on the left side of any edge feature point on the boundary contour of the capping image to be tested in each orientation, and select a coordinate position from the fitting line, which is recorded as the left coordinate point;

[0022] Linearly fit the position coordinates of multiple edge pixel points on the right side of any edge feature point on the boundary contour of the capping image to be tested in each orientation, and select a coordinate position from the fitting line, which is recorded as the right side coordinate point;

[0023] The position coordinates of any edge feature point and the direction vectors between the left coordinate point and the right coordinate point are recorded as the left vector and the right vector respectively; the cosine value of the angle between the left vector and the right vector is used as the corner point characterization degree of any edge feature point;

[0024] The product of the gradient distribution index and the corner point characterization degree is used as the feature criticality of any edge feature point.

[0025] Preferably, the step of determining the edge symmetry of the cover image to be tested in each orientation includes:

[0026] The edge feature points in the edge sequence to be tested are reversed to be recorded as a reversed edge sequence; the difference between the gradients of the edge feature points of the same dimension in the edge sequence to be tested and the reversed edge sequence is used to form a relative difference sequence;

[0027] The cumulative sum of all elements in the relative difference sequence is calculated; and the result of an exponential function with a natural constant as the base and the opposite number of the cumulative sum as the exponent is used as the edge symmetry of the cover image to be tested in each orientation.

[0028] Preferably, the obtaining of each characteristic key point includes:

[0029] The edge feature points whose feature criticality is greater than or equal to a preset initial threshold in the edge sequence to be tested corresponding to the cover image to be tested in each orientation are recorded as feature key points.

[0030] Preferably, the method of determining the quality discrimination coefficient of the beverage bottle cap comprises:

[0031] The calculation method of the relative matching degree of the capping image to be tested in each orientation is: Among them, PP k is the relative matching degree of the capping image to be tested at the kth orientation, ds k is the edge symmetry of the capping image to be tested at the kth orientation, A k,gis the position coordinate of the gth feature key point in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, B g is the position coordinate of the gth edge feature point in the standard edge sequence corresponding to the standard capping image, d() represents the calculated distance, m k is the number of all characteristic key points in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, and expδ() is an exponential function with a natural constant as the base;

[0032] The average of the relative matching degrees of the capping images to be tested in all directions is used as the quality discrimination coefficient of the beverage bottle cap.

[0033] Preferably, iterative processing is performed on edge feature points in the edge sequence to be tested, feature key points are re-screened, and defects of beverage bottle caps are detected based on the quality discrimination coefficient of each iteration, including:

[0034] If the quality discrimination coefficient is greater than or equal to the preset first threshold, the beverage bottle cap does not have defects. Otherwise, the preset initial threshold is iteratively adjusted, and the adjustment threshold of each iteration is: α u =a0-u×Δa, where α u is the adjustment threshold of the u-th iteration, a0 is the preset initial threshold, u is the number of iterations, and Δa is the preset step size;

[0035] Based on the adjustment threshold of each iteration, the feature key points are re-screened from the edge sequence to be tested corresponding to the capping image to be tested in each orientation, and the quality discrimination coefficient of the beverage bottle cap in each iteration is calculated;

[0036] The iterative effectiveness of each iteration is calculated as: Among them, f u+1 is the iteration validity of the u+1th iteration, δ u+1 is the quality discrimination coefficient of the beverage bottle cap at the u+1th iteration, δ u is the quality discrimination coefficient of the beverage bottle cap at the uth iteration;

[0037] If the iteration validity is less than the preset second threshold, the iteration is stopped. If the quality discrimination coefficient of the beverage bottle cap in the previous iteration is less than the preset first threshold, the beverage bottle cap is defective. Otherwise, the beverage bottle cap is not defective.

[0038] In a second aspect, an embodiment of the present application further provides a visual inspection device for beverage bottle caps, wherein a computer program is stored in the device, and the computer program is executed by a processor to implement the steps of any one of the above-mentioned visual inspection methods for beverage bottle caps.

[0039] In a third aspect, an embodiment of the present application further provides a visual inspection system for beverage bottle caps, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the system implements any of the steps of the visual inspection method for beverage bottle caps described above.

[0040] This application has at least the following beneficial effects:

[0041] The present application determines the gradient distribution index of any edge feature point in the edge sequence to be tested and its local neighborhood corresponding to the capping image to be tested in each orientation according to the gradient difference and the discreteness of the gradient distribution of any edge feature point in the edge sequence to be tested and the edge feature points in its local neighborhood. The beneficial effect of this application is that the gradient change of the edge feature points corresponding to different positions in the capping image to be tested is taken into account to reflect the complexity of the gradient distribution of the corresponding edge feature point and the other edge feature points, thereby explaining the uniqueness of the corresponding edge feature point; the change of the bending angle of any edge feature point on the corresponding edge contour is analyzed, and the feature criticality of any edge feature point is determined in combination with the gradient distribution index. The beneficial effect of this application is that the change of the bending angle at the corresponding position of the edge feature point on the edge contour where the edge feature point is located is taken into account to reflect the possibility that the corresponding edge feature point is a corner point, thereby explaining the importance of the feature information contained in the corresponding edge feature point; the capping image to be tested in each orientation is determined according to the degree of symmetrical change of the gradients of all edge feature points in the edge sequence to be tested. The edge symmetry of the embodiment of the present invention is to consider the symmetry of the gradient change of different edge feature points, reflect the symmetry of the bottle cap in the capping image to be tested, and explain the possibility of tilt of the beverage bottle cap in the capping image to be tested; based on the feature key degree, the edge feature points in the edge sequence to be tested are screened to obtain each feature key point; the distance difference between the feature key points of the capping images to be tested and the standard capping images in all directions is analyzed, and the quality discrimination coefficient of the beverage bottle cap is determined in combination with the edge symmetry, which has the beneficial effect of considering the matching between the capping images to be tested and the standard capping images in different directions to reflect whether the beverage bottle cap has defects; the edge feature points in the edge sequence to be tested are iteratively processed, the feature key points are re-screened, and the defects of the beverage bottle cap are detected based on the quality discrimination coefficient obtained after each iteration, which has the beneficial effect of continuously screening the feature key points, reducing the interference of unimportant feature points such as noise, and improving the accuracy of quality detection of beverage bottle caps, which is conducive to improving the efficiency of image matching. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The capping visual inspection method for beverage bottle caps of the present application is further described in detail below with reference to the accompanying drawings.

[0043] Figure 1A flowchart of the steps of a cap visual inspection method for beverage bottle caps provided in an embodiment of the present application;

[0044] Figure 2 A flowchart of the steps of a method for obtaining a gradient distribution index of any edge feature point in a to-be-tested edge sequence corresponding to a to-be-tested capping image in each orientation provided in an embodiment of the present application;

[0045] Figure 3 A flowchart of the steps of a method for acquiring the feature criticality of any edge feature point in the edge sequence to be tested corresponding to the cover image to be tested in each orientation provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the following is a further detailed description of the capping visual inspection method, device and system for beverage bottle caps proposed in the present application in conjunction with the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0047] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0048] See also Figure 1 , which shows a flowchart of a method for visual inspection of beverage bottle caps provided by an embodiment of the present application, the method comprising the following steps:

[0049] Step 1: Collect the standard capping image of the beverage bottle after capping, and the capping image to be tested in each orientation.

[0050] The standard capping images of beverage bottles in the beverage production process are collected by industrial cameras. Secondly, industrial cameras are placed at multiple positions at the exit of the capping process of beverage bottles to collect capping images of beverage bottles on the conveyor belt at different positions. The collected images are denoised and grayed to obtain standard capping images and capping images to be tested at each position.

[0051] Preferably, in this embodiment, four industrial cameras are placed around the beverage bottle to collect capping images in four directions. Secondly, a median filtering algorithm is used for denoising. The median filtering algorithm is a well-known technology and will not be described in detail here. As other implementation methods, the implementer can adopt other methods of the prior art, such as the mean filtering algorithm, etc. This embodiment does not impose any special restrictions on this.

[0052] At this point, the standard capping image and the capping image to be tested in each orientation are obtained.

[0053] Step 2: Determine the gradient distribution index of any edge feature point according to the gradient difference of any edge feature point in the edge sequence to be tested and the edge feature points in its local neighborhood corresponding to the capping image to be tested in each orientation, and the discreteness of its gradient distribution.

[0054] Edges are important features of the shape and outline of objects. By extracting edge information, the appearance of beverage bottle caps can be more accurately identified. Feature points are areas with obvious changes in the image. They are important features of objects and can effectively describe the shape and structure of beverage bottle caps.

[0055] A feature point detection algorithm is used to extract feature points from the standard capping image and the capping image to be tested at each orientation;

[0056] Preferably, in this embodiment, the SIFT (Scale Invariant Feature Transform) algorithm is used for feature point detection, wherein the SIFT algorithm is a well-known technology and will not be described in detail here. As other implementation methods, the implementer can adopt other methods of the prior art, such as the SURF algorithm, etc. This embodiment does not impose any special restrictions on this.

[0057] Perform edge detection on the standard capping image and the capping image to be tested in each orientation, record the edge contour with the largest area as the boundary contour; select feature points located on the boundary contour and record them as edge feature points;

[0058] Taking the edge feature point at the bottom left position of the standard capping image and the capping image to be tested at each orientation as the starting point, all edge feature points in the standard capping image and the capping image to be tested at each orientation are respectively combined into a standard edge sequence and an edge sequence to be tested corresponding to the capping image to be tested at each orientation in a clockwise order;

[0059] Preferably, in this embodiment, the Canny edge detection algorithm is used for edge detection, wherein the Canny edge detection algorithm is a well-known technology and will not be described in detail here. As other implementation methods, the implementer can adopt other methods of the prior art, such as the Sobel operator, etc. This embodiment does not impose any special restrictions on this.

[0060] The flowchart of the steps of the method for obtaining the gradient distribution index of any edge feature point in the edge sequence to be tested corresponding to the capping image to be tested in each orientation provided by the embodiment of the present application is as follows: Figure 2 shown.

[0061] Furthermore, the gradient of the edge information of the beverage bottle body usually shows a large grayscale gradient change, and as the shape of the bottle body and the bottle mouth changes, the feature points at different positions show inconsistent grayscale gradients. Therefore, by analyzing the local gradient changes of the edge feature points in the edge sequence to be tested, the gradient distribution index is determined, which is:

[0062] A local window of a preset size is set with any edge feature point in the edge sequence to be measured corresponding to the capping image to be measured in each orientation as the center;

[0063] Preferably, in this embodiment, the size of the local window is set to 11. As other implementation methods, the implementer can set it according to actual conditions.

[0064] Calculating the discrete degree of the gradients of all edge feature points within the local window of any edge feature point;

[0065] Preferably, in this embodiment, the information entropy of the gradients of all edge feature points within the local window of any edge feature point is calculated, wherein the calculation of information entropy is a well-known technology and will not be repeated here. As other implementation methods, the implementer may adopt other methods of the prior art to measure the degree of discreteness, such as variance, standard deviation, coefficient of variation, etc. This embodiment does not impose any special restrictions on this.

[0066] Calculate the difference between the gradient of any edge feature point and the gradient of each edge feature point in its local window, record it as the gradient difference, and record the average of the gradient differences between any edge feature point and all edge feature points in its local window as the average gradient difference of any edge feature point;

[0067] Preferably, in this embodiment, the absolute value of the difference between the gradient of any edge feature point and the gradient of each edge feature point in its local window is calculated, and the average of the absolute values ​​between any edge feature point and all edge feature points in its local window is recorded as the average gradient difference of any edge feature point.

[0068] The product of the discrete degree and the average gradient difference is used as the gradient distribution index of any edge feature point in the edge sequence to be tested corresponding to the capping image to be tested in each orientation;

[0069] Preferably, in this embodiment, the calculation formula of the gradient distribution index of any edge feature point in the edge sequence to be measured corresponding to the capping image to be measured in each orientation is: Among them, F k,i is the gradient distribution index of the i-th edge feature point in the edge sequence to be tested corresponding to the capping image to be tested at the k-th orientation, σ k,iis the degree of discreteness of the gradient of all edge feature points in the local window of the ith edge feature point in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, that is, the information entropy, t k,i is the gradient of the i-th edge feature point in the edge sequence to be tested corresponding to the capping image to be tested at the k-th orientation, t k,j The gradient of the jth edge feature point in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, n k is the number of all edge feature points in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation; secondly, is the average gradient difference.

[0070] It should be noted that the greater the discreteness, the more drastic the gradient change of the edge feature points in the local window, which reflects that the gradient distribution of the edge feature points in the local window is more dispersed; secondly, The larger it is, the greater the difference in gradient between the i-th edge feature point and the rest of the edge feature points in its local window. The larger the obtained gradient distribution index is, the more complex the gradient distribution of the edge feature points in the local window is, reflecting that the corresponding edge feature point is more different from other edge feature points, indicating that the corresponding edge feature point is more unique.

[0071] At this point, the gradient distribution index of any edge feature point in the edge sequence to be measured corresponding to the capping image to be measured in each orientation is obtained.

[0072] Step 3: Analyze the change of the bending angle of any edge feature point on the corresponding edge contour, and determine the feature criticality of any edge feature point in combination with the gradient distribution index.

[0073] The flowchart of the steps of the method for obtaining the feature criticality of any edge feature point in the edge sequence to be tested corresponding to the cover image to be tested in each orientation provided by the embodiment of the present application is as follows: Figure 3 shown.

[0074] First, when the angle between the curves formed by the edge pixels on the left and right sides of the edge feature point is larger, it means that the angle change at the corresponding edge feature point is more moderate. When the angle between the curves formed by the edge pixels on the left and right sides of the edge feature point is smaller, it means that the angle change at the corresponding edge feature point is more drastic. The angle formed by the pixels on both sides reflects the degree of change of the edge information at the bottle mouth feature point. When the angle between the left and right curves is larger, it means that the angle change at the feature point is more moderate. Therefore, the drastic angle change of each edge feature point on the boundary contour in the capping image to be tested is analyzed to determine the corner point characterization degree, which is specifically:

[0075] A rectangular coordinate system is constructed by taking the pixel point at the lower left position in the capping image to be tested in each orientation as the coordinate origin;

[0076] Linearly fit the position coordinates of multiple edge pixel points on the left side of any edge feature point on the boundary contour of the capping image to be tested in each orientation, and select a coordinate position from the fitting line, which is recorded as the left coordinate point;

[0077] Linearly fit the position coordinates of multiple edge pixel points on the right side of any edge feature point on the boundary contour of the capping image to be tested in each orientation, and select a coordinate position from the fitting line, which is recorded as the right side coordinate point;

[0078] Preferably, in this embodiment, the position coordinates of 10 edge pixel points on the left side of any edge feature point on the boundary contour in the cover image to be tested in each orientation are linearly fitted; the position coordinates of 10 edge pixel points on the right side of any edge feature point on the boundary contour in the cover image to be tested in each orientation are linearly fitted. As other implementation methods, the implementer can set them according to actual conditions; secondly, the least squares method is used for linear fitting, wherein the least squares method is a well-known technology and will not be described in detail here.

[0079] The direction vectors between the position coordinates of any edge feature point and the left coordinate point and the right coordinate point are recorded as the left vector and the right vector respectively;

[0080] The cosine value of the angle between the left vector and the right vector is used as the corner point representation degree of any edge feature point;

[0081] It should be noted that the calculation of the angle between vectors is a well-known technique and will not be described in detail here.

[0082] It should be noted that, the smaller the corner point representation degree is, the larger the angle between the left vector and the right vector of the corresponding edge feature point is, the smoother the angle trend change of the corresponding edge feature point is, and the corresponding edge feature point is more likely to be a smooth transition point; the larger the corner point representation degree is, the smaller the angle between the left vector and the right vector of the corresponding edge feature point is, the more extreme the angle trend change of the corresponding edge feature point is, and the greater the possibility that the corresponding edge feature point is a corner point is, indicating that the feature information of the corresponding edge feature point is more important.

[0083] Further, based on the gradient distribution index and the corner point characterization degree, the feature criticality is determined, specifically:

[0084] The product of the gradient distribution index and the corner point characterization degree is used as the feature criticality of any edge feature point;

[0085] It should be noted that the greater the obtained feature criticality, the more important the feature information of the corresponding edge feature point is, which is beneficial to improving the matching accuracy and calculation efficiency of subsequent beverage bottle cap features.

[0086] At this point, the feature criticality of any edge feature point is obtained.

[0087] Step 4: determining the edge symmetry of the capping image to be tested in each orientation according to the degree of symmetric change of the gradients of all edge feature points in the edge sequence to be tested.

[0088] In the standard capping image, the two sides of the bottle cap are symmetrical along the central axis. Therefore, if the elements in the edge sequence to be tested in each orientation also have symmetry, the higher the matching degree between the corresponding capping image to be tested and the standard capping image, the smaller the possibility of defects in the capping image to be tested. Therefore, the symmetry of the elements in the edge sequence to be tested is analyzed to determine the edge symmetry, which is specifically:

[0089] Reversing the edge feature points in the edge sequence to be tested corresponding to the capping image to be tested in each orientation, and recording it as a reversed edge sequence;

[0090] The difference between the gradients of edge feature points of the same dimension in the edge sequence to be tested and the reverse edge sequence is used to form a relative difference sequence;

[0091] Preferably, in this embodiment, the sum of squares of differences between the gradients of edge feature points of the same dimension in the edge sequence to be detected and the inverted edge sequence is used to form a relative difference sequence.

[0092] Calculate the cumulative sum of all elements in the relative difference sequence; use the result of an exponential function with a natural constant as the base and the opposite number of the cumulative sum as the exponent as the edge symmetry of the cover image to be tested in each orientation;

[0093] Preferably, in this embodiment, the calculation formula for the edge symmetry of the cover image to be tested in each orientation is: Among them, ds k is the edge symmetry of the capping image to be tested at the kth orientation, t k,h is the gradient of the hth edge feature point in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, ft k,h is the gradient of the hth edge feature point in the reverse edge sequence corresponding to the capping image to be tested at the kth orientation, n k is the number of all edge feature points in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, and exp() is an exponential function with a natural constant as the base.

[0094] It should be noted that, for ease of understanding, assuming that the edge sequence to be tested corresponding to the capping image to be tested in a certain orientation is [a, b, c, d, e], then the reverse edge sequence is [e, d, c, b, a]. If the gradients of the edge feature points a, b, c, d, e are t a ,tb ,t c ,t d ,t e The difference in the gradient of the corresponding position between the edge sequence to be tested and the reverse edge sequence is composed of the relative difference sequence [(t a -t e ) 2 ,(t b -t d ) 2 ,(t c -t c ) 2 ,(t d -t b ) 2 ,(t e -t a ) 2 ].

[0095] It should be noted that the larger the cumulative sum is, the greater the gradient difference between the edge feature points in the edge sequence to be tested and its inverted edge sequence is, and the smaller the obtained edge symmetry is, which means that in the corresponding cap image to be tested, the two sides of the bottle cap are more asymmetrical, and the degree of matching with the standard cap image is lower, reflecting the greater the possibility of defects in the bottle cap packaging process in the cap image to be tested.

[0096] At this point, the edge symmetry of the cover image to be tested in each orientation is obtained.

[0097] Step 5, based on the feature criticality, screen the edge feature points in the edge sequence to be tested to obtain each feature key point; analyze the distance difference between the feature key points between the cover image to be tested and the standard cover image in all directions, and determine the quality discrimination coefficient of the beverage bottle cap in combination with the edge symmetry; iteratively process the edge feature points in the edge sequence to be tested, re-screen the feature key points, and detect the defects of the beverage bottle cap based on the quality discrimination coefficient obtained after each iteration.

[0098] Further, based on the feature criticality, the edge feature points are iteratively screened, specifically:

[0099] Record the edge feature points whose feature criticality is greater than or equal to a preset initial threshold value in the edge sequence to be tested corresponding to the capping image to be tested in each orientation as feature key points;

[0100] Preferably, in this embodiment, the preset initial threshold value is 0.5. As other implementation modes, the implementer can set it according to the actual situation.

[0101] Further, the distance between the characteristic key points of the capping image to be tested and the standard capping image in each orientation is analyzed, and the relative matching degree is determined in combination with the edge symmetry, specifically:

[0102] The calculation method of the relative matching degree of the capping image to be tested in each orientation is: Among them, PP k is the relative matching degree of the capping image to be tested at the kth orientation, ds k is the edge symmetry of the capping image to be tested at the kth orientation, A k,g is the position coordinate of the gth feature key point in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, B g is the position coordinate of the gth edge feature point in the standard edge sequence corresponding to the standard capping image, d() represents the calculated distance, m k is the number of all feature key points in the edge sequence to be tested corresponding to the capping image to be tested in the kth orientation, and exp() is an exponential function with a natural constant as the base.

[0103] It should be noted that, the greater the relative matching degree is, the more the corresponding cover image to be tested matches the standard cover image, and the lower the possibility of quality defects in the corresponding cover image to be tested is.

[0104] Further, based on the relative matching degree of the capping images to be tested in different orientations, the quality discrimination coefficient of the beverage bottle is determined, specifically:

[0105] The average of the relative matching degrees of the capping images to be tested in all directions is used as the quality discrimination coefficient of the beverage bottle cap;

[0106] If the quality discrimination coefficient is greater than or equal to the preset first threshold, the beverage bottle cap has no defects. Otherwise, the preset initial threshold is iteratively adjusted, and the threshold adjusted for each iteration is: α u =a0-u×Δa, where α u is the adjustment threshold of the u-th iteration, a0 is the preset initial threshold, u is the number of iterations, Δa is the preset step size. In this embodiment, the preset step size Δa is 0.05. As other implementation methods, the implementer can set it according to the actual situation.

[0107] Based on the adjustment threshold of each iteration, the feature key points are re-screened from the edge sequence to be tested corresponding to the capping image to be tested in each orientation, and the quality discrimination coefficient of the beverage bottle cap in each iteration is calculated;

[0108] The iterative effectiveness of each iteration is calculated as: Among them, f u+1 is the iteration validity of the u+1th iteration, δ u+1 is the quality discrimination coefficient of the beverage bottle cap at the u+1th iteration, δ u is the quality discrimination coefficient of beverage bottle caps at the uth iteration.

[0109] If the iteration validity is less than the preset second threshold, the iteration is stopped. If the quality discrimination coefficient of the beverage bottle cap in the previous iteration is less than the preset first threshold, the beverage bottle cap is defective. Otherwise, the beverage bottle cap is not defective.

[0110] Preferably, in this embodiment, the preset first threshold value is 0.8, and the preset second threshold value is 1. As other implementation modes, implementers can set them according to actual conditions.

[0111] An embodiment of the present application also provides a visual inspection device for beverage bottle caps, wherein a computer program is stored in the device, and the computer program is executed by a processor to implement the steps of any one of the above-mentioned visual inspection methods for beverage bottle caps.

[0112] Based on the same inventive concept as the above-mentioned method, an embodiment of the present application also provides a visual inspection system for beverage bottle caps, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of any one of the above-mentioned visual inspection methods for beverage bottle caps when executing the computer program.

[0113] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0114] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0115] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the present application. It should be pointed out that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application without departing from the content of the technical solution of the present application, shall fall within the protection scope of the technical solution of the present application.

Claims

1. A visual inspection method for beverage bottle caps, characterized in that: The method comprises the following steps: Collect the standard capping image of the beverage bottle after capping, and the capping image to be tested in each orientation; respectively extract the feature points located on the edge contour of the standard capping image and the capping image to be tested in each orientation to form a standard edge sequence and an edge sequence to be tested corresponding to the capping image to be tested in each orientation; Determine the gradient distribution index of any edge feature point in the edge sequence to be tested corresponding to the capping image to be tested in each orientation and the gradient difference of the edge feature points in its local neighborhood, and the discreteness of its gradient distribution; Analyze the change of the bending angle of any edge feature point on the corresponding edge contour, and determine the feature criticality of any edge feature point in combination with the gradient distribution index; Determining the edge symmetry of the capping image to be tested in each orientation according to the degree of symmetric change of the gradients of all edge feature points in the edge sequence to be tested; Based on the feature criticality, the edge feature points in the edge sequence to be tested are screened to obtain each feature key point; the distance difference between the feature key points between the cover image to be tested and the standard cover image in all directions is analyzed, and the quality discrimination coefficient of the beverage bottle cap is determined in combination with the edge symmetry; the edge feature points in the edge sequence to be tested are iteratively processed, the feature key points are re-screened, and the defects of the beverage bottle cap are detected based on the quality discrimination coefficient obtained after each iteration.

2. The capping visual inspection method for beverage bottle caps according to claim 1, characterized in that: The method for acquiring the standard edge sequence and the edge sequence to be tested corresponding to the capping image to be tested in each orientation is as follows: A feature point detection algorithm is used to extract feature points from the standard capping image and the capping image to be tested at each orientation. Edge detection is performed on the standard capping image and the capping image to be tested at each orientation, and the edge contour with the largest area is recorded as the boundary contour. Select the feature points on the boundary contour and record them as edge feature points; Taking the edge feature points at preset positions in the standard capping image and the capping image to be tested in each orientation as starting points, all edge feature points in the standard capping image and the capping image to be tested in each orientation are sequentially combined into a standard edge sequence and an edge sequence to be tested corresponding to the capping image to be tested in each orientation.

3. The capping visual inspection method for beverage bottle caps according to claim 1, characterized in that: The determining of the gradient distribution index of any edge feature point comprises: Taking any edge feature point as the center, a local window of a preset size is set; calculating the discrete degree of the gradients of all edge feature points within the local window of any edge feature point; Calculate the difference between the gradient of any edge feature point and the gradient of each edge feature point in its local window, record it as the gradient difference, and record the average of the gradient differences between any edge feature point and all edge feature points in its local window as the average gradient difference of any edge feature point; The product of the discrete degree and the average gradient difference is used as the gradient distribution index of any edge feature point.

4. The capping visual inspection method for beverage bottle caps according to claim 2, characterized in that: The determining of the feature criticality of any edge feature point comprises: A rectangular coordinate system is constructed by taking the pixel point at a preset position in the cover image to be tested in each orientation as the coordinate origin; Linearly fit the position coordinates of multiple edge pixel points on the left side of any edge feature point on the boundary contour of the capping image to be tested in each orientation, and select a coordinate position from the fitting line, which is recorded as the left coordinate point; Linearly fit the position coordinates of multiple edge pixel points on the right side of any edge feature point on the boundary contour of the capping image to be tested in each orientation, and select a coordinate position from the fitting line, which is recorded as the right side coordinate point; The position coordinates of any edge feature point and the direction vectors between the left coordinate point and the right coordinate point are recorded as the left vector and the right vector respectively; the cosine value of the angle between the left vector and the right vector is used as the corner point characterization degree of any edge feature point; The product of the gradient distribution index and the corner point characterization degree is used as the feature criticality of any edge feature point.

5. The capping visual inspection method for beverage bottle caps according to claim 1, characterized in that: The step of determining the edge symmetry of the capping image to be tested in each orientation includes: The edge feature points in the edge sequence to be tested are reversed to be recorded as a reversed edge sequence; the difference between the gradients of the edge feature points of the same dimension in the edge sequence to be tested and the reversed edge sequence is used to form a relative difference sequence; The cumulative sum of all elements in the relative difference sequence is calculated; and the result of an exponential function with a natural constant as the base and the opposite number of the cumulative sum as the exponent is used as the edge symmetry of the cover image to be tested in each orientation.

6. The capping visual inspection method for beverage bottle caps according to claim 1, characterized in that: The step of obtaining each feature key point includes: The edge feature points whose feature criticality is greater than or equal to a preset initial threshold in the edge sequence to be tested corresponding to the cover image to be tested in each orientation are recorded as feature key points.

7. The capping visual inspection method for beverage bottle caps according to claim 1, characterized in that: The method of determining the quality discrimination coefficient of the beverage bottle cap comprises: The calculation method of the relative matching degree of the capping image to be tested in each orientation is: Among them, PP k is the relative matching degree of the capping image to be tested at the kth orientation, ds k is the edge symmetry of the capping image to be tested at the kth orientation, A k,g is the position coordinate of the gth feature key point in the edge sequence to be tested corresponding to the capping image to be tested at the kth orientation, B g is the position coordinate of the gth edge feature point in the standard edge sequence corresponding to the standard capping image, d() represents the calculated distance, m k is the number of all feature key points in the edge sequence to be tested corresponding to the capping image to be tested at the k-th orientation, and exp() is an exponential function with a natural constant as the base; The average of the relative matching degrees of the capping images to be tested in all directions is used as the quality discrimination coefficient of the beverage bottle cap.

8. The capping visual inspection method for beverage bottle caps according to claim 6, characterized in that: Iteratively processing the edge feature points in the edge sequence to be tested, re-screening the feature key points, and detecting the defects of the beverage bottle cap based on the quality discrimination coefficient of each iteration, including: If the quality discrimination coefficient is greater than or equal to the preset first threshold, the beverage bottle cap does not have defects. Otherwise, the preset initial threshold is iteratively adjusted, and the adjustment threshold of each iteration is: α u =a0-u×Δa, where α u is the adjustment threshold of the u-th iteration, a0 is the preset initial threshold, u is the number of iterations, and Δa is the preset step size; Based on the adjustment threshold of each iteration, the feature key points are re-screened from the edge sequence to be tested corresponding to the capping image to be tested in each orientation, and the quality discrimination coefficient of the beverage bottle cap in each iteration is calculated; The iterative effectiveness of each iteration is calculated as: Among them, f u+1 is the iteration validity of the u+1th iteration, δ u+1 is the quality discrimination coefficient of the beverage bottle cap at the u+1th iteration, δ u is the quality discrimination coefficient of the beverage bottle cap at the uth iteration; If the iteration validity is less than the preset second threshold, the iteration is stopped. If the quality discrimination coefficient of the beverage bottle cap in the previous iteration is less than the preset first threshold, the beverage bottle cap is defective. Otherwise, the beverage bottle cap is not defective.

9. A visual inspection device for beverage bottle caps, wherein a computer program is stored in the device, characterized in that: When the computer program is executed by a processor, the steps of the cap visual inspection method applied to beverage bottle caps as claimed in any one of claims 1 to 8 are implemented.

10. A capping visual inspection system for beverage bottle caps, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the cap visual inspection method applied to beverage bottle caps as claimed in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Hardware defect classification and identification method based on artificial intelligence

    CN117237747A

  • Bottled product sealing cover detection method based on deep learning

    CN118298247A

  • Method for edge detection

    US20180047167A1

Cited By

  • Beer sealing cover defect identification method based on image intelligent identification

    CN120635017A

  • Intelligent visual positioning method for metal forging and pressing piece based on intelligent robot

    CN122023315A

  • Intelligent Visual Positioning Method for Metal Forgings Based on Intelligent Robots

    CN122023315B

  • A pesticide bottle cap flaw detection method and system on a quality inspection production line

    CN122617876A

  • A pesticide bottle cap flaw detection method and system on a quality inspection production line

    CN122617876B