Machine vision quality detection method for infusion container combined cover

By clustering and weighting the edge point set of the combination cover image and iteratively optimizing the fitting circle, the problem of inaccurate detection under the influence of the pull ring is solved, and more accurate combination cover quality detection is achieved.

CN119671997BActive Publication Date: 2025-10-24HANGZHOU YUANQI INTELLIGENT EQUIPMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411752012.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-10-24
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

When detecting combination covers, the existing RANSAC algorithm results in inaccurate detection due to the presence of pull rings.

Method used

By obtaining the edge point set of the combined cover image, clustering is performed using K-means and elbow methods to distinguish the combined cover edge point clusters from the reference clusters, calculating the fit degree and reference weight of the edge points, iteratively optimizing the fitting circle, reducing the pull ring interference, and improving the detection accuracy.

Benefits of technology

The accuracy of quality inspection of the combination cover is improved, the interference of the pull ring on the fitting circle algorithm is reduced, and a fitting result that is more consistent with the actual edge of the combination cover is obtained.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119671997B_ABST
    Figure CN119671997B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image data processing, and discloses a machine vision quality detection method for a combined cover of an infusion container, which comprises the following steps: acquiring an edge point set; obtaining a temporary center point of the combined cover according to the edge point set; acquiring a combined cover edge probability, a combined cover edge point cluster class and a reference cluster class; obtaining a temporary radius of the combined cover according to the combined cover edge point cluster class; obtaining a correlation degree according to the reference cluster class and the combined cover edge point cluster class; obtaining a reference weight according to the correlation degree and the combined cover edge probability; obtaining a fitting degree according to the temporary center point of the combined cover and the temporary radius of the combined cover; obtaining a temporary optimal fitting probability according to the fitting degree of the edge point and the reference weight; iteratively obtaining an optimal fitting circle; and obtaining a visual quality detection result of the combined cover according to the optimal fitting circle. The quality of the combined cover is detected by the optimal fitting circle, so that the quality detection result is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image data processing, in particular to a machine vision quality detection method for a combination cover of a transfusion container. BACKGROUND

[0002] The transfusion container in the medical industry is divided into multiple categories. The transfusion container can be divided into three categories according to the packaging material: glass bottle, plastic bottle and soft bag. The glass bottle transfusion container has the disadvantages of being fragile, not resistant to high temperature and easy to be damaged during transportation, and has been gradually replaced by the plastic bottle and soft bag transfusion container. As the combination cover of the transfusion container, the production of the combination cover is huge. The combination cover is a polypropylene combination cover for a plastic transfusion container, which is composed of three parts: an outer cover, glue and an inner cover.

[0003] As an important part of the transfusion container, the combination cover is directly in contact with the liquid medicine, and thus the quality of the combination cover directly affects the safety of the transfusion container. Common defects of the combination cover are burrs and missing edges generated on the periphery of the outer cover during the process of injection molding the combination cover.

[0004] In order to detect the peripheral profile concave or convex of the combination cover, a circular fitting algorithm is usually used to obtain a fitting circle of the peripheral profile of the combination cover, and then the space relationship between the outer profile of the combination cover and the fitting circle is used to judge the abnormality. At present, the commonly used fitting circle algorithm for detecting the combination cover is the RANSAC algorithm. However, the detection effect of the RANSAC algorithm is good for the combination cover with a flat surface, but the pull ring cover is often provided on the combination cover at present. Since the surface of the pull ring cover has a pull ring, the pull ring will show noise similar to a circle in the image, which makes the quality detection result of the transfusion container combination cover obtained by using the RANSAC algorithm inaccurate. SUMMARY

[0005] The present application provides a machine vision quality detection method for a combination cover of a transfusion container to solve the problem that the existing pull ring makes the quality detection result of the transfusion container combination cover obtained by using the RANSAC algorithm inaccurate. The technical scheme adopted is as follows:

[0006] The present application provides a machine vision quality detection method for a combination cover of a transfusion container to solve the problem that the existing pull ring makes the quality detection result of the transfusion container combination cover obtained by using the RANSAC algorithm inaccurate. The technical scheme adopted is as follows:

[0007] Obtain an edge point set of the combination cover image;

[0008] Obtain a temporary center point of the combination cover according to the edge point set; obtain a plurality of edge point cluster classes and the combination cover edge probability of each edge point cluster class according to the distance of the edge points in the edge point set to the temporary center point of the combination cover; divide the edge point cluster classes into combination cover edge point cluster classes and reference cluster classes according to the combination cover edge probability; obtain a temporary radius of the combination cover according to the distance of the edge points in the combination cover edge point cluster classes to the temporary center point of the combination cover;

[0009] According to the volatility of the distance of the edge points in each reference cluster class to the center point of the combined cover edge point cluster class and the difference thereof from the distance of the edge points in the combined cover edge point cluster class to the center point of the combined cover edge point cluster class, the correlation degree of each reference cluster class is obtained; according to the correlation degree of each reference cluster class and the combined cover edge probability thereof, the reference weight of each reference cluster class is obtained;

[0010] According to the difference between the distance of the edge points in the edge point set to the temporary center point of the combined cover and the temporary radius of the combined cover, the fitting degree of the edge points is obtained; according to the fitting degree of the edge points and the reference weight of each reference cluster class, the temporary optimal fitting probability is obtained; the new edge point set is obtained by screening and updating the edge point set according to the fitting degree of the edge points;

[0011] According to the fitting degree of the new edge points obtained according to the new edge point set, and according to the calculation method of the temporary optimal fitting probability, the new temporary optimal fitting probability is obtained, and the optimal fitting circle is obtained by iteration; the visual quality detection result of the combined cover is obtained according to the optimal fitting circle.

[0012] Further, the specific method for obtaining the temporary center point of the combined cover according to the edge point set comprises:

[0013] The center point of all the edge points in the edge point set of the combined cover image is recorded as the temporary center point of the combined cover.

[0014] Further, the specific method for obtaining a plurality of edge point cluster classes and the combined cover edge probability of each edge point cluster class according to the distance of the edge points in the edge point set to the temporary center point of the combined cover comprises:

[0015] The edge points in the edge point set of the combined cover image are clustered by using K-means and elbow method, the distance of the edge points to the temporary center point of the combined cover is used as the measurement of the clustering distance, and a plurality of edge point cluster classes are obtained;

[0016] For any one edge point cluster class, the center point of all the edge points in the edge point cluster class is recorded as the center point of the edge point cluster class;

[0017] The calculation method of the combined cover edge probability of the a-th edge point cluster class is:

[0018]

[0019] In the formula, P a is the combined cover edge probability of the a-th edge point cluster class; N a is the number of edge points in the a-th edge point cluster class; D a is the distance between the center point of the a-th edge point cluster class and the temporary center point of the combined cover; and S ais the variance of the distance from all edge points in the a-th edge point cluster to the center point of the a-th edge point cluster; Norm() is a linear normalization function; and ε is a hyperparameter.

[0020] Further, the method of dividing the edge point clusters into the combined cover edge point cluster and the reference cluster according to the combined cover edge probability comprises the following specific steps:

[0021] The edge point cluster with the maximum combined cover edge probability is recorded as the combined cover edge point cluster, and the other edge point clusters are recorded as the reference clusters.

[0022] Further, the method of obtaining the combined cover temporary radius according to the distance from the edge points in the combined cover edge point cluster to the combined cover temporary center point comprises the following specific steps:

[0023] The mean value of the distance from all edge points in the combined cover edge point cluster to the combined cover temporary center point is recorded as the combined cover temporary radius.

[0024] Further, the method of obtaining the correlation degree of each reference cluster according to the volatility of the distance from the edge points in the reference cluster to the center point of the combined cover edge point cluster and the difference between the distance and the distance from the edge points in the combined cover edge point cluster to the center point of the combined cover edge point cluster comprises the following specific steps:

[0025] The calculation method of the correlation degree of the c-th reference cluster and the combined cover edge point cluster is as follows:

[0026] L c = exp(-S' a ×|D' a -D″|)

[0027] In the formula, L c is the correlation degree of the c-th reference cluster and the combined cover edge point cluster; S' c is the variance of the distance from all edge points in the c-th reference cluster to the center point of the combined cover edge point cluster; D' c is the mean value of the distance from all edge points in the c-th reference cluster to the center point of the combined cover edge point cluster; D” is the mean value of the distance from all edge points in the combined cover edge point cluster to the center point of the combined cover edge point cluster; exp() is an exponential function with a natural constant as the base; and || is an absolute value function.

[0028] Further, the method of obtaining the reference weight of each reference cluster according to the correlation degree of the reference cluster and the combined cover edge probability of the reference cluster comprises the following specific steps:

[0029] For any one reference cluster class, the linear normalization result of the ratio of the association degree of the reference cluster class to the combination cover edge point cluster class to the combination cover edge probability of the reference cluster class is recorded as the reference weight of the reference cluster class.

[0030] Further, the fitting degree of the edge point is obtained according to the difference between the distance of the edge point in the edge point set to the temporary center point of the combination cover and the temporary radius of the combination cover, and the specific method comprises:

[0031] For any one edge point, the inverse proportional normalization result of the absolute value of the difference between the distance of the edge point to the temporary center point of the combination cover and the temporary radius of the combination cover is recorded as the fitting degree of the edge point.

[0032] Further, the temporary optimal fitting probability is obtained according to the fitting degree of the edge point and the reference weight of each reference cluster class, and the specific method comprises:

[0033] The reference weight of the combination cover edge point cluster class is recorded as 1;

[0034] The calculation method of the temporary optimal fitting probability is:

[0035]

[0036] In the formula, M is the temporary optimal fitting probability; n is the total number of edge points in the edge point set; Y k is the reference weight of the edge point cluster class in which the kth edge point is located; X k is the fitting degree of the kth edge point; softmax() is a weight normalization function.

[0037] Further, the fitting degree of the new edge point is obtained according to the new edge point set, and the new temporary optimal fitting probability is obtained according to the calculation method of the temporary optimal fitting probability, and the optimal fitting circle is obtained through iteration, and the specific method comprises:

[0038] The RANSAC algorithm is used to iteratively obtain the fitting circle from the new edge point set, and the center and radius of the fitting circle obtained by the RANSAC algorithm are taken as the temporary center point of the combination cover and the temporary radius of the combination cover, respectively. In each iteration process, the new edge point set is clustered by using the K-means and the elbow method, the distance between the edge point and the temporary center point of the combination cover is used as the clustering distance, a plurality of new edge point cluster classes are obtained, the combination cover edge probability of the new edge point cluster class is obtained, the new combination cover edge point cluster class is obtained, the fitting degree of the new edge point is obtained, and the new temporary optimal fitting probability is obtained, until the temporary optimal fitting probability is greater than the optimal threshold value, the iteration is stopped, and the latest fitting circle is recorded as the optimal fitting circle.

[0039] The beneficial effects of the present application are: when the quality of the infusion container combination cover is detected, the fitting effect of the fitting circle algorithm is poor due to the influence of the pull ring, the present application analyzes the clustering results of the edge points, and roughly obtains the position of the fitting circle, thereby reducing the interference of the pull ring on the fitting circle algorithm; in the clustering process of the edge points, there may be under-clustering, the present application judges the reference weight of the reference cluster, so that the evaluation of the fitting circle is more accurate; the fitting circle obtained by analyzing the clustering results is not accurate, the present application iterates the fitting circle for multiple times and obtains the corresponding temporary fitting optimal probability, so that the fitting result of the fitting circle is more in line with the true edge of the combination cover. Thus, the present application performs visual quality detection on the infusion container combination cover through the fitting circle, so that the quality detection result of the combination cover is more accurate. BRIEF DESCRIPTION OF DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, hereinafter, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor.

[0041] Figure 1 A machine vision quality detection method for an infusion container combination cover provided by an embodiment of the present application is shown in a flowchart. DETAILED DESCRIPTION

[0042] Hereinafter, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0043] Please refer to Figure 1 which shows a machine vision quality detection method flowchart for an infusion container combination cover provided by an embodiment of the present application. The method includes the following steps:

[0044] Step S001, obtaining the edge point set of the combination cover image.

[0045] It should be noted that the purpose of the present embodiment is to detect the quality of the combination cover in the infusion container combination cover image, so the combination cover image needs to be collected first.

[0046] Specifically, a pipeline device is arranged in the quality inspection link of the infusion container combination cover, a black conveyor belt is used on the conveyor belt of the pipeline device, an industrial camera is arranged directly above the conveyor belt, the lens of the industrial camera is aligned with the conveyor belt, a sorting mechanism is arranged for sorting operation on abnormal combination covers, and the combination covers to be inspected after production are placed horizontally and uniformly on the conveyor belt during the operation of the conveyor belt to avoid stacking of the combination covers, and the industrial camera is used to acquire the overall image of the combination cover.

[0047] It should be noted that the overall image of the combination cover contains a plurality of combination covers, and each combination cover needs to be quality inspected, so each combination cover is segmented from the overall image of the combination cover.

[0048] Specifically, the overall image of the combination cover is input into a CNN neural network to obtain a plurality of combination cover images. The specific network model of the CNN neural network used in this embodiment is an Encoder-Decoder structure, and other models can be used in other embodiments. The training set of the neural network is a plurality of overall images of combination covers, and the labels are two categories, which are combination covers and backgrounds, respectively. This method is a pixel-level classification, that is, all pixels in the overall image of the combination cover need to be labeled with corresponding labels. The pixels belonging to the combination cover are labeled as 1, and the pixels belonging to the background are labeled as 0. The loss function used by the neural network is a cross-entropy loss function, and the specific training process is known. This embodiment will not be described in detail.

[0049] It should be noted that each combination cover image contains one combination cover.

[0050] Further, the Canny edge detection algorithm is used to perform edge detection on any combination cover image to obtain a plurality of edge pixels of the combination cover image. A point set formed by all edge pixels of the combination cover image is referred to as an edge point set of the combination cover image. The Canny edge detection algorithm is a known technology, and the specific method will not be described here. The subsequent description takes any combination cover image and its edge point set as an example.

[0051] Step S002, obtaining a temporary center point of the combination cover according to the edge point set; obtaining a plurality of edge point clusters and a combination cover edge probability of each edge point cluster according to the distance between the edge points in the edge point set and the temporary center point of the combination cover; dividing the edge point clusters into combination cover edge point clusters and reference clusters according to the combination cover edge probability; and obtaining a temporary radius of the combination cover according to the distance between the edge points in the combination cover edge point cluster and the temporary center point of the combination cover.

[0052] It should be noted that when the RANSAC algorithm is used for quality detection of the combination cover, the traditional RANSAC algorithm will randomly select 3 edge points in the edge point set of the combination cover image, and perform circle fitting by positioning the center of the circle through the 3 edge points. However, for the combination cover with a pull ring, the pull ring will also exhibit an edge, so the edge point set of the combination cover image will include the edge pixel points of the pull ring, and the RANSAC algorithm may select the edge pixel points of the pull ring when selecting the edge points, thereby affecting the result of the quality detection. In order to exclude the influence of the pull ring on the quality detection, the center of the fitting circle of the combination cover is first positioned initially.

[0053] It should be further noted that since the combination cover image is segmented by the neural network, the combination cover is usually located at the center position of the combination cover image, and since the combination cover is mostly circular, the temporary center point of the combination cover is obtained accordingly.

[0054] Specifically, the center point of all edge points in the edge point set of the combination cover image is recorded as the temporary center point of the combination cover. In this embodiment, the method for obtaining the temporary center point of the combination cover is as follows: a rectangular coordinate system is established with the lower left corner as the origin in the combination cover image; the mean value of the horizontal coordinates of all edge points in the edge point set of the combination cover image is recorded as the temporary center horizontal coordinate; the mean value of the vertical coordinates of all edge points in the edge point set of the combination cover image is recorded as the temporary center vertical coordinate; and the pixel point at the corresponding position of the temporary center horizontal coordinate and the temporary center vertical coordinate in the combination cover image is recorded as the temporary center point of the combination cover.

[0055] It should be noted that since the distances of the pull ring edge and the combination cover edge relative to the temporary center point of the combination cover are different, the two types of edge pixel points are distinguished accordingly.

