Method and system for extracting printing ring of printed contact lens based on machine vision

Machine vision technology is used to extract the printed ring area of ​​contact lenses, which solves the problem of difficulty in extracting the printed ring in the existing technology, achieves efficient defect detection and improves production efficiency, and is suitable for a variety of lens types.

CN118644510AActive Publication Date: 2024-09-13SIGMA SQUARES (BEIJING) TECH CO LTD

Patent Information

Application Number
CN202410666483.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-09-13
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

Existing technology is difficult to effectively extract the printed ring area of ​​contact lenses, resulting in the inability to assist in lens surface defect detection, affecting production efficiency and product quality.

Method used

Using a method based on machine vision, by obtaining the original image of the contact lens, preprocessing, contour feature extraction and geometric parameter analysis are performed to identify and extract the printing area, including image format conversion, noise reduction processing, contour extraction, and geometric parameter checksum Polar coordinate transformation determines the coordinates of the starting and ending points of the printing area.

Benefits of technology

It achieves accurate extraction of the printing area of ​​contact lenses, helps companies detect and locate edge defects, reduces misleading manual detection, improves production efficiency, and adapts to lenses of different colors, patterns, sizes, and materials.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118644510A
    Figure CN118644510A
Patent Text Reader

Abstract

The invention relates to a method and a system for extracting a printing ring of a printed contact lens based on machine vision. The method comprises the following steps: acquiring an original image of the contact lens; preprocessing the original image to obtain a process image; extracting contour features of the process image, and judging whether contact lenses exist in the process image based on the contour features of the process image; when the contact lenses exist in the process image, geometric parameters of the contact lenses in the process image are extracted; a printing area in the process image is extracted based on geometric parameters of an edge profile of the contact lens. According to the method, the printing area of the contact lens can be effectively extracted, contact lens related enterprises are effectively helped to detect edge defects and locate the problem of the previous process, the labor cost is further reduced, and the production efficiency of products is greatly improved. Meanwhile, the contact lens fixing device can adapt to lenses of different colors, patterns, sizes and materials of contact lens manufacturers, is convenient to transplant, and can be efficiently and conveniently applied to the current production environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of machine vision, in particular to a method and system for extracting a printed ring of a printed contact lens based on machine vision. Background Art

[0002] Contact lenses, also called contact lenses or contact glasses, refer to lenses that are worn on the cornea of ​​the eye to correct vision or protect the eyes. In order to make the contact lenses more beautiful, in the prior art, patterns are printed on the surface of the contact lenses, such as cosmetic contact lenses.

[0003] However, due to the differences in contact lens materials, processes, and formulas, printed contact lenses have a variety of forms. It is difficult to find a good method to extract the printed ring area of ​​printed contact lenses, thereby failing to provide assistance for subsequent defect detection of the lens surface area. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a method and system for extracting a printed ring of a printed contact lens based on machine vision, so as to solve the problem in the prior art that it is difficult to extract the printed area of ​​the contact lens.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] A method for extracting a printed ring of a printed contact lens based on machine vision of the present invention comprises:

[0007] Acquire a raw image of the contact lens;

[0008] Preprocessing the original image to obtain a process image, wherein the preprocessing includes noise reduction processing;

[0009] Extracting contour features of the process image, and judging whether a contact lens exists in the process image based on the contour features of the process image;

[0010] When a contact lens exists in the process image, extracting geometric parameters of the contact lens in the process image;

[0011] The printing area in the process image is extracted based on geometric parameters of the edge contour of the contact lens.

[0012] In one embodiment of the present application, preprocessing the original image to obtain a process image includes:

[0013] Convert the original image from RAW format to RGB format to obtain an intermediate image;

[0014] Transforming the first intermediate image into a grayscale space to obtain a grayscale image;

[0015] Gaussian filtering is performed on the grayscale image to obtain a process image.

[0016] In one embodiment of the present application, extracting contour features of the process image, and judging whether a contact lens exists in the process image based on the contour features of the process image, includes:

[0017] Extracting contour pixels of the process image based on a contour extraction operator;

[0018] Counting the outline pixel points to obtain the number of outline pixel points;

[0019] The number of contour pixel points is compared with a preset number threshold, and when the number of contour pixel points is greater than the preset number threshold, it is determined that a contact lens exists in the process image; when the number of contour pixel points is less than or equal to the preset number threshold, it is determined that no contact lens exists in the process image.

[0020] In one embodiment of the present application, extracting geometric parameters of the contact lens in the process image includes:

[0021] Extracting edge contours in the process image to obtain an edge contour image;

[0022] Screening the contours in the edge contour image based on pre-configured lens parameters to obtain the edge contour of the contact lens;

