CN117576088A - Intelligent liquid impurity filtering visual detection method and device - Google Patents

Intelligent liquid impurity filtering visual detection method and device Download PDF

Info

Publication number
CN117576088A
CN117576088A CN202410052856.7A CN202410052856A CN117576088A CN 117576088 A CN117576088 A CN 117576088A CN 202410052856 A CN202410052856 A CN 202410052856A CN 117576088 A CN117576088 A CN 117576088A
Authority
CN
China
Prior art keywords
product
image
contour
surface feature
liquid
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410052856.7A
Other languages
Chinese (zh)
Other versions
CN117576088B (en
Inventor
苏庆丰
蔡仲伦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Square Harmony Beijing Technology Co ltd
Original Assignee
Square Harmony Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Square Harmony Beijing Technology Co ltd filed Critical Square Harmony Beijing Technology Co ltd
Priority to CN202410052856.7A priority Critical patent/CN117576088B/en
Publication of CN117576088A publication Critical patent/CN117576088A/en
Application granted granted Critical
Publication of CN117576088B publication Critical patent/CN117576088B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention relates to a liquid impurity intelligent filtering visual detection method and device, which are used for acquiring a first image before a lens and liquid rotate relatively and generating a second image after the relative rotation, then respectively extracting a first edge contour and a first surface characteristic in the first image and extracting a second edge contour and a second surface characteristic in the second image; the lens rotation angle in the two pictures is determined by the first edge profile and the second edge profile. Because the liquid and the lens rotate relatively, the inherent flaws on the lens rotate along with the lens, the first surface feature and the second surface feature are matched after the rotation angle is compensated to the first image or the second image, if the first surface feature and the second surface feature are matched, the first surface feature and the second surface feature rotate along with the lens, the flaws on the lens are indicated, and if the first surface feature and the second surface feature are not matched, the flaws are indicated as suspended impurities in the liquid. The method and the device can effectively eliminate the interference of the liquid suspended matters, so that the detection result of the lens is more accurate.

Description

Intelligent liquid impurity filtering visual detection method and device
Technical Field
The invention relates to the technical field of visual detection, in particular to an intelligent liquid impurity filtering visual detection method and device.
Background
Visual inspection systems are now widely used in quality inspection stages of a variety of industrial processes, but most are designed to detect solids and rigid geometries. Optical imaging systems have many challenges when detecting flexible materials that need to be immersed in liquids. For example, in the mass production manufacturing and quality inspection of contact lenses, the finished product inspection must be performed in a liquid environment. Product images taken by vision systems typically include a variety of media: product, soaking liquid, detecting container, etc. Various features of such a variety of media are presented in the image. With only one image it will not be possible to distinguish whether the feature is in the product itself. It is highly likely that interfering impurities (e.g., small fibers, dust, etc.) or other liquid disturbances (e.g., bubbles in the liquid, etc.) will be suspended in the liquid, or that imperfections (e.g., dirt, water stains, etc.) on the container will be detected. These are interference terms that do not need to be detected. However, the conventional vision system usually judges the product as a defective product because the characteristic position cannot be judged. But the product is good.
Therefore, conventional vision systems, when dealing with finished products immersed in a liquid, are prone to false positives due to interference from the liquid or container.
Disclosure of Invention
Therefore, the invention aims to provide an intelligent liquid impurity filtering visual detection method and device, which are used for solving the problem that in the prior art, finished products soaked in liquid are treated, and misjudgment is easy to occur under the interference of the liquid or a container.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
the invention discloses an intelligent liquid impurity filtering visual detection method, which comprises the following steps:
acquiring a first image of a product to be tested when the product to be tested is soaked in liquid, and acquiring a second image of the liquid and the product to be tested after the liquid and the product to be tested are rotated relatively, wherein the liquid and the product to be tested are placed in a container;
extracting a first edge contour and a first surface feature of a product to be detected in the first image, and extracting a second edge contour and a second surface feature of the product to be detected in the second image;
determining the rotation angle of the product to be tested based on the first edge profile and the second edge profile;
compensating the rotation angle to the first image or the second image so that the rotation angle of a product to be detected in the first image is consistent with that of a product to be detected in the second image, and performing feature matching on the first surface feature and the second surface feature when the rotation angles of the product to be detected in the first image and the product to be detected in the second image are consistent;
and when the first surface feature is matched with the second surface feature, judging that the first surface feature or the second surface feature is an inherent flaw on a product to be tested, and otherwise, judging that the first surface feature or the second surface feature is an interference flaw in liquid.
In an embodiment of the present application, obtaining a second image of a liquid and a product to be tested after relative rotation includes:
and rotating the container to enable the liquid and the product to be tested to rotate relatively, photographing the container after the container rotates to obtain a second image, or blowing the container from the edge tangential direction by using an air source to enable the liquid and the product to be tested to rotate relatively, and photographing the container after the container rotates to obtain the second image.
In an embodiment of the present application, extracting a first edge contour of a product to be measured in the first image, and extracting a second edge contour of the product to be measured in the second image includes:
preprocessing the first image or the second image to obtain an intermediate image;
performing binarization processing on the intermediate image to obtain a contour line;
screening the contour lines, and taking the contour lines meeting target conditions as preliminary contour lines, wherein the target conditions comprise: the diameter of the contour line is within a preset diameter range; the roundness of the contour line is within a preset roundness range;
and extracting the gradient of the preliminary contour line, and determining a target contour line based on the gradient of the preliminary contour line to obtain a first edge contour or a second edge contour.
In an embodiment of the present application, extracting a gradient of the preliminary contour line, and determining a target contour line based on the gradient of the preliminary contour line;
constructing a plurality of scanning lines which are parallel to one diameter of the preliminary contour lines and intersect with the preliminary contour lines;
performing first-order derivation on pixel points of each scanning line to obtain a gradient curve of each scanning line;
taking a pixel point corresponding to the maximum value in each gradient curve as an outer contour point, and taking a pixel point corresponding to the minimum value in each gradient curve as an inner contour point;
the target contour is constructed based on all of the inner contour points and the outer contour points.
In an embodiment of the present application, determining the rotation angle of the product to be tested based on the first edge profile and the second edge profile includes:
determining a centroid of the first edge profile and the second edge profile;
mapping the first edge profile and the second edge profile into a two-dimensional coordinate system to obtain a first profile curve and a second profile curve, wherein the abscissa of the first profile curve is the phase of a plurality of sampling points in the first edge profile, and the ordinate of the first profile curve is the distance between a plurality of sampling points in the first edge profile and the mass center of the first edge profile; the abscissa of the second contour curve is the phase of a plurality of sampling points in the second edge contour, and the ordinate of the second contour curve is the distance between a plurality of sampling points in the second edge contour and the mass center of the second edge contour;
convolving the first contour curve and the second contour curve to obtain a convolution result curve;
and determining a target phase corresponding to the maximum value in the convolution result curve, and converting the target phase into the rotation angle of the product to be detected.
In an embodiment of the present application, convolving the first contour curve and the second contour curve to obtain a convolution result curve includes:
multiplying and adding the first contour curve and the second contour curve to obtain a convolution result;
shifting the first profile curve or the second profile curve by one or more phases, and returning to multiplying and adding the first profile curve and the second profile curve until the convolution of the first profile curve and the second profile curve is completed, so as to obtain a plurality of convolution results;
a convolution result curve is constructed based on the plurality of convolution results.
In an embodiment of the present application, performing multiplication and addition on the first profile curve and the second profile curve to obtain a convolution result includes:
multiplying the ordinate of each sampling point of the first contour curve and the ordinate of the sampling point of the same phase in the second contour curve to obtain a plurality of products, and adding the products to obtain a convolution result, wherein when the ordinate is the same, the product is one, and when the ordinate is different, the product is zero.
In an embodiment of the present application, performing feature matching on the first surface feature and the second surface feature includes:
extracting a first feature vector of the first surface featureAnd extracting a second feature vector of the second surface feature
Calculating the first feature vectorAnd the second feature vectorCosine similarity of (c);
and when the cosine similarity is larger than or equal to a preset threshold value, judging that the first surface feature is matched with the second surface feature, otherwise, judging that the first surface feature is not matched with the second surface feature.
In an embodiment of the present application, the first feature vector or the second feature vector includes a polar coordinate position, an area, a perimeter, an aspect ratio, a gray maximum, a gray minimum, and a gray average.
The application also provides a liquid impurity intelligent filtration visual detection device, include:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image of a product to be detected when the product to be detected is immersed in liquid, and acquiring a second image of the liquid and the product to be detected after the liquid and the product to be detected generate relative rotation, wherein the liquid and the product to be detected are both placed in a container;
the feature extraction module is used for extracting a first edge contour and a first surface feature of the product to be detected in the first image and extracting a second edge contour and a second surface feature of the product to be detected in the second image;
the angle determining module is used for determining the rotation angle of the product to be detected based on the first edge profile and the second edge profile;
the detection module is used for compensating the rotation angle to the first image or the second image so that the rotation angle of the product to be detected in the first image is consistent with that of the product to be detected in the second image, and carrying out feature matching on the first surface feature and the second surface feature when the rotation angles of the product to be detected in the first image and the product to be detected in the second image are consistent; determining the first surface feature when the first surface feature matches the second surface feature
Or the second surface feature is an inherent flaw on the product to be tested, otherwise, the first surface feature or the second surface feature is judged to be an interference flaw in the liquid.
The beneficial effects of the invention are as follows: according to the intelligent liquid impurity filtering visual detection method and device, a first image before a product to be detected and liquid rotate relatively and a second image after the product to be detected and the liquid rotate relatively are respectively obtained, then a first edge contour and a first surface feature in the first image are respectively extracted, and a second edge contour and a second surface feature in the second image are extracted; and determining the rotation angle of the product to be detected in the two pictures through the first edge contour and the second edge contour. Because the inherent flaws on the product to be measured can rotate along with the product to be measured when the liquid and the product to be measured relatively rotate, the first surface feature and the second surface feature are matched after the rotation angle is compensated to the first image or the second image, if the first surface feature and the second surface feature are matched, the first surface feature and the second surface feature rotate along with the product to be measured, the flaws on the product to be measured are proved to be flaws on the product to be measured, and if the flaws are not proved to be flaws suspended in the liquid. The method and the device can effectively eliminate the interference of the liquid suspended matters, so that the detection result of the product to be detected is more accurate.
Drawings
The invention is further described below with reference to the accompanying drawings and examples:
FIG. 1 is a flow chart of a visual inspection method for intelligent filtration of liquid impurities in an embodiment of the invention;
FIG. 2 is a hardware configuration diagram I of a visual detection method for intelligent filtering of liquid impurities according to an embodiment of the present application;
FIG. 3 is a second hardware configuration diagram of a visual detection method for intelligent filtering of liquid impurities according to an embodiment of the present application;
FIG. 4 is a schematic illustration of edge features and surface features in an embodiment of the present application;
FIG. 5 is a feature contrast diagram of a first image and a second image according to an embodiment of the present application;
FIG. 6 is a schematic diagram of gray scale and gradient curves according to an embodiment of the present application;
FIG. 7 is a schematic view of an edge profile of a lens in an embodiment of the present application;
FIG. 8 is a schematic representation of profile curves and convolution result curves in an embodiment of the present application;
fig. 9 is a block diagram of an intelligent liquid impurity filtering visual detection device according to an embodiment of the invention.
Description of the embodiments
Other advantages and effects of the present invention will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present invention with reference to specific examples. The invention may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present invention. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict.
It should be noted that the illustrations provided in the following embodiments merely illustrate the basic concept of the present invention by way of illustration, and only the layers related to the present invention are shown in the drawings and are not drawn according to the number, shape and size of the layers in actual implementation, and the form, number and proportion of the layers in actual implementation may be arbitrarily changed, and the layer layout may be more complex.
In the following description, numerous details are discussed to provide a more thorough explanation of embodiments of the present invention, however, it will be apparent to one skilled in the art that embodiments of the present invention may be practiced without these specific details.
Fig. 1 is a flowchart of a visual detection method for intelligent filtration of liquid impurities according to an embodiment of the present application, as shown in fig. 1: the method comprises the following steps:
s110, acquiring a first image of a product to be tested when the product to be tested is soaked in liquid, and acquiring a second image of the liquid and the product to be tested after the liquid and the product to be tested rotate relatively, wherein the liquid and the product to be tested are placed in a container;
in this embodiment, the product to be tested may be a lens of a contact lens, which is typically immersed in a container containing a liquid when the lens is inspected. In order to eliminate the interference of suspended matters in the liquid on the detection result, the application utilizes the inertia of the liquid to change the relative positions of the suspended matters and the lens by making the liquid and the product to be detected rotate relatively, so that the suspended matters are filtered.
In this application, the following two ways can be used to generate the relative rotation between the liquid and the lens.
Fig. 2 is a hardware configuration diagram of an intelligent visual inspection method for filtering liquid impurities in an embodiment of the present application, as shown in fig. 2, the hardware on which the first mode depends includes an industrial camera 201, an industrial lens 202, an inspection container 203, a container mounting base 204, a driving belt 205, a driving motor 206 and an industrial light source 207.
Wherein the industrial camera 201 and the industrial lens 202 are arranged on the top of the whole hardware, and the industrial light source 207 is arranged on the bottom of the whole hardware; the detection container 203 is arranged on a container mounting base 204, and the container mounting base 204 is in transmission connection with a driving motor 206 through a transmission belt 205;
the steps of shooting the first image and the second image are as follows:
firstly, turning on an industrial light source 207, controlling an industrial camera 201 and an industrial lens 202 to shoot a detection container 203, and obtaining a first image;
then, the driving motor 206 is controlled to rotate, and the container mounting base 204 is driven to rotate by the driving belt 205, so that the liquid in the detection container 203 and the lens rotate relatively, and after the rotation is stopped, the industrial camera 201 and the industrial lens 202 shoot the detection container 203, and a second image is obtained.
Fig. 3 is a hardware structure diagram of a visual detection method for intelligent filtering of liquid impurities in an embodiment of the present application, as shown in fig. 3, the hardware on which the second mode depends includes an air source, an air blowing pipe 301, and a detection container 302;
the air source blows air into the detection container 302 through the air blowing pipe 301, and the blowing direction of the air blowing pipe 301 is tangential to the inner wall of the detection container 302, so that liquid in the detection container 302 can be rotated during blowing.
Before blowing, the detection container is photographed by a camera, and a first image is obtained. After blowing, the liquid and the lens are made to rotate relatively, and then the second image is obtained by shooting the detection container through the camera.
S120, extracting a first edge contour and a first surface feature of a product to be detected in the first image, and extracting a second edge contour and a second surface feature of the product to be detected in the second image;
wherein the first edge feature and the second edge feature are contour edges of the contact lens, and the first surface feature and the second surface feature are likely to be imperfections of the contact lens and also likely to be impurities suspended in the liquid.
Fig. 4 is a schematic diagram of edge features and surface features in an embodiment of the present application, as shown in fig. 4, in a captured image, including a detection container 301, a liquid 302, and a detected product 303, where the surface features may exist including a defect 304 in the detected product itself, a defect 305 on the detection container, and a suspended interfering object 306 in the liquid. In which the product to be tested is not held in the liquid, the defect 305 on the inspection container will also rotate relative to the product to be tested during rotation.
Fig. 5 is a characteristic comparison diagram of a first image and a second image in an embodiment of the present application, as shown in fig. 5, the first image includes a measured product 501 before rotation, a measured product 501 after rotation, a product defect 503 before rotation, a product defect 504 after rotation, a container defect 505 before rotation, a container defect 506 after rotation, a liquid suspended impurity 507 before rotation, and a liquid suspended impurity 508 after rotation.
The edge contours in the first image and the second image are extracted in the following way:
s121, preprocessing the first image or the second image to obtain an intermediate image;
the preprocessing method may include format conversion, filtering, noise reduction, and the like, and is not limited herein.
S122, binarizing the intermediate image to obtain a contour line;
s123, screening the contour lines, and taking the contour lines meeting target conditions as preliminary contour lines, wherein the target conditions comprise: the diameter of the contour line is within a preset diameter range; the roundness of the contour line is within a preset roundness range;
the method adopts a morphological filtering mode, extracts the contour line meeting the roundness and diameter of a certain size to serve as a preliminary contour line, and further extracts the precise contour line based on the preliminary contour line. In addition, after the primary contour line is extracted, the centroid of the product to be detected is found by calculating the polygon property, and when the product to be detected is a contact lens, the center of the circle is found.
S124, extracting gradients of the preliminary contour lines, and determining a target contour line based on the gradients of the preliminary contour lines to obtain a first edge contour or a second edge contour.
In this embodiment, an accurate contour line is found by calculating a gradient, which is specifically as follows:
(1) Converting the coordinates of the preliminary contour line into polar coordinates, and constructing a plurality of scanning lines in the polar coordinates, wherein each scanning line is parallel to one diameter of the preliminary contour line and intersects the preliminary contour line; the number of the scanning lines can be 3600, so that the scanning precision reaches 0.1, and the scanning precision can be automatically increased or decreased according to the efficiency requirement in actual use.
(2) Performing first-order derivation on pixel points of each scanning line to obtain a gradient curve of each scanning line;
FIG. 6 is a schematic diagram of a gradient profile according to an embodiment of the present application, and the resulting gradient profile is shown in FIG. 6.
(3) Taking a pixel point corresponding to the maximum value in each gradient curve as an outer contour point, and taking a pixel point corresponding to the minimum value in each gradient curve as an inner contour point; the main change trend of the edge gray scale characteristics of the scanning lens from outside to inside is as follows: from bright to dark to bright. The usual gradient curve thus has two peaks (maximum/minimum), which are characteristic points of the outer contour and of the inner contour, respectively.
(4) The target contour is constructed based on all of the inner contour points and the outer contour points.
In the present application, a curve composed of 3600 feature points in the inner and outer contours 360 degrees is taken as the feature curve of the edge contour. It will be appreciated that the more scan lines, the higher the accuracy of the scan, but the less efficient the process.
Fig. 7 is a schematic view of an edge profile of a lens according to an embodiment of the present application, and the final extracted edge profile is shown in fig. 7.
S130, determining the rotation angle of the product to be tested based on the first edge profile and the second edge profile;
in this embodiment, a method of convoluting the first edge profile and the second edge profile is adopted to determine a rotation angle of a product to be measured, and the specific process is as follows:
s131, determining the mass centers of the first edge contour and the second edge contour; in this embodiment, the product to be tested is a contact lens, so that the first edge profile and the second edge profile are circular or elliptical, and the centroid thereof is substantially the center of the circle.
S132, mapping the first edge profile and the second edge profile into a two-dimensional coordinate system to obtain a first profile curve and a second profile curve;
the abscissa of the first contour curve is the phase of a plurality of sampling points in the first edge contour, and the ordinate of the first contour curve is the distance between the plurality of sampling points in the first edge contour and the centroid of the first edge contour; the abscissa of the second contour curve is the phase of a plurality of sampling points in the second edge contour, and the ordinate of the second contour curve is the distance between a plurality of sampling points in the second edge contour and the mass center of the second edge contour;
s133, convolving the first contour curve and the second contour curve to obtain a convolution result curve;
s134, determining a target phase corresponding to the maximum value in the convolution result curve, and converting the target phase into the rotation angle of the product to be detected.
Fig. 8 is a schematic diagram of a contour curve and a convolution result curve according to an embodiment of the present application, where, as shown in fig. 8, the phases of the first contour curve and the second contour curve are-180 ° -180 °, corresponding to 3600 sampling points in 360 °. The distance between each sampling point and the centroid is different, so that a first contour curve and a second contour curve are formed in a two-dimensional coordinate system.
The convolution method in this embodiment adopts a Cross-correlation convolution method, and the specific steps and principles are as follows:
(1) Multiplying and adding the first contour curve and the second contour curve to obtain a convolution result;
the method specifically comprises the following steps: multiplying the ordinate of each sampling point of the first contour curve and the ordinate of the sampling point of the same phase in the second contour curve to obtain a plurality of products, and adding the products to obtain a convolution result, wherein when the ordinate is the same, the product is one, and when the ordinate is different, the product is zero.
And in the first multiplication and addition operation, namely representing the coincidence ratio of the first contour curve and the second contour curve under the current relative phase, if the value of the convolution result is larger, the more sampling point positions of the first contour curve and the second contour curve are coincident, correspondingly, the larger the coincidence ratio is, and conversely, the smaller the coincidence ratio is.
(2) Shifting the first profile curve or the second profile curve by one or more phases, and returning to multiplying and adding the first profile curve and the second profile curve until the convolution of the first profile curve and the second profile curve is completed, so as to obtain a plurality of convolution results;
by repeating the movement, specifically, one or more phases are moved each time, and the convolution of the first contour curve and the second contour curve can be completed after repeating the movement for a plurality of times, so that the coincidence ratio of the first contour curve and the second contour curve under each angle is obtained.
(3) A convolution result curve is constructed based on the plurality of convolution results.
It can be understood that when the value of the convolution result curve is maximum, the contact ratio of the first contour curve and the second contour curve is maximum, and the first edge contour and the second edge contour can be considered to be overlapped, so that the rotation angle of the lens can be converted by calculating the phase quantity moving in the overlapped state and the initial state. For example, at a phase shift momentum of 800, the first edge profile and the second edge profile overlap, and if the total amount of samples is 1440, the rotation angle is (800/1440) ×360°, and the calculation result is about 200 °.
S140, compensating the rotation angle to the first image or the second image so that the rotation angles of the product to be detected in the first image and the product to be detected in the second image are consistent, and performing feature matching on the first surface feature and the second surface feature when the rotation angles of the product to be detected in the first image and the product to be detected in the second image are consistent; and when the first surface feature is matched with the second surface feature, judging that the first surface feature or the second surface feature is an inherent flaw on a product to be tested, and otherwise, judging that the first surface feature or the second surface feature is an interference flaw in liquid.
The rotation angle of the product to be measured is calculated in the foregoing, and the rotation angle is compensated to the first image or the second image so that the first edge contour and the second edge contour coincide, and at this time, if the first surface feature matches the second surface feature, then the surface feature can be considered to rotate with the lens or not rotate with the liquid. The surface features can be judged to be intrinsic flaws.
Specifically, feature matching the first surface feature with the second surface feature includes:
s141, extracting a first feature vector of the first surface featureAnd extracting a second feature vector of the second surface featureThe method comprises the steps of carrying out a first treatment on the surface of the The first feature vector orThe second feature vector includes a polar position, an area, a perimeter, an aspect ratio, a gray maximum, a gray minimum, and a gray average.
S142, calculating the first feature vectorAnd the second feature vectorCosine similarity of (2)The method comprises the steps of carrying out a first treatment on the surface of the Cosine similarityThe mathematical expression of (2) is:
s143, when the cosine similarity is larger than or equal to a preset threshold value, judging that the first surface feature is matched with the second surface feature, otherwise, judging that the first surface feature is not matched with the second surface feature.
Wherein due to the first eigenvectorAnd a second feature vectorIn this embodiment, the cosine similarity is calculated for each term (polar position, area, perimeter, aspect ratio, maximum gray level, minimum gray level, and average gray level), and the first surface feature and the second surface feature are determined to match when the cosine similarity of each term is greater than the respective predetermined threshold.
According to the intelligent liquid impurity filtering visual detection method, a first image before a product to be detected and liquid rotate relatively and a second image after the product to be detected and the liquid rotate relatively are respectively obtained, then a first edge contour and a first surface feature in the first image are respectively extracted, and a second edge contour and a second surface feature in the second image are extracted; and determining the rotation angle of the product to be detected in the two pictures through the first edge contour and the second edge contour. Because the inherent flaws on the product to be measured can rotate along with the product to be measured when the liquid and the product to be measured relatively rotate, the first surface feature and the second surface feature are matched after the rotation angle is compensated to the first image or the second image, if the first surface feature and the second surface feature are matched, the first surface feature and the second surface feature rotate along with the product to be measured, the flaws on the product to be measured are proved to be flaws on the product to be measured, and if the flaws are not proved to be flaws suspended in the liquid. The method and the device can effectively eliminate the interference of the liquid suspended matters, so that the detection result of the product to be detected is more accurate.
As shown in fig. 9, the present application further provides a liquid impurity intelligent filtering visual detection device, including:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image of a product to be detected when the product to be detected is immersed in liquid, and acquiring a second image of the liquid and the product to be detected after the liquid and the product to be detected generate relative rotation, wherein the liquid and the product to be detected are both placed in a container;
the feature extraction module is used for extracting a first edge contour and a first surface feature of the product to be detected in the first image and extracting a second edge contour and a second surface feature of the product to be detected in the second image;
the angle determining module is used for determining the rotation angle of the product to be detected based on the first edge profile and the second edge profile;
the detection module is used for compensating the rotation angle to the first image or the second image so that the rotation angle of the product to be detected in the first image is consistent with that of the product to be detected in the second image, and carrying out feature matching on the first surface feature and the second surface feature when the rotation angles of the product to be detected in the first image and the product to be detected in the second image are consistent; and when the first surface feature is matched with the second surface feature, judging that the first surface feature or the second surface feature is an inherent flaw on a product to be tested, and otherwise, judging that the first surface feature or the second surface feature is an interference flaw in liquid.
The beneficial effects of the invention are as follows: according to the intelligent liquid impurity filtering visual detection method and device, a first image before a product to be detected and liquid rotate relatively and a second image after the product to be detected and the liquid rotate relatively are respectively obtained, then a first edge contour and a first surface feature in the first image are respectively extracted, and a second edge contour and a second surface feature in the second image are extracted; and determining the rotation angle of the product to be detected in the two pictures through the first edge contour and the second edge contour. Because the inherent flaws on the product to be measured can rotate along with the product to be measured when the liquid and the product to be measured relatively rotate, the first surface feature and the second surface feature are matched after the rotation angle is compensated to the first image or the second image, if the first surface feature and the second surface feature are matched, the first surface feature and the second surface feature rotate along with the product to be measured, the flaws on the product to be measured are proved to be flaws on the product to be measured, and if the flaws are not proved to be flaws suspended in the liquid. The method and the device can effectively eliminate the interference of the liquid suspended matters, so that the detection result of the product to be detected is more accurate.
The present embodiment also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements any of the methods of the present embodiments, wherein the method is the execution logic of the present apparatus.
The embodiment also provides an electronic terminal, including: a processor and a memory;
the memory is used for storing a computer program, and the processor is used for executing the computer program stored in the memory, so that the terminal executes any one of the methods in the embodiment.
The computer readable storage medium in this embodiment, as will be appreciated by those of ordinary skill in the art: all or part of the steps for implementing the method embodiments described above may be performed by computer program related hardware. The aforementioned computer program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver, and a communication interface, where the memory and the communication interface are connected to the processor and the transceiver and complete communication with each other, the memory is used to store a computer program, the communication interface is used to perform communication, and the processor and the transceiver are used to run the computer program, so that the electronic terminal performs each step of the above method.
In this embodiment, the memory may include a random access memory (Random Access Memory, abbreviated as RAM), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In the above embodiments, while the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications and variations of these embodiments will be apparent to those skilled in the art in light of the foregoing description. The embodiments of the invention are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims.
The above embodiments are merely illustrative of the principles of the present invention and its effectiveness, and are not intended to limit the invention. Modifications and variations may be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the invention. Accordingly, it is intended that all equivalent modifications and variations of the invention be covered by the claims, which are within the ordinary skill of the art, be within the spirit and scope of the present disclosure.

Claims (10)

1. The intelligent liquid impurity filtering visual detection method is characterized by comprising the following steps of:
acquiring a first image of a product to be tested when the product to be tested is soaked in liquid, and acquiring a second image of the liquid and the product to be tested after the liquid and the product to be tested are rotated relatively, wherein the liquid and the product to be tested are placed in a container;
extracting a first edge contour and a first surface feature of a product to be detected in the first image, and extracting a second edge contour and a second surface feature of the product to be detected in the second image;
determining the rotation angle of the product to be tested based on the first edge profile and the second edge profile;
compensating the rotation angle to the first image or the second image so that the rotation angle of a product to be detected in the first image is consistent with that of a product to be detected in the second image, and performing feature matching on the first surface feature and the second surface feature when the rotation angles of the product to be detected in the first image and the product to be detected in the second image are consistent; and when the first surface feature is matched with the second surface feature, judging that the first surface feature or the second surface feature is an inherent flaw on a product to be tested, and otherwise, judging that the first surface feature or the second surface feature is an interference flaw in liquid.
2. The method for intelligently filtering and visually detecting liquid impurities according to claim 1, wherein the step of obtaining a second image of the liquid and the product to be detected after relative rotation comprises the steps of:
and rotating the container to enable the liquid and the product to be tested to rotate relatively, photographing the container after the container rotates to obtain a second image, or blowing the container from the edge tangential direction by using an air source to enable the liquid and the product to be tested to rotate relatively, and photographing the container after the container rotates to obtain the second image.
3. The method for intelligently filtering and visually inspecting liquid impurities according to claim 1, wherein extracting a first edge contour of a product to be inspected in the first image and extracting a second edge contour of the product to be inspected in the second image comprises:
preprocessing the first image or the second image to obtain an intermediate image;
performing binarization processing on the intermediate image to obtain a contour line;
screening the contour lines, and taking the contour lines meeting target conditions as preliminary contour lines, wherein the target conditions comprise: the diameter of the contour line is within a preset diameter range; the roundness of the contour line is within a preset roundness range;
and extracting the gradient of the preliminary contour line, and determining a target contour line based on the gradient of the preliminary contour line to obtain a first edge contour or a second edge contour.
4. A liquid impurity intelligent filtering visual inspection method according to claim 3, wherein the gradient of the preliminary contour line is extracted, and a target contour line is determined based on the gradient of the preliminary contour line;
constructing a plurality of scanning lines which are parallel to one diameter of the preliminary contour lines and intersect with the preliminary contour lines;
performing first-order derivation on pixel points of each scanning line to obtain a gradient curve of each scanning line;
taking a pixel point corresponding to the maximum value in each gradient curve as an outer contour point, and taking a pixel point corresponding to the minimum value in each gradient curve as an inner contour point;
the target contour is constructed based on all of the inner contour points and the outer contour points.
5. The method for intelligently filtering and visually inspecting liquid impurities according to claim 1, wherein determining the rotation angle of the product to be inspected based on the first edge profile and the second edge profile comprises:
determining a centroid of the first edge profile and the second edge profile;
mapping the first edge profile and the second edge profile into a two-dimensional coordinate system to obtain a first profile curve and a second profile curve, wherein the abscissa of the first profile curve is the phase of a plurality of sampling points in the first edge profile, and the ordinate of the first profile curve is the distance between a plurality of sampling points in the first edge profile and the mass center of the first edge profile; the abscissa of the second contour curve is the phase of a plurality of sampling points in the second edge contour, and the ordinate of the second contour curve is the distance between a plurality of sampling points in the second edge contour and the mass center of the second edge contour;
convolving the first contour curve and the second contour curve to obtain a convolution result curve;
and determining a target phase corresponding to the maximum value in the convolution result curve, and converting the target phase into the rotation angle of the product to be detected.
6. The intelligent filtering visual inspection method of liquid impurities according to claim 5, wherein convolving the first contour curve and the second contour curve to obtain a convolution result curve, comprising:
multiplying and adding the first contour curve and the second contour curve to obtain a convolution result;
shifting the first profile curve or the second profile curve by one or more phases, and returning to multiplying and adding the first profile curve and the second profile curve until the convolution of the first profile curve and the second profile curve is completed, so as to obtain a plurality of convolution results;
a convolution result curve is constructed based on the plurality of convolution results.
7. The intelligent filtering visual inspection method of liquid impurities according to claim 6, wherein multiplying and adding the first profile and the second profile to obtain a convolution result comprises:
multiplying the ordinate of each sampling point of the first contour curve and the ordinate of the sampling point of the same phase in the second contour curve to obtain a plurality of products, and adding the products to obtain a convolution result, wherein when the ordinate is the same, the product is one, and when the ordinate is different, the product is zero.
8. The intelligent filtering visual inspection method of liquid impurities according to claim 1, wherein feature matching the first surface feature with the second surface feature comprises:
extracting a first feature vector of the first surface featureAnd extracting a second feature vector of the second surface feature
Calculating the first feature vectorAnd the second feature vectorCosine similarity of (c);
and when the cosine similarity is larger than or equal to a preset threshold value, judging that the first surface feature is matched with the second surface feature, otherwise, judging that the first surface feature is not matched with the second surface feature.
9. The intelligent filtering visual inspection method of liquid impurities according to claim 8, wherein the first feature vector or the second feature vector comprises a polar coordinate position, an area, a perimeter, an aspect ratio, a gray maximum, a gray minimum, and a gray average.
10. Liquid impurity intelligent filtration visual detection device, its characterized in that includes:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image of a product to be detected when the product to be detected is immersed in liquid, and acquiring a second image of the liquid and the product to be detected after the liquid and the product to be detected generate relative rotation, wherein the liquid and the product to be detected are both placed in a container;
the feature extraction module is used for extracting a first edge contour and a first surface feature of the product to be detected in the first image and extracting a second edge contour and a second surface feature of the product to be detected in the second image;
the angle determining module is used for determining the rotation angle of the product to be detected based on the first edge profile and the second edge profile;
the detection module is used for compensating the rotation angle to the first image or the second image so that the rotation angle of the product to be detected in the first image is consistent with that of the product to be detected in the second image, and carrying out feature matching on the first surface feature and the second surface feature when the rotation angles of the product to be detected in the first image and the product to be detected in the second image are consistent; and when the first surface feature is matched with the second surface feature, judging that the first surface feature or the second surface feature is an inherent flaw on a product to be tested, and otherwise, judging that the first surface feature or the second surface feature is an interference flaw in liquid.
CN202410052856.7A 2024-01-15 2024-01-15 Intelligent liquid impurity filtering visual detection method and device Active CN117576088B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410052856.7A CN117576088B (en) 2024-01-15 2024-01-15 Intelligent liquid impurity filtering visual detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410052856.7A CN117576088B (en) 2024-01-15 2024-01-15 Intelligent liquid impurity filtering visual detection method and device

Publications (2)

Publication Number Publication Date
CN117576088A true CN117576088A (en) 2024-02-20
CN117576088B CN117576088B (en) 2024-04-05

Family

ID=89884788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410052856.7A Active CN117576088B (en) 2024-01-15 2024-01-15 Intelligent liquid impurity filtering visual detection method and device

Country Status (1)

Country Link
CN (1) CN117576088B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090303465A1 (en) * 2008-06-05 2009-12-10 Julie Ann Clements Multi-imaging automated inspection methods and systems for wet ophthalmic lenses
CN108776140A (en) * 2018-06-08 2018-11-09 福建新大陆电脑股份有限公司 A kind of printed matter flaw detection method and system based on machine vision
CN111709426A (en) * 2020-05-08 2020-09-25 广州博进信息技术有限公司 Diatom identification method based on contour and texture
CN112270687A (en) * 2020-10-16 2021-01-26 鲸斛(上海)智能科技有限公司 Cloth flaw identification model training method and cloth flaw detection method
CN113780235A (en) * 2021-09-24 2021-12-10 西安闻泰信息技术有限公司 Icon flaw detection method and system
CN113920090A (en) * 2021-10-13 2022-01-11 无锡雪浪数制科技有限公司 Preform appearance defect automatic detection method based on deep learning
CN115482186A (en) * 2021-06-15 2022-12-16 富泰华工业(深圳)有限公司 Defect detection method, electronic device, and storage medium
CN115830606A (en) * 2021-09-17 2023-03-21 鸿海精密工业股份有限公司 Character flaw detection method, computer device and storage medium
CN116109572A (en) * 2022-12-28 2023-05-12 苏州凌云光工业智能技术有限公司 Workpiece edge weak defect detection method and device and electronic equipment
CN117011376A (en) * 2023-07-07 2023-11-07 重庆中科摇橹船信息科技有限公司 Industrial part comprehensive positioning method and system based on edge contour and feature moment
CN117269179A (en) * 2023-11-23 2023-12-22 平方和(北京)科技有限公司 High-precision detection method and system for edge defects of contact lens based on machine vision

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090303465A1 (en) * 2008-06-05 2009-12-10 Julie Ann Clements Multi-imaging automated inspection methods and systems for wet ophthalmic lenses
CN108776140A (en) * 2018-06-08 2018-11-09 福建新大陆电脑股份有限公司 A kind of printed matter flaw detection method and system based on machine vision
CN111709426A (en) * 2020-05-08 2020-09-25 广州博进信息技术有限公司 Diatom identification method based on contour and texture
CN112270687A (en) * 2020-10-16 2021-01-26 鲸斛(上海)智能科技有限公司 Cloth flaw identification model training method and cloth flaw detection method
CN115482186A (en) * 2021-06-15 2022-12-16 富泰华工业(深圳)有限公司 Defect detection method, electronic device, and storage medium
CN115830606A (en) * 2021-09-17 2023-03-21 鸿海精密工业股份有限公司 Character flaw detection method, computer device and storage medium
CN113780235A (en) * 2021-09-24 2021-12-10 西安闻泰信息技术有限公司 Icon flaw detection method and system
CN113920090A (en) * 2021-10-13 2022-01-11 无锡雪浪数制科技有限公司 Preform appearance defect automatic detection method based on deep learning
CN116109572A (en) * 2022-12-28 2023-05-12 苏州凌云光工业智能技术有限公司 Workpiece edge weak defect detection method and device and electronic equipment
CN117011376A (en) * 2023-07-07 2023-11-07 重庆中科摇橹船信息科技有限公司 Industrial part comprehensive positioning method and system based on edge contour and feature moment
CN117269179A (en) * 2023-11-23 2023-12-22 平方和(北京)科技有限公司 High-precision detection method and system for edge defects of contact lens based on machine vision

Also Published As

Publication number Publication date
CN117576088B (en) 2024-04-05

Similar Documents

Publication Publication Date Title
Zhou et al. A surface defect detection framework for glass bottle bottom using visual attention model and wavelet transform
CN111815630B (en) Defect detection method and device for LCD screen
CN116168026B (en) Water quality detection method and system based on computer vision
CN115020267B (en) Semiconductor surface defect detection method
CN109632808B (en) Edge defect detection method and device, electronic equipment and storage medium
CN111192225B (en) Method, apparatus and computer program medium for determining whether a pipe is defective
Hong-Seok et al. Development of an inspection system for defect detection in pressed parts using laser scanned data
CN112858318B (en) Method for distinguishing screen foreign matter defect from dust, electronic equipment and storage medium
CN108889635B (en) Online visual inspection method for manufacturing defects of ring-pull cans
CN109671078A (en) A kind of product surface image abnormity detection method and device
CN114882041B (en) Voting and identification method for burrs inside cast iron pipeline
US20170125271A1 (en) Position detection apparatus, position detection method, information processing program, and storage medium
CN110706224A (en) Optical element weak scratch detection method, system and device based on dark field image
CN107230212B (en) Vision-based mobile phone size measuring method and system
CN115775236A (en) Surface tiny defect visual detection method and system based on multi-scale feature fusion
CN117576088B (en) Intelligent liquid impurity filtering visual detection method and device
CN117269179A (en) High-precision detection method and system for edge defects of contact lens based on machine vision
CN112565615A (en) Method and device for determining trigger point of flying shooting
CN115496755B (en) Mirror-like defect detection method and device based on structured light and gradient analysis
Forbes et al. Estimating fruit volume from digital images
CN115861225A (en) Bearing roller surface damage detection method based on damaged area fusion transformation
CN109142530A (en) Defects in Pressure Container guided wave localization method based on information fusion and elliptic imaging
CN114693626A (en) Method and device for detecting chip surface defects and computer readable storage medium
CN113705567A (en) Ship crack detection method, system, equipment and computer readable storage medium
Zhou et al. Machine vision based automatic apparatus and method for surface defect detection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant