Contact lens color mold outer ring ink shortage detection method and device

By using image processing technology to extract the outer circle contour of the contact lens printing area and adopting polar coordinate analysis, the false detection and inefficiency problems of traditional detection methods are solved, high-precision automatic identification of ink shortage is achieved, and the production efficiency and yield of contact lenses are improved.

CN119579520BActive Publication Date: 2025-10-17SIGMA SQUARES (BEIJING) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411624629.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-10-17
Estimated Expiration
2044-11-14

AI Technical Summary

Technical Problem

Traditional contact lens printing quality inspection relies on manual inspection, which is prone to errors and inefficient. Computer inspection methods based on template comparison are prone to misdetection of products with large deviations and have difficulty in accurately identifying ink shortage defects in the outer circle of the printing area.

Method used

An image processing method is used to obtain multiple original contact lens images, perform preprocessing and fusion, extract the rough and fine outer circle contours, and perform difference analysis in the polar coordinate system after circular fitting to detect the ink-deficient area.

Benefits of technology

It achieves high-precision ink shortage detection and automatically identifies ink shortage on the outer ring, which improves detection accuracy and efficiency, reduces manual inspection costs, and improves product yield.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579520B_ABST
    Figure CN119579520B_ABST
Patent Text Reader

Abstract

The present application relates to the field of machine vision, and specifically to a contact lens color mold outer circle ink deficiency detection method and device, which pre-processes and fuses a plurality of contact lens original images to obtain a fused image; performs fine outer circle contour extraction on the printing area of the fused image to obtain a fine outer circle contour; performs circular fitting on the fine outer circle contour to obtain a fine outer circle; and performs difference calculation on the fine outer circle contour and the fine outer circle to obtain a difference binary image; performs polar coordinate expansion on the difference binary image based on the circular shape of the fine outer circle to obtain a polar coordinate binary image; and performs ink deficiency detection on the polar coordinate binary image to obtain an ink deficiency detection result. By extracting a high-precision printing area outer circle boundary to obtain an accurate boundary range, and then analyzing the printing area contour in a polar coordinate system to detect the outer circle ink deficiency area, automatic recognition of the outer circle ink deficiency detection is achieved, which can improve recognition accuracy, reduce false positives, save costs, and improve 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 machine vision, and in particular to a contact lens color module outer ring ink shortage detection method and device. BACKGROUND

[0002] The pattern printing method of contact lenses is mainly pad printing. Due to the influence of the concentration of printing ink itself, environmental temperature and humidity, etc., ink shortage defects are prone to occur during the printing process. Ink shortage can occur in any area of the printing area. Among them, the ink concentration is lower at the outer edge of the printing area, and the color is the most prone to ink shortage during the printing process.

[0003] The traditional printing quality detection method relies on manual detection. This detection method has the following disadvantages: long-time manual detection leads to eye fatigue, and is prone to false judgment, and the detection efficiency is low; the ink shortage detection method based on computer image processing needs to establish a template for qualified products first, and then detect the ink shortage defects by comparing with the template. However, this method is prone to false detection for products with large deviations. SUMMARY

[0004] Therefore, the purpose of the present application is to provide a contact lens color module outer ring ink shortage detection method and device to solve the problems in the background art.

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

[0006] The contact lens color module outer ring ink shortage detection method of the present application comprises the following steps:

[0007] Obtaining a plurality of contact lens original images;

[0008] Pretreating and fusing the plurality of contact lens original images to obtain a fused image;

[0009] Roughly extracting the outer circle contour of the printing area of the fused image to obtain a rough outer circle contour; and based on the rough outer circle contour and the fused image, finely extracting the outer circle contour of the printing area to obtain a fine outer circle contour;

[0010] Fitting a circle to the fine outer circle contour to obtain a fine outer circle; and subtracting the fine outer circle contour from the fine outer circle to obtain a difference binary image for representing the ink shortage suspected area; based on the circular shape of the fine outer circle, performing polar coordinate expansion on the difference binary image to obtain a polar coordinate binary image; and performing multi-row ink shortage detection and single-row ink shortage detection on the polar coordinate binary image to obtain an ink shortage detection result.

[0011] In an embodiment of the present application, the pretreatment and fusion of the plurality of contact lens original images to obtain a fused image comprises:

[0012] convert the plurality of contact lens original images into target format images;

[0013] perform binarization and median filtering on the plurality of target format images to obtain a binary image containing mold boundaries;

[0014] extract contours in the binary image, and screen the contours based on a preset area screening value to obtain mold contours conforming to the area screening value;

[0015] fit the centroids of the plurality of mold contours, and align the plurality of contact lens original images based on the centroids of the plurality of mold contours; and perform an averaging operation on the aligned plurality of contact lens original images to obtain a fusion image.

[0016] In an embodiment of the present application, a rough outer ring contour is extracted from a printing area of a fusion image to obtain a rough outer ring contour, including:

[0017] a mask image containing only the printing area and the optical area in the fusion image is extracted based on a preset printing area outer circle mask;

[0018] the mask image is subjected to Gaussian filtering to obtain a filtered image;

[0019] the filtered image is subjected to channel splitting to obtain a plurality of single-color channel images; the plurality of single-color channel images are respectively subjected to adaptive binarization to obtain a plurality of binarized images; and the plurality of binarized images are merged to obtain a merged image;

[0020] the merged image is subjected to a first closing operation to fill gaps between color points to obtain a first closing operation binarized image;

[0021] the first closing operation binarized image is subjected to an opening operation to filter out peripheral noise of the printing area to obtain an opening operation binarized image;

[0022] area-based contour filtering is performed in the opening operation binarized image to obtain a rough outer ring contour.

[0023] In an embodiment of the present application, a fine outer ring contour is extracted from a printing area based on the rough outer ring contour and the fusion image to obtain a fine outer ring contour, including:

[0024] an ellipse is fitted to the rough outer ring contour based on a least square method to obtain a fitted ellipse;

[0025] a target region is obtained by masking the fusion image based on the fitted ellipse;

[0026] the target region is subjected to adaptive binarization again to obtain a target binarized image;

[0027] performing a second closing operation on the target binary image to obtain a second closing operation binary image, wherein a size of a kernel of the second closing operation is smaller than a size of a kernel of the first closing operation;

[0028] performing area-based contour filtering in the second closing operation binary image to obtain a fine outer circle contour.

[0029] In an embodiment of the present application, the fine outer circle is obtained by a RANSAC fitting method.

[0030] In an embodiment of the present application, the polar coordinate binary image is subjected to multi-row ink deficiency detection, comprising:

[0031] comparing the radial width of the contour with a preset threshold value, and determining the contour with a radial width greater than the threshold value as an ink deficiency region.

[0032] In an embodiment of the present application, the polar coordinate binary image is subjected to single-row ink deficiency detection, comprising:

[0033] comparing the radial width of the contour with a preset threshold value, and comparing the tangential width of the contour with a specific width value; determining the contour with a radial width greater than the threshold value and a tangential width less than or equal to the specific width value as an ink deficiency region.

[0034] In an embodiment of the present application, further comprising:

[0035] performing visual output on the ink deficiency detection result.

[0036] In an embodiment of the present application, performing visual output on the ink deficiency region comprises:

[0037] binarizing the ink deficiency region to obtain an outer circle ink deficiency region in polar coordinates; and converting the binary ink deficiency region in polar coordinates to image coordinates to obtain an outer circle ink deficiency region in image coordinates;

[0038] generating a minimum circumscribed rectangle for each outer circle ink deficiency region in image coordinates;

[0039] transforming the minimum circumscribed rectangle into coordinates of the plurality of contact lens original images;

[0040] drawing the minimum circumscribed rectangle in the coordinates of the plurality of contact lens original images.

[0041] The present application also provides a contact lens color model outer circle ink deficiency detection device, comprising:

[0042] an acquisition module configured to acquire a plurality of contact lens original images;