[0023] Counting the number of pixel points of the edge contour of the contact lens to obtain the number of valid pixels PixNum; and performing integrity check on the edge contour of the contact lens based on the number of valid pixels PixNum;

[0024] When it is determined that the edge profile of the contact lens is complete, fitting the edge profile of the contact lens to obtain a fitting profile and geometric parameters of the fitting profile to be tested;

[0025] The geometric parameters to be checked are geometrically checked based on the pre-configured lens parameters, and the geometric parameters of the edge profile of the contact lens are obtained through the geometric check of the geometric parameters to be checked.

[0026] In one embodiment of the present application, the pre-configured lens parameters include the longest diameter interval DMaxRange, the shortest diameter interval DMinRange, the maximum tolerance threshold range of the major and minor axes of the lens DDiff, and the lens aspect ratio AspectRatio, wherein the contour in the edge contour image is screened based on the pre-configured lens parameters to obtain the edge contour of the contact lens, including:

[0027] Extracting geometric parameters of the contour in the edge contour image, wherein the geometric parameters of the contour include a major axis diameter a1, a minor axis diameter b1, an average diameter d1, a diameter difference dif1, and an aspect ratio asp1, d1=mean(a1, b1), dif1=abs(a1-b1), asp1=b1 / a1;

[0028] Matching the geometric parameters of the contour in the edge contour image with the preconfigured lens parameters, and when the geometric parameters of the contour in the edge contour image and the preconfigured lens parameters meet a first target condition, using the contour in the edge contour image as the edge contour of the contact lens, wherein the first target condition includes:

[0029] The average diameter d1 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0030] The aspect ratio asp1 is greater than or equal to the lens aspect ratio AspectRatio;

[0031] The diameter difference dif1 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

[0032] In one embodiment of the present application, the integrity check of the edge profile of the contact lens is performed based on the number of effective pixels PixNum, including:

[0033] When the number of valid pixels PixNum satisfies PixNum / edgeSamNumMin>rateTh, the edge contour of the contact lens is determined to be complete; otherwise, the edge contour of the contact lens is determined to be incomplete, wherein edgeSamNumMin is a preset minimum threshold value of the number of valid edge sampling points, and rateTh is a preset lens edge ratio.

[0034] In one embodiment of the present application, the geometric parameters to be tested include the major axis diameter a2, the minor axis diameter b2, the average diameter d2, the diameter difference dif2 and the aspect ratio asp2, wherein d2=mean(a2, b2), dif2=abs(a2-b2), asp2=b2 / a2;

[0035] Performing geometric verification on the geometric parameters to be verified based on pre-configured lens parameters, including:

[0036] Matching the geometric parameters to be checked with the pre-configured lens parameters, and when the geometric parameters to be checked and the pre-configured lens parameters meet a second target condition, performing a geometric check on the geometric parameters to be checked, wherein the second target condition includes:

[0037] The average diameter d2 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0038] The aspect ratio asp2 is greater than or equal to the lens aspect ratio AspectRatio;

[0039] The diameter difference dif2 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

[0040] In one embodiment of the present application, extracting the printed area in the process image based on the geometric parameters of the edge contour of the contact lens includes:

[0041] Performing polar coordinate transformation on the process image based on geometric parameters of the edge profile of the contact lens to obtain a polar coordinate image, wherein the printed area in the polar coordinate image is in the shape of a vertical strip;

[0042] Projecting the polar coordinate image along the vertical direction to obtain a one-dimensional vector, wherein the one-dimensional vector includes the number of printed textures at multiple positions;

[0043] Determine the starting point coordinates and the ending point coordinates of the printing area from the one-dimensional vector based on a preset printing area outer contour threshold and a printing area inner contour threshold;

[0044] The starting point coordinates and the ending point coordinates of the printing area are verified based on pre-set verification parameters, wherein the verification parameters include a threshold value of the outer contour of the printing area, a minimum radius of the printing ring, and a radius of the outer contour of the printing ring;

[0045] When the coordinates of the start point and the coordinates of the end point of the printing area are checked, the printing area is constructed based on the coordinates of the start point and the coordinates of the end point of the printing area.

[0046] In one embodiment of the present application, the printing area is annular, and the mathematical expression of the inner circle innerEllipse of the printing area is:

[0047] innerEllipse=((cx,cy),(sx*2,sx*2),0)

[0048] The mathematical expression of the foreign area of ​​the printing area is:

[0049] outerEllipse=((cx,cy),(ex*2,ex*2),0)

[0050] The mathematical expression of the lens as a whole fullEllipse is:

[0051] fullEllipse=((cx,cy),(a,b),0)

[0052] Among them, (cx, cy) is the center coordinate of the printing area, sx is the horizontal coordinate of the starting point of the printing area, ex is the horizontal coordinate of the ending point of the printing area, a is the major axis diameter of the printing area, and b is the minor axis diameter of the printing area.

[0053] The present application also provides a printing ring extraction system for printed contact lenses based on machine vision, comprising:

[0054] An acquisition module, used for acquiring an original image of the contact lens;

[0055] A preprocessing module, used for preprocessing the original image to obtain a process image, wherein the preprocessing includes noise reduction processing;

[0056] A contour extraction module, used to extract contour features of the process image, and determine whether a contact lens exists in the process image based on the contour features of the process image;

[0057] A geometric parameter extraction module, used for extracting geometric parameters of the edge contour of the contact lens from the process image when the contact lens exists in the process image;

[0058] The printing area extraction module is used to extract the printing area in the process image based on the geometric parameters of the edge contour of the contact lens.

[0059] The beneficial effects of the present invention are as follows: a method and system for extracting the printing ring of a printed contact lens based on machine vision of the present invention obtains the original image of the contact lens; then preprocesses the original image to obtain a process image, wherein the preprocessing includes noise reduction processing; extracts the contour features of the process image, and determines whether there is a contact lens in the process image based on the contour features of the process image; when there is a contact lens in the process image, extracts the geometric parameters of the contact lens in the process image; extracts the printing area in the process image based on the geometric parameters of the edge contour of the contact lens. The present application can effectively extract the printing area of ​​the contact lens, effectively helping contact lens-related companies to detect edge defects and locate problems in the front-end process, thereby being able to avoid misleading caused by the human eye senses during manual inspection to a great extent, further reducing labor costs, and greatly improving product production efficiency. At the same time, it can adapt to lenses of different colors, patterns, sizes, and materials of various contact lens manufacturers, is easy to transplant, and can be used in the current production environment more efficiently and conveniently. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:

[0061] Figure 1 It is a flow chart of a method for extracting a printed ring of a printed contact lens based on machine vision shown in an embodiment of the present application;

[0062] Figure 2 This is a schematic diagram of the pre-processing process in one embodiment of the present application;

[0063] Figure 3 This is a schematic diagram of a contour determination process in an embodiment of the present application;

[0064] Figure 4 This is a schematic diagram of the edge extraction process in one embodiment of the present application;

[0065] Figure 5 A schematic diagram of a process of extracting a printing area in an embodiment of the present application;

[0066] Figure 6 This is a schematic diagram of a process image in an embodiment of the present application;

[0067] Figure 7 is a polar coordinate image in an embodiment of the present application;

[0068] Figure 8 is a schematic diagram of a vertical projection in an embodiment of the present application;

[0069] Fig. 9 This is a structural diagram of a printed ring extraction system for printed contact lenses based on machine vision in one embodiment of the present invention. DETAILED DESCRIPTION

[0070] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0071] It should be noted that the illustrations provided in the following embodiments are only used to schematically illustrate the basic concept of the present invention. Therefore, the drawings only show the layers related to the present invention rather than being drawn according to the number, shape and size of the layers in actual implementation. In actual implementation, the type, quantity and proportion of each layer may be changed arbitrarily, and the layer layout may also be more complicated.

[0072] In the following description, numerous details are discussed to provide a more thorough explanation of embodiments of the present invention; however, it is apparent to one skilled in the art that embodiments of the present invention may be practiced without these specific details.

[0073] Before executing the printed ring extraction method of a printed contact lens based on machine vision in the present application, various parameters need to be pre-configured, including:

[0074] Lens size parameters: including lens size parameters, such as the longest diameter range DMaxRange, the shortest diameter range DMinRange, the maximum tolerance threshold of the major and minor axes of the lens DDiff, the aspect ratio of the lens AspectRatio, etc.

[0075] Loading algorithm parameters: including extraction parameters and analysis parameters, details are as follows:

[0076] Canny algorithm offset parameter edgeC, no-slice threshold parameter missTh;

[0077] The minimum threshold of effective edge sampling points edgeSamNumMin, the lens edge ratio rateTh;

[0078] Polar coordinate sampling angle deg, printing area inner contour threshold printInnerTh, printing area outer contour threshold printOuterTh, printing ring minimum radius printRMin, printing ring outer contour radius printOuterR;

[0079] System configuration parameters: whether to output images, etc.

[0080] After the above parameters are configured, the following extraction process begins.

[0081] Figure 1 is a flow chart of a method for extracting printed rings of printed contact lenses based on machine vision shown in an embodiment of the present application, such as Figure 1 As shown, this application includes image acquisition, preprocessing, contour judgment, edge extraction, printing area extraction, and result output. The specific introduction of each step is as follows:

[0082] S100, image acquisition: acquiring an original image of the contact lens;

[0083] This application uses a pre-configured camera to photograph the contact lens to obtain an original image;

[0084] S200, preprocessing: preprocessing the original image to obtain a process image, wherein the preprocessing includes noise reduction processing;

[0085] The preprocessing process is responsible for initializing the configuration of the detection system, as well as reading, loading, color space conversion, noise reduction and other operations on the contact lens images collected by the camera to reduce the interference caused by environmental noise, and finally generate the process image ProcessImage;

[0086] Figure 2 Schematic diagram of the pre-processing process in one embodiment of the present application. Figure 2 As shown in the figure, the specific process of preprocessing includes:

[0087] S210, converting the original image from RAW format to RGB format to obtain an intermediate image;

[0088] Specifically, the present application loads, decodes, and obtains the original image data of the camera, and converts it from RAW to RGB format to obtain an intermediate image Image.

[0089] S220, transforming the first intermediate image Image into a grayscale space to obtain a grayscale image GrayImage;

[0090] S230, performing Gaussian filtering on the grayscale image to obtain a process image ProcessImage.

[0091] Specifically, in this embodiment, the grayscale image GrayImage is subjected to Gaussian filtering with a kernel of 3×3 to obtain ProcessImage, in order to reduce interference caused by environmental noise.

[0092] S300, contour determination: extracting contour features of the process image, and determining whether a contact lens exists in the process image based on the contour features of the process image;

[0093] The contour judgment process is responsible for applying the Canny algorithm to the process image ProcessImage and judging whether there is a lens on the extracted relevant pixel content. The offset parameter edgeC of the Canny algorithm is pre-configured.

[0094] Figure 3 FIG. 1 is a schematic diagram of a contour determination process in an embodiment of the present application. Figure 3 As shown, after loading the process image ProcessImage and configuring the parameters edgeC and missTh, contour judgment begins;

[0095] The specific contour judgment process includes:

[0096] S310, extracting contour pixels of the process image based on a contour extraction operator;

[0097] Specifically, the Canny algorithm with an offset parameter of edgeC is used to extract the edge contour.

[0098] S320, counting the contour pixels to obtain the number of contour pixels PixNum;

[0099] S330, comparing the number of the contour pixel points with a preset number threshold, and when the number of the contour pixel points is greater than the preset number threshold, determining that a contact lens exists in the process image, and when the number of the contour pixel points is less than or equal to the preset number threshold, determining that no contact lens exists in the process image.

[0100] In this embodiment, PixNum is judged using missTh according to the number of contour pixels PixNum. If it is less than or equal to, there is no lens and the lens result Res is assigned "No Lens" and the result is output. Otherwise, it is considered that this module passes and the lens result Res is assigned "Pass". The expression is as follows:

[0101]

[0102] When the lens result Res is "Pass", it indicates that a contact lens exists in the process image ProcessImage, and the subsequent S400 process is performed;

[0103] S400, edge extraction: when a contact lens exists in the process image, extracting geometric parameters of the contact lens in the process image;

[0104] The edge extraction process is responsible for using the edge extraction algorithm on the ProcessImage generated by A to adaptively extract the corresponding lens edge image Edge and the lens geometric parameters Pars such as the centroid, major and minor axes of the corresponding fitting ellipse.

[0105] Figure 4 FIG. 1 is a schematic diagram of an edge extraction process in an embodiment of the present application. Figure 4 As shown, the specific edge extraction process includes:

[0106] S410, extracting edge contours in the process image to obtain an edge contour image;

[0107] This application uses an adaptive algorithm to extract the edge of ProcessImage to obtain the corresponding edge contour image Bin. Other edge detection operators such as Sobel, Canny, Robert, etc. can also be used in the specific implementation.

[0108] S420, screening the contours in the edge contour image based on pre-configured lens parameters to obtain an edge contour of the contact lens;

[0109] Specifically, the lens size parameters configured in the previous text are used for screening. If the contour meets the lens size parameters, the subsequent process is entered; if not, the result of the image is set to "Reverse", and the process ends and outputs the result.

[0110] The specific screening process includes:

[0111] S421, extracting geometric parameters of the contour in the edge contour image, wherein the geometric parameters of the contour include a major axis diameter a1, a minor axis diameter b1, an average diameter d1, a diameter difference dif1, and an aspect ratio asp1, d1 = mean (a1, b1), dif1 = abs (a1-b1), asp1 = b1 / a1;

[0112] S422, matching the geometric parameters of the contour in the edge contour image with the pre-configured lens parameters, and when the geometric parameters of the contour in the edge contour image and the pre-configured lens parameters meet a first target condition, using the contour in the edge contour image as the edge contour of the contact lens, wherein the first target condition includes:

[0113] The average diameter d1 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0114] The aspect ratio asp1 is greater than or equal to the lens aspect ratio AspectRatio;

[0115] The diameter difference dif1 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

[0116] The expression of the screening process is:

[0117]

[0118] S430, counting the number of pixel points of the edge contour of the contact lens to obtain the number of valid pixels PixNum; and performing integrity check on the edge contour of the contact lens based on the number of valid pixels PixNum;

[0119] After obtaining the edge contour of the contact lens, a completeness check is required. A complete contour can be directly fitted to obtain an elliptical complete lens contour. An incomplete contour cannot be fitted.

[0120] When the number of valid pixels PixNum satisfies PixNum / edgeSamNumMin>rateTh, the edge contour of the contact lens is determined to be complete and the subsequent process is entered; otherwise, the edge contour of the contact lens is determined to be incomplete, wherein edgeSamNumMin is a preset minimum threshold value of the number of valid edge sampling points, and rateTh is a preset lens edge ratio.

[0121] When the edge contour of the contact lens is incomplete, the image result is set to Crack, the process ends and the result is output.

[0122] The expression for integrity check is:

[0123]

[0124] S440, when it is determined that the edge profile of the contact lens is complete, fitting the edge profile of the contact lens to obtain a fitting profile and geometric parameters of the fitting profile to be tested;

[0125] The method used in this application is a least squares fitting ellipse algorithm based on PCA. In the specific implementation, other fitting ellipse algorithms can also be used, such as a three-arc combination selection algorithm.

[0126] The geometric parameters of the fitted ellipse of the corresponding contour are obtained, which are the major axis diameter a2, the minor axis diameter b2, the average diameter d2, the diameter difference dif2 and the aspect ratio asp2, where d2=mean(a2, b2), dif2=abs(a2-b2), asp2=b2 / a2 (a2≠0).

[0127] S450, performing geometric verification on the geometric parameters to be verified based on pre-configured lens parameters, and obtaining geometric parameters of the edge profile of the contact lens through the geometric verification of the geometric parameters to be verified.

[0128] The method of geometric verification is consistent with the screening process in step S420, and specifically includes:

[0129] Matching the geometric parameters to be checked with the pre-configured lens parameters, and when the geometric parameters to be checked and the pre-configured lens parameters meet a second target condition, performing a geometric check on the geometric parameters to be checked, wherein the second target condition includes:

[0130] The average diameter d2 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0131] The aspect ratio asp2 is greater than or equal to the lens aspect ratio AspectRatio;

[0132] The diameter difference dif2 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

[0133] Its expression is:

[0134]

[0135] If the geometry check is passed, the subsequent process will proceed. If the geometry check fails, the process will end and the result will be output.

[0136] S500, extracting a printed area: extracting a printed area in the process image based on geometric parameters of an edge contour of the contact lens.

[0137] Figure 5 FIG. 1 is a flow chart of printing area extraction in an embodiment of the present application. Figure 5 As shown, the specific printing area extraction process includes:

[0138] S510, performing polar coordinate transformation on the process image based on geometric parameters of the edge profile of the contact lens to obtain a polar coordinate image, wherein the printed area in the polar coordinate image is in a vertical strip shape;

[0139] This application uses the geometric parameters Pars extracted in the previous text to perform polar coordinate transformation on the process image ProcessImage to obtain the polar coordinate image Polar_Pro; specifically:

[0140] Perform a radial scan with the center coordinates of the circle as the center point.

[0141] The center of the circle required by the polar coordinate transformation formula is the center of the ellipse c(cx, cy) in Pars, and the radius is r=mean(a2 / / 2, b2 / / 2). In the polar coordinate system, the horizontal axis is the polar angle and the vertical axis is the polar diameter.

[0142] The transformation formula is:

[0143] The sampling angle deg is pre-configured, and the number of samples is

[0144] Therefore, this application uses c,cnt to perform polar coordinate transformation on the process image ProcessImag, and the interpolation method is nearest neighbor interpolation to obtain the polar coordinate image to Polar_Pro;

[0145] Figure 6 This is a schematic diagram of a process image in an embodiment of the present application. Figure 7 is a polar coordinate image in an embodiment of the present application, such as Figure 6-Figure 7 As shown, the circular ring in the original image becomes a ribbon through polar coordinate transformation.