[0056] Specifically, the edge points in the edge point set of the combination cover image are clustered by using K-means and the elbow method, the distance of the clustering is measured by the distance between the edge points and the temporary center point of the combination cover, and a plurality of edge point clusters are obtained; wherein K-means and the elbow method are known technologies, and the specific method is not described herein.

[0057] It should be noted that since the distances of the combination cover edge pixel points from the temporary center point of the combination cover are similar, in the plurality of edge point clusters obtained, there is an edge point cluster that belongs to the combination cover edge point cluster, and the number of edge points in the edge point cluster is relatively large; since the pull ring of the pull ring type combination cover is usually not horizontal, the pull ring edge in the image is relatively more inclined to an ellipse than the edge of the combination cover, so the distance between the pull ring edge pixel points and the temporary center point of the combination cover is fluctuant, and the distance between the center point of the point set formed by the pull ring edge pixel points and the temporary center point of the combination cover is relatively large.

[0058] Specifically, for any edge point cluster class, the center point of all edge points in the edge point cluster class is recorded as the center point of the edge point cluster class.

[0059] The combined cover edge probability of the a-th edge point cluster class is calculated in the following manner:

[0060]

[0061] In the formula, P a is the combined cover edge probability of the a-th edge point cluster class; N a is the number of edge points in the a-th edge point cluster class; D a is the distance between the center point of the a-th edge point cluster class and the combined cover temporary center point; S a is the variance of the distances of all edge points in the a-th edge point cluster class to the center point of the a-th edge point cluster class; Norm() is a linear normalization function, and the normalization object is the ε is a hyperparameter for avoiding a denominator of 0, and in this embodiment, ε = 1 is adopted for description.

[0062] It should be noted that, since the distances of the combined cover edge pixels to the combined cover temporary center point are similar, the combined cover edge pixels are mainly concentrated in one edge point cluster class.

[0063] Further, the edge point cluster class with the maximum combined cover edge probability is recorded as the combined cover edge point cluster class, and the other edge point cluster classes are recorded as reference cluster classes.

[0064] It should be noted that, since the combined cover edge point cluster class is the cluster class closest to the combined cover real edge, the combined cover temporary radius is obtained according to the combined cover edge point cluster class.

[0065] Specifically, the mean value of the distances of all edge points in the combined cover edge point cluster class to the combined cover temporary center point is recorded as the combined cover temporary radius.

[0066] In step S003, the correlation degree of each reference cluster class is obtained according to the volatility of the distances of the edge points in each reference cluster class to the center point of the combined cover edge point cluster class and the difference thereof from the distances of the edge points in the combined cover edge point cluster class to the center point of the combined cover edge point cluster class, and the reference weight of each reference cluster class is obtained according to the correlation degree of each reference cluster class and the combined cover edge probability thereof.

[0067] It should be noted that since the current obtained combination cover temporary center point and combination cover temporary radius are relatively rough, it is necessary to iteratively adjust to obtain the optimal fitting circle. In this iteration process, due to the interference of the pull tube in the pull ring combination cover, the weight of the edge points not belonging to the real contour of the combination cover needs to be adjusted to obtain a more accurate optimal fitting circle. Since there may be under-clustering in the clustering process of the edge points, it is still necessary to analyze the edge point clusters other than the combination cover edge point clusters, i.e. the reference clusters. Since the under-clustering edge points are mainly distributed near the real contour of the combination cover, but exist in other edge point clusters, the reference clusters have a strong correlation with the combination cover edge point clusters, and the reference weight of the reference clusters is also relatively large when evaluating the fitting circle.

[0068] It should be further noted that the reference clusters formed by under-clustering, i.e. the reference clusters with a strong correlation with the combination cover edge point clusters, all the edge points in the reference clusters have similar distances to the center point of the combination cover edge point clusters, and all the edge points in the reference clusters have similar distances to the center point of the combination cover edge point clusters.

[0069] Specifically, the calculation method of the correlation degree of the cth reference cluster with the combination cover edge point cluster is:

[0070] L c = exp(-S' c ×|D' c -D″|)