[0043] A pre-processing module is configured to pre-process and fuse the plurality of contact lens original images to obtain a fused image;

[0044] A contour extraction module is configured to perform coarse outer ring contour extraction on the printing area of the fused image to obtain a coarse outer ring contour, and perform fine outer ring contour extraction on the printing area based on the coarse outer ring contour and the fused image to obtain a fine outer ring contour.

[0045] An ink deficiency detection module is configured to perform circular fitting on the fine outer ring contour to obtain a fine outer circle, perform difference calculation on the fine outer ring contour and the fine outer circle to obtain a difference binary image for representing a suspected ink deficiency area, perform polar coordinate expansion on the difference binary image based on the circular shape of the fine outer circle to obtain a polar coordinate binary image, and perform multi-row ink deficiency detection and single-row ink deficiency detection on the polar coordinate binary image to obtain an ink deficiency detection result.

[0046] The application also provides a contact lens color mold outer ring ink deficiency detection device, comprising:

[0047] An acquisition module is configured to acquire an original image of a net frame area of a perfusion device, wherein one end of the perfusion device is fixed on a rotating clamp, the other end of the perfusion device is provided with a light source, and the original image is an image obtained by imaging a module from the side of the perfusion device;

[0048] A positioning module is configured to position the net frame of the original image to obtain a to-be-detected area image;

[0049] A defect extraction module is configured to perform spatial defect detection on the to-be-detected area image to obtain a first defect area, and perform frequency domain defect detection on the to-be-detected area image to obtain a second defect area;

[0050] A detection module is configured to combine the first defect area and the second defect area to obtain a candidate defect area, and perform perfusion device net frame defect grading output based on the candidate defect area.

[0051] The application has the following advantages: the contact lens color mold outer ring ink deficiency detection method and device can extract a high-precision printing area outer ring boundary to obtain an accurate boundary range, analyze the printing area contour in a polar coordinate system, detect the outer ring ink deficiency area, realize automatic identification of the outer ring ink deficiency detection, and improve the identification accuracy. The application can be widely applied to a contact lens automatic detection system, reduce the labor cost of detection, improve the production efficiency, and thus improve the yield of the final product. BRIEF DESCRIPTION OF DRAWINGS

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

[0053] Figure 1A contact lens image schematic diagram in the present application;

[0054] Figure 2 A flow chart of a contact lens color module outer ring ink deficiency detection method in an embodiment of the present application;

[0055] Figure 3 A pre-processing flow chart in the present application;

[0056] Figure 4 A printing area outer ring extraction flow chart in the present application;

[0057] Figure 5 A rough outer ring contour extraction flow chart in the present application;

[0058] Figure 6 A fine outer ring contour extraction flow chart in the present application;

[0059] Figure 7 A general flow chart of the outer ring ink deficiency detection in the present application;

[0060] Figure 8 A result output flow chart in the present application. DETAILED DESCRIPTION

[0061] The present application will be described in detail below with specific reference being made to certain embodiments. The advantages and effects of the present application can be easily understood by those skilled in the art from the disclosure of the present application. The present application can also be implemented or applied in other different embodiments, and the details in the present specification can be modified or changed based on different views and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0062] It should be noted that the diagrams provided in the following embodiments only schematically illustrate the basic concept of the present application, and only the layers related to the present application are shown in the diagrams, not the number of layers, shapes and sizes when actually implemented. The actual implementation of each layer can be a random change, and the layer layout pattern can also be more complex.

[0063] 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 those skilled in the art that the embodiments of the present application can be implemented without these specific details.

[0064] Figure 1 A contact lens image schematic diagram in the present application, such as Figure 1As shown in the figure, the green area is the printing area, that is, the ink defect detection area, the white area between the optical area and the outer edge of the printing area and the mold edge is not printed with ink and is not detected, and the gray area is the detection equipment base.

[0065] Figure 2 is a flowchart of an ink defect detection method for a colored mold outer ring of a contact lens in an embodiment of the present application, as shown in the figure. Figure 1 As shown in the figure, the ink defect detection method for a colored mold outer ring of a contact lens in the embodiment can include the following steps:

[0066] A, pretreatment

[0067] is responsible for loading the configuration file required by the algorithm and reading, aligning, fusing, and region positioning the contact lens images collected by the camera, and finally obtaining the fused contact lens image.

[0068] Figure 3 is a pretreatment flowchart in the present application. Pretreatment is used to pretreat and fuse the plurality of contact lens original images to obtain a fused image, as shown in the figure. Figure 3 The process of pretreatment includes the following steps:

[0069] A11, obtain a plurality of contact lens original images; convert the plurality of contact lens original images into target format images;

[0070] Specifically, five original images are read, and the images are converted from Bayer format to BGR format; at the same time, the configuration file is loaded, including mold size information, printing area information, algorithm configuration parameters, etc.

[0071] A12, binarize and median filter the plurality of target format images to obtain a binary image containing mold boundaries; extract the contour in the binary image, filter the contour based on a preset area filtering value, and obtain a mold contour that meets the area filtering value; fit the centroids of the plurality of mold contours, and align the plurality of contact lens original images based on the centroids of the plurality of mold contours;

[0072] Specifically, for the five images read, binarization and median filtering operations are performed respectively to obtain a binary image containing mold boundaries, the contour of the binary image is extracted, and the contour is filtered according to the area to obtain a mold contour. The centroid is fitted according to the mold contour as the mold center, and finally the centers of the five images are moved to the same position to realize image alignment.

[0073] A13, average the aligned plurality of contact lens original images to obtain a fused image. The contrast of the fused image is better and the color is richer.

[0074] B, printing area outer ring extraction

[0075] Figure 4 The flow chart for the outer circle extraction of the printing area in the present application is shown in FIG. 1, and the flow chart for the rough outer circle extraction of the printing area in the present application is shown in FIG. 2. Figure 4 As shown in the figures, in the present application, generally, the rough outer circle profile of the printing area is extracted first, and then the fine outer circle profile of the printing area is extracted based on the rough outer circle profile and the fused image, to obtain the fine outer circle profile.

[0076] Figure 5 The flow chart for the rough outer circle profile extraction in the present application is shown in FIG. 2. Figure 5 The flow chart for the rough outer circle profile extraction in the present application is shown in FIG. 2.

[0077] B11, a mask image containing only the printing area and the optical area in the fused image is extracted based on a preset printing area outer circle mask; the input of this step is the fused image of the printing area, and the image containing only the printing area and the optical area is obtained by using the printing area outer circle mask.

[0078] B12, the mask image is subjected to Gaussian filtering processing to obtain a filtered image; this step is mainly to filter high-frequency noise.

[0079] B13, the filtered image is subjected to channel splitting to obtain a plurality of single-color channel images; the plurality of single-color channel images are subjected to adaptive binarization processing respectively to obtain a plurality of binarization images; and the plurality of binarization images are combined to obtain a combined image; this step is mainly to extract all dark color regions on the white mold, wherein the dark color regions include ink color points and stains.

[0080] B14, the combined image is subjected to first closed operation to fill the gaps between the color points, to obtain a first closed operation binarization image; the closed operation is mainly to fill the gaps between the color points, so that the color points are connected together to obtain a whole printing area, and in this process, the stains around the printing area may also be connected together.

[0081] B15, the first closed operation binarization image is subjected to open operation to filter out the noise around the printing area, to obtain an open operation binarization image; the open operation can filter out the noise around the printing area, so that a region containing the complete printing area and not containing stains is obtained.

[0082] B16, area-based profile filtering is performed in the open operation binarization image to obtain a rough outer circle profile. Such a printing area profile is not close enough to the color points, and the main reason is that in order to fully fill the printing area color points, the size of the closed operation kernel needs to be large; moreover, the area with ink missing inwardly from the edge is also filled by the closed operation, and finally the rough outer circle edge is obtained.