[0146] S520, projecting the polar coordinate image along the vertical direction to obtain a one-dimensional vector, wherein the one-dimensional vector includes the number of printed textures at multiple positions;

[0147] Figure 8 is a schematic diagram of a vertical projection in an embodiment of the present application, such as Figure 8 As shown, the polar coordinate image Polar_Pro is vertically projected along the edge line to obtain the corresponding one-dimensional vector vec. The arrow in the figure indicates the projection direction, and the left part is the printed pattern part of the lens.

[0148] S530, determining the starting point coordinates and the ending point coordinates of the printing area from the one-dimensional vector based on a preset printing area outer contour threshold and a printing area inner contour threshold;

[0149] This application uses the pre-configured printing area inner contour threshold printInnerTh and printing area outer contour threshold printOuterTh to screen and traverse vec to determine the corresponding vec subscript, which is the starting point ps, pe of the printing area.

[0150] In this embodiment, the comparison may be continued in sequence, with the area meeting the printing area inner contour threshold printInnerTh being taken as the starting point ps, and the area meeting the printing area outer contour threshold printOuterTh being taken as the ending point ps.

[0151] Since the center of the circle in Pars is used as the polar coordinate system, the inner radius of the printing area is the horizontal coordinate sx where ps is located, and the outer radius of the printing area is the horizontal coordinate ex where ps is located, where sx<ex

[0152] S540, verifying the starting point coordinates and the ending point coordinates of the printing area based on pre-set verification parameters, wherein the verification parameters include a printing area outer contour threshold printOuterTh, a printing ring minimum radius printRMin, and a printing ring outer contour radius printOuterR;

[0153] If all conditions are met, the extraction of the printing area is considered successful and the subsequent process is entered; otherwise, the process exits and assigns the lens result Res to "Print Failed" and finally enters the result output module.

[0154] S550: constructing a printing area based on the starting point coordinates and the ending point coordinates of the printing area when the starting point coordinates and the ending point coordinates of the printing area are verified.

[0155] The printing area is annular, and the mathematical expression of the inner circle innerEllipse of the printing area is:

[0156] innerEllipse=((cx,cy),(sx*2,sx*2),0)

[0157] The mathematical expression of the foreign area of ​​the printing area is:

[0158] outerEllipse=((cx,cy),(ex*2,ex*2),0)

[0159] The mathematical expression of the lens as a whole fullEllipse is:

[0160] fullEllipse=((cx,cy),(a,b),0)

[0161] Among them, (cx, cy) is the center coordinate of the printing area, sx is the horizontal coordinate of the starting point of the printing area, ex is the horizontal coordinate of the ending point of the printing area, a is the major axis diameter of the printing area, and b is the minor axis diameter of the printing area.

[0162] S600, result output;

[0163] The above results are packaged and output. For example, in step S300, when a lens is detected, the printed ellipse information obtained for a normal lens is output, that is, innerEllipse, outerEllipse, and fullEllipse; otherwise, the corresponding step is output.

[0164] This application has been verified in practice and can achieve a single-image processing capability of 50ms in a real-machine test on an 8-core i5-11357 PC.

[0165] There are a total of 500 test samples, which are printed contact lens images from various manufacturers.

[0166] The system report outputs the corresponding printed inner ring ellipse information and outer ring ellipse information, totaling 500 groups, with an extraction rate of 100%.

[0167] The use of this edge defect detection system can effectively help contact lens-related companies detect edge defects and locate problems in the front-end process. It can largely avoid the misleading caused by the human eye during manual inspection, while further reducing labor costs and greatly improving product production efficiency.

[0168] The application adopts the relevant configuration table for operation, which can easily adapt to lenses of different colors, patterns, sizes, and materials of various contact lens manufacturers, is easy to transplant, and can be used in the current production environment more efficiently and conveniently.

[0169] The printed contact lens printed ring extraction system based on machine vision proposed in this application has higher deployment convenience and better user experience, and effectively fills the market gap compared to the current mechanical deployment operation.

[0170] like Fig. 9 As shown, the present application also provides a printing ring extraction system for printed contact lenses based on machine vision, comprising:

[0171] An acquisition module, used for acquiring an original image of the contact lens;

[0172] A preprocessing module, used for preprocessing the original image to obtain a process image, wherein the preprocessing includes noise reduction processing;

[0173] A contour extraction module, used to extract contour features of the process image, and determine whether a contact lens exists in the process image based on the contour features of the process image;

[0174] A geometric parameter extraction module, used for extracting geometric parameters of the edge contour of the contact lens from the process image when the contact lens exists in the process image;