[0071] In the formula, L c is the correlation degree of the cth reference cluster with the combination cover edge point cluster; S' c is the variance of the distances of all the edge points in the cth reference cluster to the center point of the combination cover edge point cluster; D' c is the mean of the distances of all the edge points in the cth reference cluster to the center point of the combination cover edge point cluster; D" is the mean of the distances of all the edge points in the combination cover edge point cluster to the center point of the combination cover edge point cluster; exp() is the exponential function with the natural constant as the base; || is the absolute value function.

[0072] It should be noted that under-clustering mainly occurs when the combination cover edge has small fluctuations, so the combination cover edge probability of the reference clusters formed by under-clustering will be relatively small.

[0073] Specifically, for any one reference cluster class, a linear normalization result of a ratio of the reference cluster class to the combined cover edge point cluster class, and a combined cover edge probability of the reference cluster class, is recorded as a reference weight of the reference cluster class; wherein, a normalization object is a ratio of the reference cluster class to the combined cover edge point cluster class and a combined cover edge probability corresponding to each reference cluster class.

[0074] Step S004, according to a difference between a distance of an edge point in the edge point set to the combined cover temporary center point and the combined cover temporary radius, a fitting degree of the edge point is obtained; according to the fitting degree of the edge point and the reference weight of each reference cluster class, a temporary fitting optimal probability is obtained; a new edge point set is obtained by screening and updating the edge point set according to the fitting degree of the edge point.

[0075] It should be noted that after obtaining the fitting circle according to the combined cover temporary center point and the combined cover temporary radius, for any one edge point, if the edge point is in the vicinity of the fitting circle, it indicates that the fitting degree of the edge point to the fitting circle is higher.

[0076] Specifically, for any one edge point, an inverse proportional normalization result of an absolute value of a difference between a distance of the edge point to the combined cover temporary center point and the combined cover temporary radius is recorded as a fitting degree of the edge point.

[0077] It should be noted that since not all edge points are real edges of the combined cover, only edge points with higher fitting degrees are required, and thus the temporary fitting optimal probability is calculated accordingly.

[0078] Specifically, the reference weight of the combined cover edge point cluster class is recorded as 1;

[0079] The calculation method of the temporary fitting optimal probability is:

[0080]

[0081] In the formula, M is the temporary fitting optimal probability; n is the total number of edge points in the edge point set; Y k is the reference weight of the edge point cluster class where the kth edge point is located; X k is the fitting degree of the kth edge point; softmax() is a weight normalization function, and the normalization object is the reference weight of the edge point cluster class where all edge points are located.

[0082] It should be noted that when the temporary fitting optimal probability is low, it indicates that the obtained fitting circle is relatively rough, and thus edge points that do not belong to the real edges of the combined cover need to be excluded, so as to improve the fitting effect of the fitting circle.

[0083] Specifically, the edge points with the fitting degree less than the fitting threshold W are removed from the edge point set to obtain a new edge point set; wherein, the embodiment takes W = 10 as an example for description.

[0084] In step S005, the fitting degree of the new edge point is obtained according to the new edge point set, and the new temporary optimal fitting probability is obtained according to the calculation method of the temporary optimal fitting probability, and the optimal fitting circle is obtained by iteration, and the visual quality detection result of the combination cover is obtained according to the optimal fitting circle.

[0085] It should be noted that, in order to improve the fitting effect of the fitting circle, the fitting process needs to be iterated for multiple times.

[0086] Specifically, the new edge point set is iterated to obtain a fitting circle by using the RANSAC algorithm, and the center and the radius of the fitting circle obtained by the RANSAC algorithm are taken as the temporary center point of the combination cover and the temporary radius of the combination cover, respectively, in each iteration process, the new edge point set is clustered by using the K-means and the elbow method, the distance measurement adopts the distance between the edge point and the temporary center point of the combination cover, a plurality of new edge point clusters are obtained, the combination cover edge probability of the new edge point cluster and the new combination cover edge point cluster are obtained, and the fitting degree of the new edge point and the new temporary optimal fitting probability are obtained by using the method of step S003-step S004, until the temporary optimal fitting probability is greater than the optimal threshold E, the iteration is stopped, and the latest fitting circle is recorded as the optimal fitting circle; wherein, the RANSAC algorithm is a known technology, and the specific method is not introduced here; wherein, the embodiment takes E = 0.8 as an example for description.

