Contact lens color mold outer ring ink shortage detection method and device
By combining image preprocessing and polar coordinate analysis with the RANSAC fitting method, the problem of automated identification of ink deficiency on the outer ring of contact lens molds was solved, improving detection accuracy and production efficiency.
Patent Information
- Application Number
- CN202411624629.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-14
AI Technical Summary
Traditional methods for detecting ink deficiency on the outer ring of contact lens molds rely on manual inspection, which is inefficient and prone to errors. Existing computer image processing methods are also prone to false detection for products with large deviations.
Image preprocessing and fusion are used to extract the rough and fine outer contours of the printed area, and circular fitting and polar coordinate analysis are performed. The RANSAC fitting method is then used to detect ink-deficient areas.
It achieves high-precision ink shortage detection, automatically identifies ink shortage on the outer ring, improves detection accuracy and production efficiency, and reduces manual inspection costs.
Smart Images

Figure CN119579520A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of machine vision, and in particular to a method and a device for detecting ink shortage in the outer ring of a contact lens color mold. Background Art
[0002] The main method of printing patterns on contact lenses is pad printing. Since the printing ink is easily affected by the concentration of the ink itself, the ambient temperature and humidity, etc., it is easy for ink defects to occur during the printing process. Ink deficiency can occur in any area of the printing area. Among them, the ink concentration at the outer edge of the printing area is lower. During the printing process, the color becomes lighter first, and it is the position most likely to suffer from ink deficiency.
[0003] Traditional printing quality inspection methods rely on manual inspection, which has the following shortcomings: long-term manual inspection leads to eye fatigue, prone to misjudgment, and low inspection efficiency; the ink shortage detection method based on computer image processing requires the establishment of a template for qualified products first, and then detects ink shortage defects by comparing with the template. However, this method is prone to misdetection of products with large deviations. Summary of the invention
[0004] In view of this, an object of the present invention is to provide a method and device for detecting ink shortage in the outer ring of a contact lens color mold, so as to solve the problems in the background technology.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for detecting ink shortage in the outer ring of a contact lens color mold of the present invention comprises the steps of:
[0007] Acquire multiple contact lens original images;
[0008] Preprocessing and fusing the multiple contact lens original images to obtain a fused image;
[0009] Extracting a rough outer circle contour of the printing area of the fused image to obtain a rough outer circle contour; and extracting a fine outer circle contour of the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour;
[0010] Perform circular fitting on the fine outer circle contour to obtain a fine outer circle; and perform difference calculation 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 circle 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.
[0011] In one embodiment of the present application, the plurality of original contact lens images are preprocessed and fused to obtain a fused image, including:
[0012] Converting the plurality of contact lens original images into target format images;
[0013] Binarization and median filtering are performed on multiple target format images to obtain a binary image containing a mold boundary;
[0014] Extracting the contour in the binary image, screening the contour based on a preset area screening value, and obtaining a mold contour that meets the area screening value;
[0015] 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 average operation is performed on the aligned multiple contact lens original images to obtain a fused image.
[0016] In one embodiment of the present application, a rough outer circle contour is extracted from the printing area of the fused image to obtain a rough outer circle contour, including:
[0017] 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;
[0018] Performing Gaussian filtering on the mask image to obtain a filtered image;
[0019] Perform channel splitting on the filtered image to obtain a plurality of single color channel images; and respectively perform adaptive binarization processing on the plurality of single color channel images to obtain a plurality of binarized images; and merge the plurality of binarized images to obtain a merged image;
[0020] Performing a first closing operation on the merged image to fill the gaps between the color points to obtain a first closed operation binary image;
[0021] 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;
[0022] Area-based contour filtering is performed in the opening binary image to obtain a rough outer circle contour.
[0023] In one embodiment of the present application, extracting a fine outer circle contour of the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour includes:
[0024] Performing ellipse fitting on the rough outer circle contour based on the least square method to obtain a fitting ellipse;
[0025] Masking the fused image based on the fitted ellipse to obtain a target area;
[0026] Re-adaptively binarizing the target area to obtain a target binary image;
[0027] Performing a second closing operation on the target binary image to obtain a second closed 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;
[0028] Area-based contour filtering is performed in the second closed operation binary image to obtain a fine outer circle contour.
[0029] In one embodiment of the present application, the fine outer circle is obtained by a RANSAC fitting method.
[0030] In one embodiment of the present application, performing a multi-line ink shortage detection on the polar coordinate binary image includes:
[0031] 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 as an ink-deficient area.
[0032] In one embodiment of the present application, performing single-line ink shortage detection on the polar coordinate binary image includes:
[0033] 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.
[0034] In one embodiment of the present application, it also includes:
[0035] The ink shortage detection result is output visually.
[0036] In one embodiment of the present application, visual output of the ink-deficient area includes:
[0037] Binarizing the ink-deficient area to obtain an outer circle ink-deficient area in polar coordinates; and converting the binary ink-deficient area in the coordinates to image coordinates to obtain an outer circle ink-deficient area in image coordinates;
[0038] Generate the minimum circumscribed rectangle for the outer circle ink-deficient area under each image coordinate;
[0039] Transforming the minimum circumscribed rectangle into the coordinates of the plurality of contact lens original images;
[0040] A minimum circumscribed rectangle is drawn in the coordinates of the plurality of contact lens original images.
[0041] The present application also provides a device for detecting ink shortage in the outer ring of a color mold for a contact lens, comprising:
[0042] An acquisition module, used for acquiring a plurality of original contact lens images;
[0043] A preprocessing module, used for preprocessing and fusing the plurality of original contact lens images to obtain a fused image;
[0044] A contour extraction module is used to extract a rough outer circle contour of the printing area of the fused image to obtain a rough outer circle contour; and to extract a fine outer circle contour of the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour;
[0045] 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; to perform polar coordinate expansion on the difference binary image based on the circle of the fine outer circle to obtain a polar coordinate binary image; and to 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 present application also provides a device for detecting ink shortage in the outer ring of a color mold for a contact lens, comprising:
[0047] An acquisition module is used to acquire an original image of the perfusion device grid area, wherein one end of the perfusion device is fixed on a rotating fixture, and a light source is provided at the other end of the perfusion device, and the original image is an image obtained by the imaging module shooting the perfusion device from the side;
[0048] A positioning module, used to position the grid of the original image to obtain an image of the area to be detected;
[0049] A defect extraction module is used to perform spatial domain defect detection on the image of the area to be detected to obtain a first defect area; and perform frequency domain defect detection on the image of the area to be detected to obtain a second defect area;
[0050] The detection module is used to merge the first defect area and the second defect area to obtain a candidate defect area, and output the defect classification of the perfusion device grid based on the candidate defect area.
[0051] The beneficial effects of the present invention are as follows: a method and device for detecting ink shortage in the outer ring of a color mold for a contact lens of the present invention extracts the outer ring boundary of a high-precision printing area to obtain an accurate boundary range, and then analyzes the contour of the printing area in a polar coordinate system, detects the ink shortage area of the outer ring, and realizes automatic recognition of ink shortage detection in the outer ring, which can improve recognition accuracy. The present application can be widely used in contact lens automated detection systems, reduce manual detection costs, improve production efficiency, and thereby improve the final product yield. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:
[0053] Figure 1This is a schematic diagram of the contact lens image in this application;
[0054] Figure 2 It is a flow chart of a method for detecting ink shortage in the outer ring of a contact lens color mold shown in one embodiment of the present application;
[0055] Figure 3 This is a schematic diagram of the pre-processing process in this application;
[0056] Figure 4 This is a flow chart for extracting the outer ring of the printing area in this application;
[0057] Figure 5 This is a flowchart for extracting the rough outer ring contour in this application;
[0058] Figure 6 This is the flow chart of fine outer ring contour extraction in this application;
[0059] Figure 7 This is the overall flow chart of the outer ring ink shortage detection in this application;
[0060] Figure 8 Output a flow chart for the results in this application. DETAILED DESCRIPTION
[0061] 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.
[0062] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus 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.
[0063] 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.
[0064] Figure 1 is a schematic diagram of the contact lens image in this application, such as Figure 1As shown in the figure, the green area is the printing area, that is, the ink deficiency defect detection area, the optical area and the white area between the outer edge of the printing area and the edge of the mold are not printed with ink and are not detected, and the gray area is the base of the detection equipment.
[0065] Figure 2 FIG. 1 is a flow chart of a method for detecting ink shortage in the outer ring of a contact lens color mold shown in an embodiment of the present application. Figure 1 As shown, a method for detecting ink shortage in the outer ring of a contact lens color mold of this embodiment may include the steps of:
[0066] A. Pretreatment
[0067] Responsible for loading the configuration files required by the algorithm and reading, aligning, fusing, and locating the contact lens images captured by the camera, and finally obtaining the fused contact lens image.
[0068] Figure 3 Schematic diagram of the preprocessing process in this application, the preprocessing is used to preprocess and fuse the multiple contact lens original images to obtain a fused image, such as Figure 3 As shown, the preprocessing process includes:
[0069] A11, acquiring a plurality of original contact lens images; converting the plurality of original contact lens images into target format images;
[0070] Specifically, five original images are read and converted from Bayer format to BGR format; at the same time, a configuration file is loaded, including mold size information, printing area information, algorithm configuration parameters, etc.
[0071] A12, performing binarization and median filtering on multiple target format images to obtain a binary image containing a mold boundary; extracting contours in the binary image, filtering the contours based on a preset area screening value, and obtaining a mold contour that meets the area screening value; fitting the centroids of multiple mold contours, and aligning the multiple contact lens original images based on the centroids of the multiple mold contours;
[0072] Specifically, the five images read were binarized and median filtered to obtain a binary image containing the mold boundary. The contour of the binary image was extracted and screened according to the area to obtain the mold contour. The centroid was fitted according to the mold contour as the mold center. Finally, the centers of the five images were translated to the same position to achieve image alignment.
[0073] A13. Perform an average operation on the aligned multiple original contact lens images to obtain a fused image. The fused image has better contrast and richer colors.
[0074] B. Extraction of the outer circle of the printing area
[0075] Figure 4 This is the flow chart for extracting the outer ring of the printing area in this application, such as Figure 4 As shown, in the present application, generally, a rough outer circle contour is firstly extracted from the printing area of the fused image to obtain a rough outer circle contour; and a fine outer circle contour is extracted from the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour;
[0076] Figure 5 This is the rough outer ring contour extraction flow chart in this application, such as Figure 5 As shown in the figure, the extraction process of the rough outer ring contour includes:
[0077] B11. 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; the input of this step is the fused image of the printing area, and using the printing area outer circle mask, an image containing only the printing area and the optical area is obtained.
[0078] B12, performing Gaussian filtering on the mask image to obtain a filtered image; this step is mainly to filter high-frequency noise;
[0079] B13, 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; this step is mainly to extract all dark areas on the white mold, where the dark areas include ink spots and stains.
[0080] B14, performing a first closing operation on the merged image to fill the gaps between the color points, thereby obtaining a first closed operation binary image; the closing operation is mainly performed to fill the gaps between the color points so that the color points are connected into one piece, thereby obtaining a whole printing area. In this process, stains around the printing area may also be connected together;
[0081] B15, performing an opening operation on the first closed operation binary image to filter out noise points around the printing area, thereby obtaining an open operation binary image; the opening operation can filter out noise points around the printing area, so that an area including the complete printing area and not containing stains or impurities is obtained;
[0082] B16. Perform area-based contour filtering in the open binary image to obtain a rough outer circle contour. The printing area contour is not close enough to the color dots. The main reason is that in order to fully fill the color dots in the printing area, the size of the closed kernel needs to be larger; and the area lacking ink inward from the edge is also filled by the closed operation, and finally a rough outer circle edge is obtained.
[0083] Figure 6This is the fine outer ring contour extraction flow chart in this application, such as Figure 6 As shown in the figure, the extraction process of the fine outer ring contour includes:
[0084] B21, performing ellipse fitting on the rough outer circle contour based on the least square method to obtain a fitted ellipse;
[0085] B22, masking the fused image based on the fitted ellipse to obtain a target area; thus, impurities and stains outside the printing area can be filtered out;
[0086] B23, adaptively binarizing the target area again to obtain a target binary image; this time the adaptive binarization extracts the local darker area, so that the binary contour can be closer to the color point;
[0087] B24, performing a second closing operation on the target binary image to obtain a second closed 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; performing a closing operation on the binary image to fill the color point holes, wherein the size of the morphological kernel of the closing operation here is smaller than the size of the kernel used in the closing operation during rough extraction, because an overly large kernel will cause the edge of the printing area to be filled with ink when it is lacking, so that a binary image area closer to the color point boundary is obtained;
[0088] B25. Perform area-based contour filtering in the second closed operation binary image to obtain a fine outer circle contour.
[0089] C. Ink shortage detection of outer ring
[0090] Figure 7 This is the overall flow chart of the outer ring ink shortage detection in this application, such as Figure 7 As shown, the outer ring ink shortage detection of the present application generally includes:
[0091] C1. Input image. The input is a fine outer circle contour. The fine outer circle contour can include the color points around the printing area. At the same time, the area lacking ink along the edge can be excluded by the contour.
[0092] C2. Perform circular fitting on the fine outer circle contour to obtain a fine outer circle. In this application, the RANSAC (Random Sample Consensus) fitting method is used to perform circular fitting on the fine outer circle contour. The pseudo code of the RANSAC fitting circle algorithm is as follows:
[0093] enter:
[0094] points: a two-dimensional point set, each point is represented by (x, y)
[0095] max_iterations: Maximum number of iterations
[0096] distance_threshold: distance threshold, used to determine whether the point is on the circle
[0097] min_inliers: minimum number of inner points, the minimum number of support points required for successful fitting
[0098] Output:
[0099] best_circle: Parameters of the best fitting circle (center (cx, cy) and radius r)
[0100] best_inliers_count: The number of inliers of the best fitting 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-repeated points from points, denoted as sample_points
[0105] b. Use sample_points to calculate the parameters of the circle (center (cx, cy) and radius r):
[0106] i. Calculate the geometric center of the sample point as the initial circle center estimate (optional step to accelerate convergence)
[0107] ii. Use linear algebra or geometry to calculate the exact center and radius (e.g., by solving a system of linear equations)
[0108] c. Initialize inliers_count to 0
[0109] d. For each point in points:
[0110] i. Calculate the distance dist from point to the center of the circle (cx, cy)
[0111] ii. If abs(dist-r) <= distance_threshold, then inliers_count increases by 1
[0112] e. If inliers_count>=min_inliers and inliers_count>best_inliers_count:
[0113] i. Update best_circle to the currently calculated 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 the RANSAC method can accurately describe the boundary of the color point;
[0117] C3, performing subtraction between the fine outer circle contour and the fine outer circle to obtain a difference binary image for characterizing the suspected ink deficiency area; the difference binary image is the area where ink deficiency may occur;
[0118] C4, performing 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; in this way, the candidate regions to be judged will be changed from the original arrangement along the center of the circle to the arrangement in columns (tangent direction), and at this time, the contour of each candidate ink-deficient region can be obtained by finding the contour of the binary image in the polar coordinate system;
[0119] C5. Perform multi-line ink shortage detection and single-line ink shortage detection on the polar coordinate binary image to obtain an ink shortage detection result.
[0120] C51, performing a multi-line ink shortage detection on the polar coordinate binary image, including:
[0121] 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 as an ink-deficient area.
[0122] The characteristic of the multi-line ink-deficient contour in the polar coordinate system is that the width along the radial direction is large, so a threshold can be set to specifically detect the area with a certain width along the radial direction, and the contour with a radial width greater than the threshold is determined as an ink-deficient area;
[0123] C52, performing single-line ink shortage detection on the polar coordinate binary image, including:
[0124] 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.
[0125] The characteristic of a single-line ink-deficient contour in the polar coordinate system is that its width along the radial direction is small, which is only the width of one line of color dots. When the precise circle and the precise outer contour are slightly offset due to alignment problems, a contour with the width of one line of color dots will also appear. Therefore, the width of the contour along the tangential direction needs to be set as well to avoid false detection. Contours with a radial width less than or equal to the width of one line of color dots and a tangential width greater than the threshold are judged as ink-deficient.
[0126] D. Visually output the ink shortage detection result.
[0127] Figure 8 Output a flow chart for the results in this application, such as Figure 8 As shown, the mask image containing the defect target frame in C is subjected to minimum bounding rectangle 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-deficient area to obtain an outer circle ink-deficient area in polar coordinates; and converting the binary ink-deficient area in the coordinates to image coordinates to obtain an outer circle ink-deficient area in image coordinates;
[0129] D2, generating the minimum circumscribed rectangle for the outer circle ink-deficient area under each image coordinate;
[0130] D3, transforming the minimum circumscribed rectangle into the coordinates of the plurality of contact lens original images;
[0131] D4. Draw a minimum circumscribed rectangle in the coordinates of the plurality of original contact lens images, thereby achieving visual output.
[0132] The invention discloses a method for detecting ink shortage in the outer ring of a contact lens color mold, which extracts the outer ring boundary of a high-precision printing area to obtain a precise boundary range, analyzes the contour of the printing area in a polar coordinate system, detects the ink shortage area of the outer ring, and realizes automatic recognition of ink shortage detection in the outer ring, thereby improving recognition accuracy. The invention can be widely used in contact lens automated detection systems, reduce manual detection costs, improve production efficiency, and thus improve the final product yield.
[0133] The present application also provides a device for detecting ink shortage in the outer ring of a color mold for a contact lens, comprising:
[0134] An acquisition module, used for acquiring a plurality of original contact lens images;
[0135] A preprocessing module, used for preprocessing and fusing the plurality of original contact lens images to obtain a fused image;
[0136] A contour extraction module is used to extract a rough outer circle contour of the printing area of the fused image to obtain a rough outer circle contour; and to extract a fine outer circle contour of the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour;
[0137] 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; to perform polar coordinate expansion on the difference binary image based on the circle of the fine outer circle to obtain a polar coordinate binary image; and to 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.
[0138] The invention discloses a device for detecting ink shortage in the outer ring of a color mold for a contact lens. The device extracts the outer ring boundary of a high-precision printing area to obtain a precise boundary range, analyzes the contour of the printing area in a polar coordinate system, detects the ink shortage area of the outer ring, and realizes automatic recognition of ink shortage in the outer ring, thereby improving recognition accuracy. The invention can be widely used in contact lens automated detection systems, reduce manual detection costs, improve production efficiency, and thus improve the yield rate of final products.
[0139] This embodiment also provides an electronic terminal, including: a processor and a memory;
[0140] 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.
[0141] 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.
[0142] 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.
[0143] 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.
[0144] 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.
[0145] 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.
[0146] 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 detecting ink shortage in the outer ring of a contact lens color mold, characterized in that: Includes steps: Acquire multiple contact lens original images; Preprocessing and fusing the multiple contact lens original images to obtain a fused image; Extracting a rough outer circle contour of the printing area of the fused image to obtain a rough outer circle contour; and extracting a fine outer circle contour of the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour; Perform circular fitting on the fine outer circle contour to obtain a fine outer circle; and perform difference calculation 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 circle 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. A method for detecting ink shortage in 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 the contour in the binary image, screening the contour 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 average operation is performed on the aligned multiple contact lens original images to obtain a fused image.
3. A method for detecting ink shortage in the outer ring of a contact lens color mold according to claim 1, characterized in that: The rough outer circle contour of the printed area of the fused image is extracted to obtain the 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; Perform channel splitting on the filtered image to obtain a plurality of single color channel images; and respectively perform adaptive binarization processing on the plurality of single color channel images to obtain a plurality of binarized images; and merge the plurality of binarized 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 operation binary image; 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; Area-based contour filtering is performed in the opening binary image to obtain a rough outer circle contour.
4. A method for detecting ink shortage in the outer ring of a contact lens color mold according to claim 1, characterized in that: Extracting a fine outer circle contour of the printing area based on the rough outer circle contour and the fused image to obtain a fine outer circle contour includes: Performing ellipse fitting on the rough outer circle contour based on the least square method to obtain a fitting 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 closing operation on the target binary image to obtain a second closed 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; Area-based contour filtering is performed in the second closed operation binary image to obtain a fine outer circle contour.
5. 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 a RANSAC fitting method.
6. A 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 as an ink-deficient area.
7. A method for detecting ink shortage in 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.
8. A method for detecting ink shortage in the outer ring of a contact lens color mold according to claim 7, characterized in that: Also includes: The ink shortage detection result is output visually.
9. A method for detecting ink shortage in the outer ring of a contact lens color mold according to claim 8, characterized in that: Visual output of 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 the coordinates to image coordinates to obtain an outer circle ink-deficient area in image coordinates; Generate the minimum circumscribed rectangle for the outer circle 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.
10. 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 contact lens images; A preprocessing module, used for preprocessing and fusing the plurality of original contact lens images to obtain a fused image; A contour extraction module is used to extract a rough outer circle contour of the printing area of the fused image to obtain a rough outer circle contour; and to extract a fine outer circle contour of the printing area based on the rough outer circle contour and the fused 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; to perform polar coordinate expansion on the difference binary image based on the circle of the fine outer circle to obtain a polar coordinate binary image; and to 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.
Citation Information
Patent Citations
Contact lens casting mold printing defect detection method and system
CN117849072A
Method and system for detecting flaws of printed contact lenses based on cloud-machine vision
CN118505634A
Visual inspection method and apparatus for contact lenses
US6134342A