A high-precision detection method and system for contact lens printing area stains based on convex defects

By using a convex defect-based detection method, stains in the printing area of ​​contact lenses can be automatically identified, solving the problems of low efficiency and insufficient accuracy in traditional detection methods. This achieves efficient and accurate stain detection, improving production efficiency and yield.

CN120374539BActive Publication Date: 2025-12-09SIGMA SQUARES (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510446299.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-12-09
Estimated Expiration
2045-04-10

AI Technical Summary

Technical Problem

Traditional contact lens quality inspection methods rely on manual inspection, which makes it difficult to identify tiny stains and complex surface features, resulting in low efficiency. Existing optical inspection technologies are also unable to achieve high-precision identification and quantitative analysis.

Method used

A convex defect-based detection method is adopted. By acquiring and preprocessing contact lens images, the outer contour of the printing area is located, the convex hull and convex defects are calculated, a circular mask is constructed to extract stains, and morphological processing and mask operations are used to automatically identify stains.

Benefits of technology

It achieves high-precision automatic detection of stains in the printing area of ​​contact lenses, improving detection efficiency and production yield, and reducing labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120374539B_ABST
    Figure CN120374539B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer image, and particularly relates to a high-precision contact lens printing area stain detection method and system based on convex defects, which comprises the following steps: obtaining a contact lens image, and preprocessing the contact lens image to obtain a pretreated image; positioning the edge of the pretreated image based on morphology to obtain a printing area outer circle contour; calculating the convex hull of the printing area outer circle contour, determining a plurality of convex defects of the printing area of the contact lens image based on the printing area outer circle contour and the convex hull; determining the shape of the printing area outer circle contour based on the plurality of convex defects; constructing a circle representing the printing area outer circle contour based on the plurality of convex defects, and extracting the stain of the printing area of the contact lens image based on the pre-constructed mask and the circle. The present application can automatically identify the image, and can quickly and efficiently complete the comprehensive detection of the contact lens, so as to achieve the purposes of reducing cost, improving production efficiency, and improving the production yield.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computer images, and in particular to a high-precision method and system for detecting stains in a printing area of a contact lens based on convex defects. BACKGROUND

[0002] The main printing method for contact lenses is pad printing, and when printing ink, the mold is exposed to the air. Dust and other impurities are easily dropped near the printing area of the mold, thereby causing defects. The traditional quality detection method for contact lenses relies on manual detection, and this detection method has the following disadvantages: the area of the stain defect is small, and manual detection under a high-power magnifying glass for a long time is required, which is prone to cause false judgments due to eye fatigue; small stains in the printing area are not easy to distinguish from ink; and the detection efficiency is relatively low. In addition, existing optical detection technology is difficult to accurately identify and quantitatively analyze the complex surface features of contact lenses, such as pattern morphology and small stains. SUMMARY

[0003] Therefore, the purpose of the present application is to provide a high-precision method and system for detecting stains in a printing area of a contact lens based on convex defects to solve the problems in the background art.

[0004] In order to achieve the above-mentioned purpose, the present application adopts the following technical solutions:

[0005] The high-precision method for detecting stains in a printing area of a contact lens based on convex defects comprises the following steps:

[0006] Obtaining a contact lens image and pre-processing the contact lens image to obtain a pre-processed image;

[0007] Positioning the edge of the pre-processed image based on morphology to obtain an outer circle contour of the printing area;

[0008] Calculating the convex hull of the outer circle contour of the printing area, determining a plurality of convex defects of the printing area of the contact lens image based on the outer circle contour of the printing area and the convex hull, and determining the morphology of the outer circle contour of the printing area based on the plurality of convex defects;

[0009] Constructing a circle representing the outer circle contour of the printing area based on the plurality of convex defects, and extracting stains in the printing area of the contact lens image based on a pre-constructed mask and the circle.

[0010] In an embodiment of the present application, the pre-processing of the contact lens image to obtain a pre-processed image comprises:

[0011] Loading the contact lens image;

[0012] Performing color space conversion on the loaded contact lens image to obtain a pre-processed image in a target color space.

[0013] In an embodiment of the present application, morphological-based edge positioning is performed on the preprocessed image to obtain an outer circle contour of the printing area, including:

[0014] Gaussian filtering is performed on the preprocessed image to obtain a filtered image;

[0015] Gray scale conversion is performed on the filtered image to obtain a gray scale image;

[0016] Adaptive binaryzation is performed on the gray scale image to obtain a binary image;

[0017] Morphological processing is performed on the binary image to obtain an intermediate image, wherein the intermediate image includes all contour features of the printing area;

[0018] Based on a pre-constructed area screening range, the area of each contour feature in the intermediate image is screened to obtain a target contour conforming to the area screening range, wherein the target contour is the outer circle contour of the printing area.

[0019] In an embodiment of the present application, based on the outer circle contour of the printing area and the convex hull, a plurality of convex defects of the printing area of the contact lens image are determined, including:

[0020] Difference is performed on the outer circle contour of the printing area and the convex hull to obtain convex defects.

[0021] In an embodiment of the present application, based on the plurality of convex defects, the shape of the outer circle contour of the printing area is determined, including:

[0022] The end point and the farthest point of each convex defect are extracted to obtain a convex defect point set, wherein the farthest point is a point in each convex defect that is located on the outer circle contour of the printing area and is farthest from the convex hull;

[0023] Ellipse fitting is performed on all convex defect points of the convex defect point set to obtain a fitting circle and a center of the fitting circle;

[0024] The distance between all convex defect points of the convex defect point set and the center of the fitting circle is calculated, the sum of all distances is calculated, and when the sum of all distances is less than a preset first distance threshold, it is determined that the shape of the outer circle contour of the printing area is circular, otherwise, it is determined that the shape of the outer circle contour of the printing area is not circular.

[0025] In an embodiment of the present application, based on the plurality of convex defects, a circular shape representing the outer circle contour of the printing area is constructed, including:

[0026] The distance between all convex defect points of the convex defect point set and the center of the fitting circle is calculated, and convex defect points with a distance greater than a preset second distance threshold are removed to obtain a screened convex defect point set.

[0027] fitting all convex defect points in the screened convex defect point set to obtain a circle representing the outer circle profile of the printing area.

[0028] In an embodiment of the present application, the stain of the printing area of the contact lens image is extracted based on the mask constructed in advance and the circle, comprising:

[0029] constructing a mask based on the circle, and performing a bitwise AND operation on the mask and the binary image to obtain a candidate stain profile;

[0030] calculating the areas of all candidate stain profiles, and screening all candidate stain profiles based on a pre-set minimum detection area, so as to take the candidate stain profile with an area greater than the minimum detection area as a stain profile;

[0031] drawing the stain profile in the contact lens image to obtain the stain of the printing area of the contact lens image.

[0032] The present application also provides a high-precision contact lens printing area stain detection system based on convex defects, comprising:

[0033] a preprocessing module configured to acquire a contact lens image and pre-process the contact lens image to obtain a pre-processed image;

[0034] a printing area edge positioning module configured to position the edges of the pre-processed image based on morphology to obtain an outer circle profile of the printing area;

[0035] an outer circle morphology judging module configured to calculate a convex hull of the outer circle profile of the printing area, determine a plurality of convex defects of the printing area of the contact lens image based on the outer circle profile of the printing area and the convex hull, and determine the morphology of the outer circle profile of the printing area based on the plurality of convex defects;

[0036] an outer circle stain detection module configured to construct a circle representing the outer circle profile of the printing area based on the plurality of convex defects, and extract the stain of the printing area of the contact lens image based on a mask constructed in advance and the circle.

[0037] The present application also provides an electronic device, comprising a processor and a memory.

[0038] The memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory to enable the terminal to perform the method described above.

[0039] The present application also provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method described above.

[0040] The beneficial effects of the present application are: the convex defect-based contact lens printing area stain high-precision detection method and system, by acquiring a contact lens image, and preprocessing the contact lens image to obtain a pretreated image; the edge based on morphology is positioned to obtain the outer circle contour of the printing area; the convex hull of the outer circle contour of the printing area is calculated, and the multiple convex defects of the printing area of the contact lens image are determined based on the outer circle contour of the printing area and the convex hull; and the shape of the outer circle contour of the printing area is determined based on the multiple convex defects; the circular shape representing the outer circle contour of the printing area is constructed based on the multiple convex defects, and the stain of the printing area of the contact lens image is extracted based on the pre-constructed mask and the circular shape. The present application can automatically identify the image, quickly and efficiently complete the comprehensive detection of the contact lens, so as to achieve the purposes of reducing cost, improving production efficiency and improving production yield. BRIEF DESCRIPTION OF DRAWINGS

[0041] The present application will be further described below in combination with the drawings and embodiments:

[0042] Figure 1 It is an ideal schematic diagram of a contact lens mold shown in an embodiment of the present application;

[0043] Figure 2 It is a stain schematic diagram of a contact lens mold shown in an embodiment of the present application;

[0044] Figure 3 It is a flowchart of a convex defect-based contact lens printing area stain high-precision detection method shown in an embodiment of the present application;

[0045] Figure 4 It is a pretreatment flowchart shown in an embodiment of the present application;

[0046] Figure 5 It is a printing area edge positioning flowchart shown in an embodiment of the present application;

[0047] Figure 6 It is an outer circle shape judgment flowchart shown in an embodiment of the present application;

[0048] Figure 7 It is an outer circle stain detection flowchart shown in an embodiment of the present application;

[0049] Figure 8 It is a structure diagram of a convex defect-based contact lens printing area stain high-precision detection system shown in an embodiment of the present application. DETAILED DESCRIPTION

[0050] Following make the specific concrete example explain the embodiment of the present application, the person skilled in the art can be easily understood from the disclosure of the present application other advantages and efficacy.The present application can also be implemented or applied by another different embodiment, the details in the specification can be based on different views and applications, without departing from the spirit of the present application, various modifications or changes.The need to explain, in the following examples and the features in the examples can be combined with each other without conflict.

[0051] Need to explain, the drawings provided in the following examples only illustrate the basic concept of the present application in a schematic way, and the drawings only show the layers related to the present application, not according to the actual implementation of the number of layers, shape and size, the actual implementation of each layer of the type, quantity and proportion can be a kind of arbitrary change, and its layer layout type may be more complex.

[0052] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application, however, it is obvious to the person skilled in the art that the embodiments of the present application can be implemented without these specific details.

[0053] Figure 1 For the ideal schematic diagram of the contact lens mold shown in an embodiment of the present application, as shown in the figure, the area outside the mold is the background area, which is black. The mold area is the circle drawn by the mold edge in the figure, that is, the white area. The green area in the mold area represents the printing area. The inner and outer edges of the printing area are represented by dashed lines, which are actually the maximum inscribed circle and the minimum circumscribed circle fitted according to the position of the ink. Figure 1

[0054] For the contact lens mold stain schematic diagram shown in an embodiment of the present application, as shown in the figure, there may be stains near the outer edge of the printing area of the contact lens mold in actual production. When fitting the minimum circumscribed circle, the stains may be regarded as ink, which interferes with the fitting of the outer edge of the printing area and is missed. Figure 2 Figure 2 In order to solve the above problems, the present application adopts a high-precision contact lens printing area stain detection method based on convex defects. Before executing the above method, pre-configuration is required, including reading the configuration file, which mainly includes the parameters required by the algorithm. Including the minimum threshold of mold area MouldAreaLowerLimit, the maximum threshold of mold area MouldAreaUpperLimit, the minimum threshold of printing area outer ring area PrintZoneAreaLowerLimit, the maximum threshold of printing area outer ring area PrintZoneAreaUpperLimit, etc.

[0055] ​​

[0056] Figure 3 is a flowchart of a high-precision contact lens printing area stain detection method based on convex defects shown in an embodiment of the present application, as shown in Figure 3 The high-precision contact lens printing area stain detection method based on convex defects of the present embodiment can include the following steps:

[0057] S310, obtain a contact lens image and pre-process the contact lens image to obtain a pre-processed image;

[0058] The purpose of step S310 is to read the parameters required by the algorithm under the current light field, and to load, color space conversion, the contact lens mold image collected by the high-resolution camera, and convert the initial image format collected by the camera into the image format required by the algorithm. Figure 4 The pre-processing flowchart in an embodiment of the present application is shown in Figure 4 The pre-processing flowchart specifically includes the following steps:

[0059] S311, load the contact lens image; including loading, decoding, and reading camera image data.

[0060] S312, perform color space conversion on the loaded contact lens image to obtain a pre-processed image in a target color space. The purpose is to convert the Bayer format image obtained from the camera into BGR format.

[0061] S320, perform morphological-based edge positioning on the pre-processed image to obtain a printing area outer circle contour;

[0062] After obtaining the colored pre-processed image, the printing area outer circle contour is positioned through steps such as filtering, color space conversion, adaptive binarization, and morphological processing. Figure 5 The flowchart of printing area edge positioning in an embodiment of the present application is shown in Figure 5 The specific process of the printing area edge positioning flowchart includes the following steps:

[0063] S321, perform Gaussian filtering on the pre-processed image to obtain a filtered image; Gaussian filtering on the input pre-processed image image can reduce noise interference.

[0064] S322, perform grayscale conversion on the filtered image to obtain a grayscale image gray_image;

[0065] S323, perform adaptive binarization on the grayscale image to obtain a binary image; the binary image contains ink and stains.

[0066] S324, performing morphological processing on the binary image to obtain an intermediate image, wherein the intermediate image comprises all contour features of the printing area;

[0067] The morphological processing comprises multiple closing and opening operation processes, which removes noise and connects all inks to form a printing area close to a circle, and the contour of the printing area is also closed to form a complete contour feature;

[0068] S325, screening the area of each contour feature in the intermediate image based on a pre-constructed area screening range to obtain a target contour conforming to the area screening range, wherein the target contour is a printing area outer contour.

[0069] First, contour searching is performed to screen out contours in the image after morphological processing, and the printing area outer contour is located according to a preset contour area, that is, the printing area outer contour PrintOuterContour must satisfy that its area area is within the interval of the minimum threshold of the printing area area PrintZoneAreaLowerLimit and the maximum threshold of the printing area area PrintZoneAreaUpperLimit.

[0070] The expression of the screening process is:

[0071]

[0072] S330, calculating a convex hull of the printing area outer contour, determining multiple convex defects of the printing area of the contact lens image based on the printing area outer contour and the convex hull, and determining the shape of the printing area outer contour based on the multiple convex defects;

[0073] The purpose of step S330 is to calculate the convex hull and the convex defects based on the printing area outer contour, then traverse the convex defect information to obtain the end point of each convex defect and the point on the contour farthest from the convex hull, that is, the convex defect point set. Then, a circle is fitted based on the convex defect point set. Finally, the distance from the convex defect point set to the center of the fitted circle is determined, and it is judged whether the printing area pattern shape is a near circle. Figure 6 The flowchart of the outer contour shape judgment in an embodiment of the present application is shown in FIG. 2. Figure 6 As shown in FIG. 2, the judgment process of the outer contour shape specifically comprises:

[0074] S331, calculating the convex hull, first, performing convex hull calculation on the target contour, the convex hull is the smallest convex polygon that can contain all points of the target contour;

[0075] S332, difference between the outer edge contour of the printing area and the convex hull is calculated to obtain convex defects. Based on the convex hull, the difference between the contour and the convex hull, i.e. the convex defects, is calculated, which may be caused by uneven ink distribution or other surface irregularities such as stains.

[0076] S333, traverse the calculated convex defect information to extract the end point and the farthest point of each convex defect to obtain a convex defect point set, wherein the farthest point is the point in each convex defect that is farthest from the convex hull and is located on the outer edge contour of the printing area, i.e. the convex defect point set {(x1, y1), (x2, y2), …, (x i , y i )};

[0077] S334, fitting circle, ellipse fitting is performed on all convex defect points of the convex defect point set to obtain a fitting circle and the center (x0, y0) of the fitting circle;

[0078] S335, distance calculation, the distance between all convex defect points of the convex defect point set and the center of the fitting circle is calculated, and the sum of all distances is calculated, i.e. by traversing the end point of all defects and the point on the contour farthest from the convex hull and calculating the distance to the center (x0, y0) of the fitting circle, i.e.

[0079] S336, shape judgment, when the sum of all distances is less than a preset first distance threshold, it is determined that the shape of the outer edge contour of the printing area is circular, otherwise, it is determined that the shape of the outer edge contour of the printing area is not circular. The first distance threshold is var, and the judgment expression is:

[0080]

[0081] S340, based on the plurality of convex defects, a circle representing the outer edge contour of the printing area is constructed, and based on the pre-constructed mask and the circle, a stain of the printing area of the contact lens image is extracted.

[0082] In step S340, the convex defect point set needs to be screened first, and if the distance from a point in the set to its fitting circle is greater than a preset threshold, the point is removed from the convex defect point set. Then, a mask for shielding the ink of the printing area is generated according to the screened point set, a logical AND operation is performed between the obtained contact lens mold binary image and the mask image to obtain an outer printing area binary image. Finally, the outer printing area stain is detected through contour finding and stain screening. Figure 7 For the flowchart of the outer circle stain detection in an embodiment of the present application, as shown in Figure 7 , the outer circle stain detection flow specifically includes:

[0083] S341, calculate the distance between all convex defect points of the convex defect point set and the center of the fitted circle, and remove the convex defect points with a distance greater than a preset second distance threshold, to obtain a screened convex defect point set;

[0084] Specifically, the convex defect point set {(x1, y1), (x2, y2), …, (x i , y i )} needs to be traversed, and then the distance between the convex defect points and the center (x0, y0) of the fitted circle is calculated. If the distance is greater than a preset threshold, the convex defect point is removed from the convex defect point set.

[0085] S342, fitting all convex defect points in the screened convex defect point set to obtain a circular shape representing the outer circle contour of the printing area. The screened convex defect point set can be fitted to obtain a circular shape with the most matched shape.

[0086] S343, constructing a mask based on the circular shape and performing a bitwise AND operation on the mask and the binary image to obtain a candidate smudge contour.

[0087] First, a mask is generated. When generating the mask, a full 255 pixel mask image of the same size as the input image is first generated, and then a circle is drawn based on the circular shape obtained in D12, and filled with 0 grayscale value to obtain the mask.

[0088] After obtaining the mask, the binary image obtained in step S323 is subjected to a bitwise AND operation with the mask to obtain an AND image containing the candidate smudge contour.

[0089] S344, calculate the area of all candidate smudge contours, and screen all candidate smudge contours based on a pre-set minimum detection area to select the candidate smudge contour with an area greater than the minimum detection area as the smudge contour.

[0090] Specifically, when the contour area is greater than the minimum detection area SmudgeArea, the current contour is determined to be a smudge.

[0091] S345, draw the smudge contour in the contact lens image to obtain the smudge of the printing area of the contact lens image.

[0092] The application provides a high-precision printing area stain detection method for contact lenses based on convex defects, and the method comprises the following steps: acquiring a contact lens image, and pre-processing the contact lens image to obtain a pre-processed image; positioning an edge of the pre-processed image based on morphology to obtain an outer ring contour of a printing area; calculating a convex hull of the outer ring contour of the printing area, determining a plurality of convex defects of the printing area of the contact lens image based on the outer ring contour of the printing area and the convex hull; determining the morphology of the outer ring contour of the printing area based on the plurality of convex defects; constructing a circle representing the outer ring contour of the printing area based on the plurality of convex defects, and extracting stains of the printing area of the contact lens image based on a pre-constructed mask and the circle. The application can automatically identify the image, and can quickly and efficiently complete comprehensive detection of the contact lens, so that the purposes of reducing cost, improving production efficiency and improving production yield are achieved.

[0093] As Figure 8 shown, the application also provides a high-precision printing area stain detection system for contact lenses based on convex defects, and the system comprises:

[0094] a pre-processing module, which is used for acquiring a contact lens image, and pre-processing the contact lens image to obtain a pre-processed image;

[0095] a printing area edge positioning module, which is used for positioning an edge of the pre-processed image based on morphology to obtain an outer ring contour of a printing area;

[0096] an outer ring morphology judging module, which is used for calculating a convex hull of the outer ring contour of the printing area, determining a plurality of convex defects of the printing area of the contact lens image based on the outer ring contour of the printing area and the convex hull, and determining the morphology of the outer ring contour of the printing area based on the plurality of convex defects;

[0097] an outer ring stain detection module, which is used for constructing a circle representing the outer ring contour of the printing area based on the plurality of convex defects, and extracting stains of the printing area of the contact lens image based on a pre-constructed mask and the circle.

[0098] The application provides a high-precision printing area stain detection method for contact lenses based on convex defects, and the method comprises the following steps: acquiring a contact lens image, and pre-processing the contact lens image to obtain a pre-processed image; positioning an edge of the pre-processed image based on morphology to obtain an outer ring contour of a printing area; calculating a convex hull of the outer ring contour of the printing area, determining a plurality of convex defects of the printing area of the contact lens image based on the outer ring contour of the printing area and the convex hull; determining the morphology of the outer ring contour of the printing area based on the plurality of convex defects; constructing a circle representing the outer ring contour of the printing area based on the plurality of convex defects, and extracting stains of the printing area of the contact lens image based on a pre-constructed mask and the circle. The application can automatically identify the image, and can quickly and efficiently complete comprehensive detection of the contact lens, so that the purposes of reducing cost, improving production efficiency and improving production yield are achieved.

[0099] The embodiment also provides an electronic terminal, comprising a processor and a memory.

[0100] The memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory, so that the terminal executes any method in the embodiment.

[0101] Those skilled in the art can understand that all or part of the steps of the methods in the embodiments can be completed by a computer program related hardware. The foregoing computer program can be stored in a computer readable storage medium. When the program is executed, the steps of the methods in the embodiments are executed; and the foregoing storage medium includes ROM, RAM, magnetic disk or optical disk and other various storage media that can store program codes.

[0102] The electronic terminal provided in the embodiment comprises a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected with the processor and the transceiver and complete communication between each other. The memory is configured to store a computer program, the communication interface is configured to communicate, and the processor and the transceiver are configured to run the computer program, so that the electronic terminal executes each step of the method.

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

[0104] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP) and the like; and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0105] While the application has been described in terms of particular embodiments implementing the application, it is to be understood that numerous alternatives, modifications, and variations can be possible in light of the foregoing description without departing from the scope of the application as set forth in the following claims.