[0083] Figure 6The fine outer ring contour extraction flowchart in the present application is shown in Figure 6 The fine outer ring contour extraction flowchart includes the following steps:

[0084] B21, performing ellipse fitting on the coarse outer ring contour based on the least square method to obtain a fitted ellipse;

[0085] B22, performing mask on the fusion image based on the fitted ellipse to obtain a target region; in this way, impurities and stains outside the printing area can be filtered out;

[0086] B23, performing adaptive binarization on the target region again to obtain a target binary image; this time, the adaptive binarization extracts a locally deep region, so that the binarization contour is closer to the color point;

[0087] B24, performing a second closing operation on the target binary image to obtain a second closing operation binary image, wherein the size of the kernel of the second closing operation is smaller than the size of the kernel of the first closing operation; the closing operation is performed on the binary image to fill the color point holes, and the size of the morphological kernel of the closing operation here is smaller than the size of the kernel used in the rough extraction, because a too large kernel will cause the edge missing ink of the printing area to be still filled by the closing operation, so that a binary image region closer to the color point boundary is obtained;

[0088] B25, performing area-based contour filtering in the second closing operation binary image to obtain a fine outer ring contour.

[0089] C, outer ring missing ink detection

[0090] Figure 7 The overall flowchart of the outer ring missing ink detection in the present application is shown in Figure 7 The outer ring missing ink detection in the present application generally includes the following steps:

[0091] C1, inputting an image, the input being a fine outer ring contour, the fine outer ring contour being able to include the color points around the printing area, and the area with edge missing ink being excluded from the contour;

[0092] C2, performing circular fitting on the fine outer ring contour to obtain a fine outer circle; in the present application, the RANSAC (Random Sample Consensus) fitting method is used to perform circular fitting on the fine outer ring contour, and the RANSAC fitting circle algorithm pseudo code is as follows:

[0093] Input:

[0094] points: a two-dimensional point set, each point being represented as (x, y)

[0095] max_iterations: maximum number of iterations

[0096] distance_threshold: distance threshold to determine if a point is on the circle

[0097] min_inliers: minimum number of inliers required for a successful fit

[0098] Output:

[0099] best_circle: parameters of the best-fitted circle (center (cx, cy) and radius r)

[0100] best_inliers_count: number of inliers for the best-fitted circle

[0101] Algorithm flow:

[0102] 1. Initialize best_circle to None and best_inliers_count to 0

[0103] 2. For i from 1 to max_iterations:

[0104] a. Randomly select 3 non-duplicate points from points, denoted as sample_points

[0105] b. Calculate the parameters of the circle (center (cx, cy) and radius r) using sample_points:

[0106] i. Calculate the geometric center of sample_points as the initial center estimate (optional step for faster convergence)

[0107] ii. Calculate the exact center and radius using linear algebra or geometric methods (e.g., by solving a system of linear equations)

[0108] c. Initialize inliers_count to 0

[0109] d. For each point point in points:

[0110] i. Calculate the distance dist of point to the center (cx, cy)

[0111] ii. If abs(dist - r) <= distance_threshold, increment inliers_count by 1

[0112] e. If inliers_count >= min_inliers and inliers_count > best_inliers_count:

[0113] i. update best_circle to the currently computed circle parameters

[0114] ii. update best_inliers_count to inliers_count

[0115] 3. return best_circle and best_inliers_count

[0116] Compared with other fitting methods, the circle fitted by using the RANSAC method can accurately describe the color point boundary;

[0117] C3, and the fine outer circle profile and the fine outer circle are subtracted to obtain a difference binary graph for characterizing an ink shortage suspected area; the difference binary graph is an area where ink shortage is likely to occur;

[0118] C4, based on the circular shape of the fine outer circle, the difference binary graph is developed in polar coordinates to obtain a polar coordinate binary graph; in this way, the candidate area is changed from the original arrangement along the center to the arrangement by column (tangential direction), and at this time, the profile of the binary graph in the polar coordinate system is found, and the profile of each candidate ink shortage is obtained;