[0087] Further, for any one combination cover image, the number of all edge pixel points located outside the optimal fitting circle in the combination cover image is obtained, which is recorded as the abnormal index of the combination cover image, the combination cover corresponding to the combination cover image with the abnormal index greater than the abnormal threshold U is recorded as the abnormal combination cover, and the abnormal combination cover is sorted by using the sorting mechanism; wherein, the embodiment takes U = 10 as an example for description.

[0088] The embodiment adopts the exp(-mx) model to present the inverse proportional relationship and the normalization processing, mx is the input of the model, and the implementer can set the inverse proportional function and the normalization function according to the actual situation.

[0089] The above only describes the preferred embodiments of the present application, and is not intended to limit the present application, any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A machine vision quality inspection method for a combination cover of an infusion container, characterized in that, The method comprises the following steps: An edge point set of the combined cover image is acquired; A temporary center point of the combined cover is obtained according to the edge point set; a plurality of edge point cluster classes and a combined cover edge probability of each edge point cluster class are obtained according to distances of the edge points in the edge point set to the temporary center point of the combined cover; the edge point cluster classes are divided into a combined cover edge point cluster class and a reference cluster class according to the combined cover edge probability; a temporary radius of the combined cover is obtained according to distances of the edge points in the combined cover edge point cluster class to the temporary center point of the combined cover; A correlation degree of each reference cluster class is obtained according to fluctuation of distances of the edge points in each reference cluster class to the center point of the combined cover edge point cluster class and a difference between the distances of the edge points in each reference cluster class to the center point of the combined cover edge point cluster class and distances of the edge points in the combined cover edge point cluster class to the center point of the combined cover edge point cluster class; a reference weight of each reference cluster class is obtained according to the correlation degree of each reference cluster class and the combined cover edge probability of the reference cluster class; A fitting degree of each edge point is obtained according to a difference between the distance of each edge point in the edge point set to the temporary center point of the combined cover and the temporary radius of the combined cover; a temporary optimal fitting probability is obtained according to the fitting degree of each edge point and the reference weight of each reference cluster class; a new edge point set is obtained by filtering and updating the edge point set according to the fitting degree of each edge point; A new fitting degree of each edge point is obtained according to the new edge point set, and a new temporary optimal fitting probability is obtained according to the method for calculating the temporary optimal fitting probability, so as to obtain an optimal fitting circle; a visual quality detection result of the combined cover is obtained according to the optimal fitting circle. The method for obtaining the plurality of edge point cluster classes and the combined cover edge probability of each edge point cluster class according to the distances of the edge points in the edge point set to the temporary center point of the combined cover comprises the following steps: The edge points in the edge point set of the combined cover image are clustered by using K-means and an elbow method, a distance measurement of the clustering is performed by using the distances of the edge points to the temporary center point of the combined cover, and the plurality of edge point cluster classes are obtained; For any one edge point cluster class, a center point of all the edge points in the edge point cluster class is recorded as the center point of the edge point cluster class; No. The calculation method of the combined cover edge probability of edge point clusters is: wherein, is the combination cover edge probability of the th edge point cluster class; is the number of edge points in the th edge point cluster class; is the distance between the center point of the th edge point cluster class and the combination cover temporary center point; is the variance of the distances from all edge points in the th edge point cluster class to the center point of the th edge point cluster class; is a linear normalization function; is a hyperparameter; The method for obtaining the correlation degree of each reference cluster class according to the fluctuation of the distances of the edge points in each reference cluster class to the center point of the combined cover edge point cluster class and the difference between the distances of the edge points in each reference cluster class to the center point of the combined cover edge point cluster class and the distances of the edge points in the combined cover edge point cluster class to the center point of the combined cover edge point cluster class comprises the following steps: No. The calculation method of the degree of association between the reference clusters and the combined cover edge point clusters is: wherein, is the degree of association of the i-th reference cluster class with the combined lid edge point cluster class; is the degree of association of the i-th reference cluster class with the combined lid edge point cluster class; is the variance of the distances of all edge points in the i-th reference cluster class to the center point of the combined lid edge point cluster class; is the variance of the distances of all edge points in the i-th reference cluster class to the center point of the combined lid edge point cluster class; is the mean of the distances of all edge points in the i-th reference cluster class to the center point of the combined lid edge point cluster class; is the mean of the distances of all edge points in the i-th reference cluster class to the center point of the combined lid edge point cluster class; is the mean of the distances of all edge points in the combined lid edge point cluster class to the center point of the combined lid edge point cluster class; is the exponential function with base of the natural constant; is the absolute value function; The method for obtaining the reference weight of each reference cluster class according to the correlation degree of each reference cluster class and the combined cover edge probability of the reference cluster class comprises the following steps: For any one reference cluster class, a linear normalization result of a ratio of the correlation degree of the reference cluster class to the combined cover edge point cluster class to the combined cover edge probability of the reference cluster class is recorded as the reference weight of the reference cluster class; The method for obtaining the fitting degree of each edge point according to the difference between the distance of each edge point in the edge point set to the temporary center point of the combined cover and the temporary radius of the combined cover comprises the following steps: For any one edge point, an inverse-proportion normalization result of an absolute value of a difference between the distance of the edge point to the temporary center point of the combined cover and the temporary radius of the combined cover is recorded as the fitting degree of the edge point. The temporary optimal fitting probability is obtained according to the fitting degree of the edge point and the reference weight of each reference cluster class, and the specific method comprises: The reference weight of the combined cover edge point cluster class is recorded as 1; The calculation method of the temporary optimal fitting probability is: In the formula, is the optimal probability of temporary fitting; is the total number of edge points in the edge point set; is the reference weight of the edge point cluster class to which the th edge point belongs; is the fitting degree of the th edge point; is the weight normalization function.

2. The machine vision quality inspection method for the infusion container combination cover according to claim 1, characterized in that, The temporary center point of the combined cover is obtained according to the edge point set, and the specific method comprises: The center point of all edge points in the edge point set of the combined cover image is recorded as the temporary center point of the combined cover.

3. The machine vision quality inspection method for the infusion container combination cover according to claim 1, characterized in that, The edge point cluster class is divided into a combined cover edge point cluster class and a reference cluster class according to the combined cover edge probability, and the specific method comprises: The edge point cluster class with the maximum combined cover edge probability is recorded as the combined cover edge point cluster class, and other edge point cluster classes are recorded as reference cluster classes.

4. The machine vision quality inspection method for the infusion container combination cover according to claim 1, characterized in that, The temporary radius of the combined cover is obtained according to the distance from the edge point in the combined cover edge point cluster class to the temporary center point of the combined cover, and the specific method comprises: The mean value of the distance from all edge points in the combined cover edge point cluster class to the temporary center point of the combined cover is recorded as the temporary radius of the combined cover.

5. The machine vision quality inspection method for the infusion container combination cover according to claim 1, characterized in that, The optimal fitting circle is obtained by iteratively obtaining the fitting degree of a new edge point set and the new temporary optimal fitting probability according to the calculation method of the temporary optimal fitting probability, and the specific method comprises: The RANSAC algorithm is used to iteratively obtain a fitting circle from the new edge point set, and the center and radius of the fitting circle obtained by the RANSAC algorithm are respectively taken as the temporary center point of the combined cover and the temporary radius of the combined cover. In each iteration process, the new edge point set is clustered by using the K-means and elbow method, the distance measurement adopts the distance between the edge point and the temporary center point of the combined cover, a plurality of new edge point cluster classes are obtained, the combined cover edge probability of the new edge point cluster class and the new combined cover edge point cluster class are obtained, the fitting degree of the new edge point and the new temporary optimal fitting probability are obtained, until the temporary optimal fitting probability is greater than the optimal threshold value, the iteration is stopped, and the latest fitting circle is recorded as the optimal fitting circle.

Citation Information

Patent Citations

  • Jar cover surface defect detection method based on machine vision

    CN108389179A

  • Object roundness measuring method

    CN110349199A