[0106] The above-described embodiments are merely illustrative for the principles of the application and the efficacy thereof, and are not intended to limit the application. Any modification or change made by any person skilled in the art without departing from the spirit and scope of the application shall be covered by the claims of the application.

Claims

1. A high-precision method for detecting a contact lens printing area stain based on a convex defect, characterized in that, The method comprises the steps of: obtaining a contact lens image and pre-processing the contact lens image to obtain a pre-processed image; performing morphological edge positioning on the pre-processed image to obtain a printing area outer circle contour; calculating a convex hull of the printing area outer circle contour, determining a plurality of convex defects of a printing area of the contact lens image based on the printing area outer circle contour and the convex hull; and determining the morphology of the printing area outer circle contour based on the plurality of convex defects; determining the morphology of the printing area outer circle contour based on the plurality of convex defects comprises: extracting the end point and the farthest point of each convex defect to obtain a convex defect point set, wherein the farthest point is the point in each convex defect that is located on the printing area outer circle contour and is farthest from the convex hull; performing ellipse fitting on all convex defect points of the convex defect point set to obtain a fitting circle and a center of the fitting circle; calculating the distance between all convex defect points of the convex defect point set and the center of the fitting circle, calculating the sum of all distances, and determining that the morphology of the printing area outer circle contour is circular when the sum of all distances is less than a preset first distance threshold, otherwise, determining that the morphology of the printing area outer circle contour is not circular; constructing a circle representing the printing area outer circle contour based on the plurality of convex defects, and extracting a smudge of the printing area of the contact lens image based on a pre-constructed mask and the circle.

2. The high-precision detection method for contact lens printing area stains based on convex defects according to claim 1, characterized in that, The pre-processing of the contact lens image to obtain a pre-processed image comprises: loading the contact lens image; performing color space conversion on the loaded contact lens image to obtain a pre-processed image in a target color space.

3. The high-precision detection method for contact lens printing area stains based on convex defects according to claim 1, characterized in that, The morphological edge positioning on the pre-processed image to obtain a printing area outer circle contour comprises: performing Gaussian filtering on the pre-processed image to obtain a filtered image; performing grayscale conversion on the filtered image to obtain a grayscale image; performing adaptive binarization on the grayscale image to obtain a binary image; performing morphological processing on the binary image to obtain an intermediate image, wherein the intermediate image includes all contour features of the printing area; screening the area of each contour feature in the intermediate image based on a pre-constructed area screening range to obtain a target contour that meets the area screening range, wherein the target contour is the printing area outer circle contour.

4. The high precision detection method for contact lens printing area stain based on convex defects according to claim 1, characterized in that, The determination of a plurality of convex defects of a printing area of a contact lens image based on the printing area outer circle contour and the convex hull comprises: performing difference calculation on the printing area outer circle contour and the convex hull to obtain convex defects.

5. The high precision detection method for contact lens printing area stain based on convex defects according to claim 1, characterized in that, The construction of a circle representing the printing area outer circle contour based on the plurality of convex defects comprises: calculating the distance between all convex defect points of the convex defect point set and the center of the fitting circle, and removing convex defect points with a distance greater than a preset second distance threshold to obtain a screened convex defect point set; performing fitting on all convex defect points in the screened convex defect point set to obtain a circle representing the printing area outer circle contour.

6. The high precision detection method for contact lens printing area stain based on convex defects according to claim 3, characterized in that, The extraction of a smudge of the printing area of the contact lens image based on a pre-constructed mask and the circle comprises: constructing a mask based on the circle, and performing a bitwise AND operation on the mask and the binary image to obtain a candidate smudge contour; Calculate the area of all candidate stain contours, and screen all candidate stain contours based on a preset minimum detection area to take the candidate stain contour with an area greater than the minimum detection area as a stain contour; Draw the stain contour in the contact lens image to obtain a stain of a printing area of the contact lens image.

7. A high precision system for detecting smudge on a contact lens printing area based on convex defects, characterized in that, Comprise: A preprocessing module configured to acquire a contact lens image and pre-process the contact lens image to obtain a pre-processed image; A printing area edge positioning module configured to position a morphological edge of the pre-processed image to obtain an outer ring contour of a printing area; An outer ring shape judging module configured to calculate a convex hull of the outer ring contour of the printing area, determine a plurality of convex defects of a printing area of a contact lens image based on the outer ring contour of the printing area and the convex hull, and determine a shape of the outer ring contour of the printing area based on the plurality of convex defects; Determine the shape of the outer ring contour of the printing area based on the plurality of convex defects, comprising: extracting an end point and a farthest point of each convex defect to obtain a convex defect point set, wherein the farthest point is a point in each convex defect that is located on the outer ring contour of the printing area and is farthest from the convex hull; performing elliptical fitting on all convex defect points of the convex defect point set to obtain a fitting circle and a center of the fitting circle; calculating distances between all convex defect points of the convex defect point set and the center of the fitting circle, calculating a total sum of all distances, and determining that the shape of the outer ring contour of the printing area is circular when the total sum of all distances is less than a preset first distance threshold, otherwise, determining that the shape of the outer ring contour of the printing area is not circular; An outer ring stain detection module configured to construct a circle representing the outer ring contour of the printing area based on the plurality of convex defects, and extract a stain of a printing area of the contact lens image based on a pre-constructed mask and the circle. A processor and a memory; 8. An electronic device comprising: The memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory to enable the electronic device to perform the method of any one of claims 1-6. The computer program is executed by the processor to implement the method of any one of claims 1-6.

9. A computer readable storage medium having stored thereon a computer program, characterized in that: The computer program is executed by the processor to implement the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Method and system for detecting flaws of printed contact lenses based on cloud-machine vision

    CN118505634A