[0119] C5, the polar coordinate binary graph is subjected to multi-row ink shortage detection and single-row ink shortage detection to obtain an ink shortage detection result.

[0120] C51, the polar coordinate binary graph is subjected to multi-row ink shortage detection, comprising:

[0121] The radial width of the profile is compared with a preset threshold value, and the profile with a radial width greater than the threshold value is determined as an ink shortage area.

[0122] The multi-row ink shortage profile has the characteristic of being large in radial width in the polar coordinate system, and therefore a threshold value can be set to specially detect the area with a certain width along the radial direction, and the profile with a radial width greater than the threshold value is determined as an ink shortage area.

[0123] C52, the polar coordinate binary graph is subjected to single-row ink shortage detection, comprising:

[0124] The radial width of the profile is compared with a preset threshold value, and the tangential width of the profile is compared with a specific width value; the profile with a radial width greater than the threshold value and a tangential width less than or equal to the specific width value is determined as an ink shortage area.

[0125] The feature of the single-row ink missing contour in the polar coordinate system is that the radial width is small, only the width of a row of color points, and when the accurate circle and the accurate outer contour have slight offset due to alignment problems, a row of color point width contour will also appear, so the width of the contour along the tangent direction also needs to be set to avoid false detection. The radial width is less than or equal to 1 row of color point width, and the contour with a tangent width greater than a threshold value is determined as ink missing.

[0126] D, visualizing output of the ink missing detection result.

[0127] Figure 8 For the result output flowchart in the application, as shown in Figure 8 The mask image containing the defect target frame in C is subjected to minimum circumscribed rectangle frame extraction, coordinate transformation and other operations, and finally the final detection result is displayed on the image. Specifically, it includes:

[0128] D1, binarizing the ink missing area to obtain an outer circle ink missing area in polar coordinates; and converting the binarized ink missing area in polar coordinates to image coordinates to obtain an outer circle ink missing area in image coordinates;

[0129] D2, generating a minimum circumscribed rectangle for each outer circle ink missing area in image coordinates;

[0130] D3, transforming the minimum circumscribed rectangle into the coordinates of the plurality of contact lens original images;

[0131] D4, drawing the minimum circumscribed rectangle in the coordinates of the plurality of contact lens original images, thereby realizing visual output.

[0132] The contact lens color module outer circle ink missing detection method of the application can improve the recognition accuracy by extracting the high-precision printing area outer circle boundary, obtaining the accurate boundary range, analyzing the printing area contour in the polar coordinate system, and detecting the outer circle ink missing area to realize automatic recognition of the outer circle ink missing detection. The application can be widely applied to the contact lens automatic detection system to reduce the labor detection cost, improve the production efficiency, and thus improve the final product yield.

[0133] The application also provides a contact lens color module outer circle ink missing detection device, comprising:

[0134] An acquisition module is configured to acquire a plurality of contact lens original images;

[0135] A preprocessing module is configured to preprocess and fuse the plurality of contact lens original images to obtain a fused image;

[0136] The contour extraction module is configured to perform coarse outer circle contour extraction on the printing area of the fused image to obtain a coarse outer circle contour, and perform fine outer circle contour extraction on the printing area based on the coarse outer circle contour and the fused image to obtain a fine outer circle contour.

[0137] The ink shortage detection module is configured to perform circular fitting on the fine outer circle contour to obtain a fine outer circle, perform difference calculation on the fine outer circle contour and the fine outer circle to obtain a difference binary image for representing an ink shortage suspected area, perform polar coordinate expansion on the difference binary image based on the circular shape of the fine outer circle to obtain a polar coordinate binary image, and perform multi-row ink shortage detection and single-row ink shortage detection on the polar coordinate binary image to obtain an ink shortage detection result.

[0138] The contact lens color module outer circle ink shortage detection device provided in the present application can extract a high-precision printing area outer circle boundary to obtain an accurate boundary range, analyze the printing area contour in a polar coordinate system, detect the outer circle ink shortage area, realize automatic recognition of the outer circle ink shortage detection, and improve the recognition accuracy. The present application can be widely applied to an automatic contact lens detection system, reduces the labor cost of manual detection, improves the production efficiency, and further improves the yield of the final product.

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

[0140] 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 any of the methods in the present embodiment.

[0141] The computer readable storage medium in the present embodiment can be understood by those skilled in the art that all or part of the steps of the above-mentioned method 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 above-mentioned method embodiments are executed; and the foregoing storage medium includes ROM, RAM, magnetic disk or optical disk and various storage program codes.

[0142] The electronic terminal provided in the present 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 with 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 to enable the electronic terminal to execute the steps of the above method.

[0143] In the present 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.

[0144] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; 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.

[0145] In the above embodiments, although the present application has been described in conjunction with specific embodiments thereof, numerous alternatives, modifications and variations will be readily apparent to those of ordinary skill in the art in the light of the foregoing descriptions. The embodiments of the present application are intended to embrace all such alternatives, modifications and variations as falling within the scope of the appended claims.

[0146] The above embodiments only illustrate the principles and effects of the present application, but are not used to limit the present application. Any person skilled in the art can modify or change the above embodiments without departing from the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by those skilled in the art without departing from the spirit and technical ideas of the present application should be covered by the claims of the present application.

Claims

1. A method for detecting ink shortage in the outer ring of a contact lens color mold, characterized in that: Including steps: Acquire multiple contact lens original images; Preprocessing and fusing the multiple contact lens original images to obtain a fused image; A rough outer circle contour extraction is performed on the printing area of ​​the fused image to obtain a rough outer circle contour; and a fine outer circle contour extraction is performed on the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour; a rough outer circle contour extraction is performed on the printing area of ​​the fused image to obtain a rough outer circle contour, including: extracting a mask image containing only the printing area and the optical area in the fused image based on a preset printing area outer circle mask; performing Gaussian filtering on the mask image to obtain a filtered image; performing channel splitting on the filtered image to obtain multiple single-color channel images; and performing adaptive binarization processing on the multiple single-color channel images to obtain multiple binary images; merging the multiple binary images to obtain a merged image; performing a first closing operation on the merged image to fill the gaps between color points to obtain a first closed operation binary image; performing an opening operation on the first closed operation binary image to filter out noise points around the printing area to obtain an open operation binary image; Performing area-based contour filtering within the open binary image to obtain a rough outer circle contour; performing fine outer circle contour extraction on the printed area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour, including: performing ellipse fitting on the rough outer circle contour based on the least squares method to obtain a fitted ellipse; masking the fused image based on the fitted ellipse to obtain a target area; re-adaptively binarizing the target area to obtain a target binary image; performing a second closed operation on the target binary image to obtain a second closed binary image, wherein the size of the kernel of the second closed operation is smaller than the size of the kernel of the first closed operation; performing area-based contour filtering within the second closed binary image to obtain a fine outer circle contour; Perform circular fitting on the fine outer circle contour to obtain a fine outer circle; and calculate the difference between the fine outer circle contour and the fine outer circle to obtain a difference binary map for characterizing the suspected ink-deficient area; perform polar coordinate expansion on the difference binary map based on the circular shape of the fine outer circle to obtain a polar coordinate binary map; perform multi-row ink-deficient detection and single-row ink-deficient detection on the polar coordinate binary map to obtain an ink-deficient detection result.

2. The method for detecting ink shortage of the outer ring of a contact lens color mold according to claim 1, characterized in that: Preprocessing and fusing the multiple contact lens original images to obtain a fused image includes: converting the plurality of contact lens original images into target format images; Binarization and median filtering are performed on multiple target format images to obtain a binary image containing a mold boundary; Extracting contours from the binary image, screening the contours based on a preset area screening value, and obtaining a mold contour that meets the area screening value; The centroids of the multiple mold contours are fitted, and the multiple contact lens original images are aligned based on the centroids of the multiple mold contours; and an averaging operation is performed on the aligned multiple contact lens original images to obtain a fused image.

3. The method for detecting ink shortage of the outer ring of a contact lens color mold according to claim 1, characterized in that: The refined outer circle is obtained by the RANSAC fitting method.

4. The method for detecting ink shortage in the outer ring of a contact lens color mold according to claim 1, characterized in that: Performing a multi-line ink shortage detection on the polar coordinate binary image includes: The radial width of the contour is compared with a preset threshold, and the contour with a radial width greater than the threshold is determined to be an ink-deficient area.

5. The method for detecting ink shortage of the outer ring of a contact lens color mold according to claim 1, characterized in that: Performing single-line ink shortage detection on the polar coordinate binary image includes: The radial width of the contour is compared with a preset threshold, and the tangential width of the contour is compared with a specific width value; a contour whose radial width is greater than the threshold and whose tangential width is less than or equal to the specific width value is determined as an ink-deficient area.

6. The method for detecting ink shortage in the outer ring of a contact lens color mold according to claim 5, characterized in that: Also includes: The ink shortage detection result is output visually.

7. The method for detecting ink shortage in the outer ring of a contact lens color mold according to claim 6, characterized in that: Visually outputting the ink-deficient area includes: Binarizing the ink-deficient area to obtain an outer circle ink-deficient area in polar coordinates; and converting the binary ink-deficient area in polar coordinates to image coordinates to obtain an outer circle ink-deficient area in image coordinates; Generate the minimum circumscribed rectangle for the outer ink-deficient area under each image coordinate; transforming the minimum circumscribed rectangle into the coordinates of the plurality of contact lens original images; A minimum circumscribed rectangle is drawn in the coordinates of the plurality of contact lens original images.

8. A device for detecting ink shortage in the outer ring of a color mold for a contact lens, characterized in that: include: An acquisition module, used for acquiring a plurality of original images of contact lenses; A preprocessing module, configured to preprocess and fuse the plurality of original contact lens images to obtain a fused image; a contour extraction module, configured to perform a rough outer circle contour extraction on the printing area of ​​the fused image to obtain a rough outer circle contour; and perform a fine outer circle contour extraction on the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour; and perform a rough outer circle contour extraction on the printing area of ​​the fused image to obtain a rough outer circle contour, comprising: extracting a mask image containing only the printing area and the optical area in the fused image based on a preset outer circle mask of the printing area; performing Gaussian filtering on the mask image to obtain a filtered image; performing channel splitting on the filtered image to obtain a plurality of single-color channel images; and performing adaptive binarization processing on the plurality of single-color channel images to obtain a plurality of binary images; merging the plurality of binary images to obtain a merged image; performing a first closing operation on the merged image to fill the gaps between the color points to obtain a first closed binary image; and performing an opening operation on the first closed binary image to filter out noise points around the printing area to obtain an open binary image; Performing area-based contour filtering within the open binary image to obtain a rough outer circle contour; performing fine outer circle contour extraction on the printed area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour, including: performing ellipse fitting on the rough outer circle contour based on the least squares method to obtain a fitted ellipse; masking the fused image based on the fitted ellipse to obtain a target area; re-adaptively binarizing the target area to obtain a target binary image; performing a second closed operation on the target binary image to obtain a second closed binary image, wherein the size of the kernel of the second closed operation is smaller than the size of the kernel of the first closed operation; performing area-based contour filtering within the second closed binary image to obtain a fine outer circle contour; The ink deficiency detection module is used to perform circular fitting on the fine outer circle contour to obtain a fine outer circle; and to calculate the difference between the fine outer circle contour and the fine outer circle to obtain a difference binary image for characterizing the suspected ink deficiency area; based on the circular shape of the fine outer circle, the difference binary image is polar-coordinate expanded to obtain a polar coordinate binary image; and the polar coordinate binary image is subjected to multi-row ink deficiency detection and single-row ink deficiency detection to obtain an ink deficiency detection result.

Citation Information

Patent Citations

  • Contact lens casting mold printing defect detection method and system

    CN117849072A

  • Visual inspection method and apparatus for contact lenses

    US6134342A