[0175] The printing area extraction module is used to extract the printing area in the process image based on the geometric parameters of the edge contour of the contact lens.

[0176] The present invention discloses a printing ring extraction system for printed contact lenses based on machine vision, which obtains the original image of the contact lens; then pre-processes the original image to obtain a process image, wherein the pre-processing includes noise reduction processing; extracts the contour features of the process image, and determines whether there is a contact lens in the process image based on the contour features of the process image; when there is a contact lens in the process image, extracts the geometric parameters of the contact lens in the process image; and extracts the printed area in the process image based on the geometric parameters of the edge contour of the contact lens. The present application can effectively extract the printed area of ​​the contact lens, effectively helping contact lens-related companies to detect edge defects and locate problems in the front-end process, thereby being able to avoid misleading caused by the human eye senses during manual inspection to a great extent, further reducing labor costs, and greatly improving product production efficiency. At the same time, it can adapt to lenses of different colors, patterns, sizes, and materials of various contact lens manufacturers, is easy to transplant, and can be used in the current production environment more efficiently and conveniently.

[0177] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in this embodiment is implemented, wherein the method is the execution logic of this system.

[0178] This embodiment also provides an electronic terminal, including: a processor and a memory;

[0179] The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes any one of the methods in this embodiment.

[0180] The computer-readable storage medium in this embodiment can be understood by ordinary technicians in this field: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0181] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver and a communication interface. 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 computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run computer programs so that the electronic terminal executes each step of the above method.

[0182] In this embodiment, the memory may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0183] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0184] In the above-mentioned embodiments, although the present invention has been described in conjunction with the specific embodiments of the present invention, many replacements, modifications and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. The embodiments of the present invention are intended to cover all such replacements, modifications and variations falling within the broad scope of the appended claims.

[0185] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A method for extracting printed rings of printed contact lenses based on machine vision, characterized in that: Includes steps: Acquire a raw image of the contact lens; Preprocessing the original image to obtain a process image, wherein the preprocessing includes noise reduction processing; Extracting contour features of the process image, and judging whether a contact lens exists in the process image based on the contour features of the process image; When a contact lens exists in the process image, extracting geometric parameters of the contact lens in the process image; The printing area in the process image is extracted based on geometric parameters of the edge contour of the contact lens.

2. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 1, characterized in that: Preprocessing the original image to obtain a process image includes: Convert the original image from RAW format to RGB format to obtain an intermediate image; Transforming the first intermediate image into a grayscale space to obtain a grayscale image; Gaussian filtering is performed on the grayscale image to obtain a process image.

3. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 1, characterized in that: Extracting contour features of the process image, and judging whether a contact lens exists in the process image based on the contour features of the process image, comprising: Extracting contour pixels of the process image based on a contour extraction operator; Counting the outline pixel points to obtain the number of outline pixel points; The number of the contour pixel points is compared with a preset number threshold, and when the number of the contour pixel points is greater than the preset number threshold, it is determined that a contact lens exists in the process image; when the number of the contour pixel points is less than or equal to the preset number threshold, it is determined that no contact lens exists in the process image.

4. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 1, characterized in that: Extracting geometric parameters of the contact lens in the process image, including: Extracting edge contours in the process image to obtain an edge contour image; Screening the contours in the edge contour image based on pre-configured lens parameters to obtain the edge contour of the contact lens; Counting the number of pixel points of the edge contour of the contact lens to obtain the number of valid pixels PixNum; and performing integrity check on the edge contour of the contact lens based on the number of valid pixels PixNum; When it is determined that the edge profile of the contact lens is complete, fitting the edge profile of the contact lens to obtain a fitting profile and geometric parameters of the fitting profile to be tested; The geometric parameters to be checked are geometrically checked based on the pre-configured lens parameters, and the geometric parameters of the edge profile of the contact lens are obtained through the geometric check of the geometric parameters to be checked.

5. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 4, characterized in that: The pre-configured lens parameters include the longest diameter interval DMaxRange, the shortest diameter interval DMinRange, the maximum tolerance threshold range DDiff of the lens major and minor axes, and the lens aspect ratio AspectRatio. The contours in the edge contour image are screened based on the pre-configured lens parameters to obtain the edge contour of the contact lens, including: Extracting geometric parameters of the contour in the edge contour image, wherein the geometric parameters of the contour include a major axis diameter a1, a minor axis diameter b1, an average diameter d1, a diameter difference dif1, and an aspect ratio asp1, d1=mean(a1,b1), dif1=abs(a1-b1), asp1=b1 / a1; Matching the geometric parameters of the contour in the edge contour image with the preconfigured lens parameters, and when the geometric parameters of the contour in the edge contour image and the preconfigured lens parameters meet a first target condition, using the contour in the edge contour image as the edge contour of the contact lens, wherein the first target condition includes: The average diameter d1 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange; The aspect ratio asp1 is greater than or equal to the lens aspect ratio AspectRatio; The diameter difference dif1 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

6. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 4, characterized in that: Performing integrity check on the edge profile of the contact lens based on the effective pixel number PixNum includes: When the number of valid pixels PixNum satisfies PixNum / edgeSamNumMin>rateTh, the edge contour of the contact lens is determined to be complete; otherwise, the edge contour of the contact lens is determined to be incomplete, wherein edgeSamNumMin is a preset minimum threshold value of the number of valid edge sampling points, and rateTh is a preset lens edge ratio.

7. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 4, characterized in that: The geometric parameters to be tested include the major axis diameter a2, the minor axis diameter b2, the average diameter d2, the diameter difference dif2 and the aspect ratio asp2, wherein d2=mean(a2,b2), dif2=abs(a2-b2), asp2=b2 / a2; Performing geometric verification on the geometric parameters to be verified based on pre-configured lens parameters, including: Matching the geometric parameters to be checked with the pre-configured lens parameters, and when the geometric parameters to be checked and the pre-configured lens parameters meet a second target condition, performing a geometric check on the geometric parameters to be checked, wherein the second target condition includes: The average diameter d2 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange; The aspect ratio asp2 is greater than or equal to the lens aspect ratio AspectRatio; The diameter difference dif2 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

8. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 1, characterized in that: Extracting the printed area in the process image based on geometric parameters of the edge profile of the contact lens includes: Performing polar coordinate transformation on the process image based on geometric parameters of the edge profile of the contact lens to obtain a polar coordinate image, wherein the printed area in the polar coordinate image is in the shape of a vertical strip; Projecting the polar coordinate image along the vertical direction to obtain a one-dimensional vector, wherein the one-dimensional vector includes the number of printed textures at multiple positions; Determine the starting point coordinates and the ending point coordinates of the printing area from the one-dimensional vector based on a preset printing area outer contour threshold and a printing area inner contour threshold; The starting point coordinates and the ending point coordinates of the printing area are verified based on pre-set verification parameters, wherein the verification parameters include a threshold value of the outer contour of the printing area, a minimum radius of the printing ring, and a radius of the outer contour of the printing ring; When the coordinates of the start point and the coordinates of the end point of the printing area are checked, the printing area is constructed based on the coordinates of the start point and the coordinates of the end point of the printing area.

9. The method for extracting printed rings of printed contact lenses based on machine vision according to claim 8, characterized in that: The printing area is annular, and the mathematical expression of the inner circle innerEllipse of the printing area is: innerEllipse=((cx,cy),(sx*2,sx*2),0) The mathematical expression of the outer circle of the printing area is: outerElipse=((cx,cy),(ex*2,ex*2),0) The mathematical expression of the lens as a whole fullEllipse is: fullElipse=((cx,cy),(a,b),0) Among them, (cx, cy) is the center coordinate of the printing area, sx is the horizontal coordinate of the starting point of the printing area, ex is the horizontal coordinate of the ending point of the printing area, a is the major axis diameter of the printing area, and b is the minor axis diameter of the printing area.

10. A printed ring extraction system for printed contact lenses based on machine vision, characterized in that: include: An acquisition module, used for acquiring an original image of the contact lens; A preprocessing module, used for preprocessing the original image to obtain a process image, wherein the preprocessing includes noise reduction processing; A contour extraction module, used to extract contour features of the process image, and determine whether a contact lens exists in the process image based on the contour features of the process image; A geometric parameter extraction module, used for extracting geometric parameters of the edge contour of the contact lens from the process image when the contact lens exists in the process image; The printing area extraction module is used to extract the printing area in the process image based on the geometric parameters of the edge contour of the contact lens.

Citation Information

Patent Citations

  • Method and system for detecting defect of printed matter based on machine vision

    CN108776140A

  • Contact lens casting mold printing quality detection method and device

    CN114742752A

  • Contact lens flaw detection method and system, electronic equipment and storage medium

    CN115239663A

  • High-precision contact lens edge defect detection method and system based on machine vision

    CN117269179A

  • Printing defect detection method and system and electronic equipment

    CN117611577A

Cited By

  • High-precision multi-light-field contact lens edge defect detection method and device based on polar coordinate system

    CN119338797A

  • A high-precision multi-light field contact lens edge defect detection method and device based on polar coordinate system

    CN119338797B

  • Tracking and tracing system based on intelligent contact lens production line

    CN120851911A