A contact lens surface defect DR detection method and device based on cloud-machine vision

Through the contact lens surface defect detection method based on cloud-machine vision, the lens profile is extracted and defect analysis is carried out, and the problems of inaccurate detection of defects and high equipment environment requirements in the prior art are solved, and efficient and highly adaptable defect detection is achieved.

CN119757408APending Publication Date: 2025-04-04SIGMA SQUARES (BEIJING) TECH CO LTD

Patent Information

Application Number
CN202411819307.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The prior art is prone to introduce new interference when detecting defects on the surface of contact lenses, and has high requirements for the equipment and environment, which is not easy to implement.

Method used

The surface defect detection method of contact lenses based on cloud-machine vision is adopted. By obtaining contact lens images for pre-processing, the lens profile is extracted, obvious defect detection and defect feature extraction is performed, and defect analysis is finally performed using pre-constructed analysis parameters.

Benefits of technology

It has achieved comprehensive defect detection on the surface of contact lenses, which can adapt to the diversity, uncertainty and instability of defects, reduce manual re-inspection costs, improve production efficiency, and improve product yield.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119757408A_ABST
    Figure CN119757408A_ABST
Patent Text Reader

Abstract

The present invention relates to the field of machine vision, and specifically to a contact lens surface defect DR detection method and device based on cloud-machine vision, which obtains the lens contour by preprocessing and positioning the contact lens image under multiple light fields. Then, obvious defect detection and defect feature extraction are performed based on the lens contour, and finally the defect features are analyzed using pre-configured analysis parameters. Thus, a comprehensive defect detection is performed on the surface of the contact lens. The system has better adaptability to the diversity, uncertainty and morphological instability of defects in the current contact lens production process, so that it can be widely used in the contact lens automated detection system, reducing the cost of manual re-inspection, improving production efficiency, and thus improving the final product yield.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine vision, and in particular to a contact lens surface defect DR detection method and device based on cloud-machine vision. Background Art

[0002] The main manufacturing methods of contact lenses include turning, molding, demolding, hydration, etc. Due to the production process and raw materials, surface defects such as fragments, fibers, and water marks are prone to occur during the contact lens production process.

[0003] Existing technologies such as the Chinese patent: Automatic optical inspection system and method for detecting surface defects of contact lenses (CN113390897A) use a probe to move the lens to confirm suspected defects, which easily introduces new interference, and the lens is easily deformed in water, resulting in inaccurate detection. It has high requirements for equipment and environment and is not easy to implement. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a contact lens surface defect DR detection method and device based on cloud-machine vision 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 contact lens surface defect DR detection method based on cloud-machine vision of the present invention comprises the steps of:

[0007] Acquire a contact lens image, and pre-process the contact lens image to obtain a process image, wherein the contact lens image is obtained by photographing a contact lens placed in a carrier, and the contact lens image is a bright field image, a dark field image, or a point light source image;

[0008] Carrier determination is performed from the process image based on a fixed threshold binarization method and a morphological method;

[0009] If there is a carrier in the process image, perform contour extraction on the process image, and extract a lens contour from the contour of the process image based on pre-constructed screening parameters; and perform obvious defect detection based on the lens contour to obtain an obvious defect detection result;

[0010] Extracting defect features from the contact lens image based on the lens profile to obtain surface defect features;

[0011] The surface defect features are subjected to defect analysis based on pre-constructed analysis parameters to obtain defect detection results.

[0012] In one embodiment of the present application, performing contour extraction on the process image, and extracting the lens contour from the contour of the process image based on pre-constructed screening parameters, includes:

[0013] Performing two low-pass filtering on the process image to obtain a filtered image, wherein the kernel size of the first filtering is larger than the kernel size of the second filtering;

[0014] Adaptive binarization is performed on the filtered image to obtain a binarized image C1a. i,j , where i,j are pixel coordinates;

[0015] Construct the vehicle small bowl area BlisterROI based on the pre-configured small bowl fitting circle information;

[0016] Based on the binary image C1a i,j The feature image C1fea is constructed with the BlisterROI of the small bowl area of ​​the vehicle i,j , wherein the characteristic image C1fea i,j The mathematical expression is:

[0017]

[0018] Extract the feature image C1fea i,j and based on the pre-configured contour filtering parameters, the feature image C1fea i,j The contours in are filtered to obtain the inner contour, outer contour, and outer contour fitting ellipse.

[0019] In one embodiment of the present application, obvious defect detection is performed based on the lens profile to obtain obvious defect detection results, including:

[0020] Extracting a lens area image from the process image based on the outer contour fitting ellipse, and performing cross-calculation between the lens area image and the carrier small bowl area BlisterROI to obtain an intersection image C21Img; when the number of pixel points in the intersection image C21Img is greater than a preset edge parameter threshold, determining that the lens has a patch defect;

[0021] Count the feature image C1fea i,j The number of contours in the feature image C1fea i,j When the number of contours in is not the preset number, it is determined that the lens has large-size edge defects;

[0022] Extracting the major axis and minor axis of the outer contour fitting ellipse, and calculating the difference between the major axis and the minor axis, and the ratio of the major axis to the minor axis; when the difference between the major axis and the minor axis is greater than or equal to a set threshold of the difference between the major and minor axes, or when the ratio of the major axis to the minor axis is less than a preset threshold of the lens aspect ratio, determining that the lens has a deformation defect;

[0023] The feature image C1fea is obtained based on the ellipse center and the assumed radius of the outer contour fitting ellipse. i,j Perform polar coordinate expansion, and perform abnormal point detection on the characteristic image in the polar coordinates, and when the abnormal point meets the multi-piece characteristics, determine that the lens has a multilateral defect, wherein the assumed radius is the average value of the major axis and the minor axis of the outer contour fitting ellipse;

[0024] The major axis and the minor axis of the outer contour fitting ellipse are extracted, and the average values ​​of the major axis and the minor axis are calculated, and the average value is compared with a preset diameter setting threshold range, and when the average value is not within the preset diameter setting threshold range, it is determined that the lens has a size defect.

[0025] In one embodiment of the present application, defect features are extracted from the contact lens image based on the lens profile to obtain surface defect features, including:

[0026] Divide the contact lens image into surface areas based on the lens contour to obtain a printed area, a central optical area, and a peripheral transparent area of ​​the contact lens; and perform surface bubble detection on the contact lens image based on the lens contour to obtain surface bubble features;

[0027] Constructing an effective detection area based on a central optical area and a peripheral transparent area, and extracting initial surface defect features of the effective detection area;

[0028] Extracting feature information of the surface defect feature, wherein the feature information includes geometric information and grayscale information;

[0029] Based on the feature information of the surface bubble feature and the surface defect feature, the defects caused by water bubbles are filtered to obtain the surface defect feature.

[0030] In one embodiment of the present application, the surface area of ​​the contact lens image is divided based on the lens contour to obtain the printed area, the central optical area and the peripheral transparent area of ​​the contact lens, including:

[0031] Determining whether the bright field image is a transparent film based on preset parameters;

[0032] If not, downsampling and sharpening the bright field image to obtain a downsampled image;

[0033] Binarizing and morphologically processing the downsampled image to obtain a downsampled contour image;

[0034] Screening the contours in the downsampled contour image based on a pre-configured empirical area threshold to obtain an inner contour of the printing area and an outer contour of the printing area;

[0035] Fitting the inner contour of the printing area and the outer contour of the printing area respectively to obtain printing area features, wherein the printing area features include an inner ellipse of the printing area, an outer ellipse of the printing area, and a printing area image;

[0036] Multiplying the pre-configured central optical zone ratio by the outer contour fitting ellipse to obtain a scaled ellipse contour; drawing a first contour image based on the scaled ellipse contour, and drawing a second contour image based on the printed area inner ellipse;

[0037] Performing an AND operation on the first contour image and the second contour image to obtain central optical zone features, wherein the central optical zone features include a central optical zone fitting ellipse and an optical zone image of interest;

[0038] A global image of the lens is drawn based on the outer contour fitting ellipse, the outer contour of the printed area is used in the global image to draw the peripheral transparent area contour of the lens, and the peripheral transparent area contour of the lens is fitted to obtain a peripheral transparent area ellipse and a peripheral transparent area image.

[0039] In one embodiment of the present application, surface bubble detection is performed on the contact lens image based on the lens profile to obtain surface bubble features, including:

[0040] Extracting the lens surface area in the bright field image based on the major axis, the minor axis and the center of the outer contour fitting ellipse;

[0041] Sequentially filtering, morphologically processing, and binarizing the bright field image to obtain a bright field binary image;

[0042] Extracting surface features in the bright field binary image based on the lens edge region;

[0043] Extracting surface features in the bright field binary image that meet the bubble features to obtain a surface bubble defect detection result, wherein the bubble features include the roundness of the bubble features being greater than a preset roundness threshold, the length and width of the bubble features being greater than a preset bubble length-to-width ratio threshold, and the grayscale of the bubble features being less than a preset bubble grayscale threshold;

[0044] The contour of the bubble feature is reconstructed to obtain the surface bubble feature.

[0045] In one embodiment of the present application, the defects caused by bubbles are filtered based on the characteristic information of the surface bubble characteristics and the surface defect characteristics to obtain the surface defect characteristics, including:

[0046] Calculating the minimum area rectangle of the surface defect feature;

[0047] Extracting the center of the minimum area rectangle and the center of the surface bubble feature;

[0048] It is determined whether there is a target surface defect feature whose center of the minimum area rectangle and the center of the surface bubble feature are less than a set value. If so, the target surface defect feature is deleted to obtain a surface defect feature.

[0049] In one embodiment of the present application, defect analysis is performed on the surface defect feature based on pre-constructed analysis parameters to obtain defect detection results, including:

[0050] Calculating the geometric information and grayscale information of the surface defect feature, wherein the geometric information includes the area of ​​the contour, the length of the minimum circumscribed rectangle, the aspect ratio of the minimum circumscribed rectangle, the contour roundness and the contour rectangularity, and the grayscale information includes the average grayscale value, grayscale variance, gradient, maximum grayscale, minimum grayscale and central grayscale value;

[0051] A determination condition matching the surface defect feature is selected, and defect analysis is performed on the surface defect feature based on the geometric information and grayscale information of the surface defect feature and the determination condition of the surface defect feature to obtain a defect detection result.

[0052] In one embodiment of the present application, it also includes:

[0053] sending the defect detection result to a target object;

[0054] When modification information from the target object is received, the analysis parameters are adjusted based on the modification information, and the adjusted analysis parameters are saved, wherein the modification information is generated based on the defect detection result.

[0055] The present application also provides a contact lens surface defect DR detection device based on cloud-machine vision, comprising:

[0056] An acquisition module acquires a contact lens image and pre-processes the contact lens image to obtain a process image, wherein the contact lens image is obtained by photographing a contact lens placed in a carrier, and the contact lens image is a bright field image, a dark field image, or a point light source image;

[0057] A judgment module, which performs vehicle judgment from the process image based on a fixed threshold binarization method and a morphological method;

[0058] A contour and obvious defect extraction module, if there is a carrier in the process image, performs contour extraction on the process image, and extracts the lens contour from the contour of the process image based on pre-built screening parameters; and performs obvious defect detection based on the lens contour to obtain an obvious defect detection result;

[0059] A defect feature extraction module extracts defect features from the contact lens image based on the lens profile to obtain surface defect features;

[0060] The defect analysis module performs defect analysis on the surface defect features based on pre-built analysis parameters to obtain defect detection results.

[0061] The beneficial effects of the present invention are as follows: a method and device for detecting DR surface defects of contact lenses based on cloud-machine vision of the present invention obtains the lens contour by preprocessing and positioning the contact lens image under multiple light fields. Then, obvious defects are detected and defect features are extracted based on the lens contour, and finally the defect features are analyzed using pre-configured analysis parameters. Thus, a comprehensive defect detection is performed on the surface of the contact lens. The system has better adaptability to the diversity, uncertainty and morphological instability of defects in the current contact lens production process, so that the system can be widely used in the contact lens automated detection system, reducing the cost of manual re-inspection, improving production efficiency, and thus improving the final product yield. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0063] Figure 1 It is an application scenario diagram shown in an embodiment of the present application;

[0064] Figure 2 It is a flow chart of a contact lens surface defect DR detection method based on cloud-machine vision shown in an embodiment of the present application;

[0065] Figure 3 is a flowchart of lens defect detection in one embodiment of the present application;

[0066] Figure 4 This is a flow chart for extracting surface defect features in this application;

[0067] Figure 5 A schematic diagram of the process of dividing the surface area in this application;

[0068] Figure 6 Schematic diagram of the process of extracting surface features from a bright field image in one embodiment of the present application. DETAILED DESCRIPTION

[0069] 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.

[0070] 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.

[0071] 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.

[0072] In this application, DR means (dynamic reconfigure), that is, dynamic configuration.

[0073] Figure 1 is an application scenario diagram shown in an embodiment of the present application, such as Figure 1 As shown, a group of pictures of printed contact lens products are taken by an industrial camera to obtain a corresponding grayscale image group, wherein the grayscale image group includes a bright field image, a dark field image and a point light source image; the images are transmitted to an industrial computer and forwarded to a cloud server via the industrial computer for defect detection; the product inspection results are obtained and pushed to the industrial computer and a subsequent data processing center.

[0074] Figure 2 FIG. 1 is a flow chart of a method for detecting contact lens defects DR based on cloud-machine vision in one embodiment of the present application. Figure 2 As shown, a contact lens defect DR detection method based on cloud-machine vision in this embodiment may include the following steps:

[0075] S210, acquiring a contact lens image, and preprocessing the contact lens image to obtain a process image, wherein the contact lens image is obtained by photographing a contact lens placed in a carrier, and the contact lens image is a bright field image, a dark field image, or a point light source image;

[0076] S220, performing vehicle determination from the process image based on a fixed threshold binarization method and a morphological method;

[0077] S230, if there is a carrier in the process image, extract the contour of the process image, and extract the lens contour from the contour of the process image based on pre-built screening parameters; and perform obvious defect detection based on the lens contour to obtain an obvious defect detection result;

[0078] S240, extracting defect features from the contact lens image based on the lens profile to obtain surface defect features;

[0079] S250, performing defect analysis on the surface defect features based on pre-constructed analysis parameters to obtain defect detection results.

[0080] The following is a detailed explanation of the above process. First, before acquiring an image through the camera, you need to initialize the parameters in advance, including:

[0081] A. Initialization configuration

[0082] The initialization configuration is responsible for initializing the detection system, loading the preset system parameters Pars, preprocessing the received contact lens images, removing noise interference, ensuring image consistency, and generating the process image Process Image. Specifically, it includes:

[0083] A1, Initialization Configuration Process

[0084] A11, import the configuration table. The configuration table consists of two parts. One part is the system preset configuration, including lens size parameters, system setting parameters, etc. The other part is Meta information, which includes the location information of the defect and the detection parameters. The detection parameters include the color and geometric information in the feature Feature, such as the minimum detection area minArea, the shortest detection size minLength, the detection density range SolidRange, the detection aspect ratio range AspRange, the detection roundness range RoundRange, the detection circularity range CirRange, the detection gray value range GrayRange, the detection gray variance range VarRange, the detection gradient range GradRange, etc.

[0085] A12, load lens related parameters, including lens type Type, lens size parameters, such as the longest diameter range DMaxRange: the shortest diameter range DMinRange, the maximum tolerance threshold of the lens major and minor axes DDiff, the lens aspect ratio AspectRatio, etc.

[0086] A13, light source configuration and detection, configure the light source through the system preset configuration in A11, set whether each image is enabled, and detect whether the number of images is correct.

[0087] A14, image object initialization, packages each image according to A11 and A13 data to form image data LensImageGroup, which contains image data and image ID.

[0088] A15, detection result initialization, initialization settings for each part of the detection results, mainly including the small bowl detection result BlisterResult, lens edge extraction result LenEdgeExtractResult, lens rough inspection result GrossDefectResult, lens edge detection result LensEdgeResult and lens surface inspection result LensSurfaceInspectResults.

[0089] A2, after configuration is completed, the pre-processing process is carried out, which includes:

[0090] A21, load, decode, read camera image data, and convert it from RAW to RGB format to get Image

[0091] A22, transform Image to grayscale space to obtain grayscale image GrayImage and store it in LensImageGroup

[0092] A23, performs Gaussian filtering with a kernel of 3×3 on the grayscale image GrayImage in A22 to obtain a process image Process Image, the purpose of which is to reduce the interference caused by environmental noise.

[0093] B. Vehicle detection

[0094] It is mainly responsible for extracting the transparent carrier area where the contact lenses are stored from the process image Process Image, and checking it through the Pars parameters in A to determine whether it is normal, so as to obtain the carrier detection area ROI. The specific process is as follows:

[0095] B1 uses a fixed threshold binarization method and a morphological method to extract the vehicle area from the process image Process Image to obtain a binary image th;

[0096] B2 calculates the outermost contour area and size of the binary image th in B1 to obtain the suspected vehicle contour, and then verifies it through the vehicle configuration parameters obtained in A12. If the conditions are met, the vehicle contour is determined and the vehicle ROI is generated; if not, the vehicle is determined to be abnormal and the vehicle detection abnormality result is output, directly entering the subsequent result generation and analysis process.

[0097] C. Edge extraction and rough inspection

[0098] Responsible for processing the process image, extracting the edge contour of the contact lens from the carrier ROI, calculating the overall parameters of the lens contour such as length and width, aspect ratio, roundness and other information, and detecting obvious defects such as abnormal size, non-round lens, and lens edge through Pars in A. Specifically, it includes:

[0099] C1, lens edge extraction

[0100] C11, perform two low-pass filtering on the process image to obtain a filtered image Filtered, wherein the kernel size of the first filtering is larger than the kernel size of the second filtering; wherein the kernel size of the first filtering is a 5×5 Gaussian kernel, and the kernel size of the second filtering is a 3×3 Gaussian kernel.

[0101] C12, performing adaptive binarization on the filtered image to obtain a binarized image C1a i,j , where i,j are pixel coordinates;

[0102] C13, constructing the vehicle small bowl area BlisterROI based on the pre-configured small bowl fitting circle information (center R, radius C);

[0103] C14, based on the binary image C1a i,j The feature image C1fea is constructed with the BlisterROI of the small bowl area of ​​the vehicle i,j , wherein the characteristic image C1fea i,j The mathematical expression is:

[0104]

[0105] C15, extract the feature image C1fea i,j and filter the feature image C1fea based on the pre-configured profile screening parameters (the setting values ​​of the lens parameters in A12). i,j The contours in are filtered to obtain the inner contour inner, the outer contour outer, and the outer contour fitting ellipse ellipse, and are saved to the data structure corresponding to LenEdgeExtractResult, and enter C16; if both the inner and outer contours do not exist, it is considered that there is no lens, and the result item in LenEdgeExtractResult is assigned the value "NoLens" and exit;

[0106] C16, checks and integrates the internal and external contours saved in C15, and supplements the relevant data in LenEdgeExtractResult, including the effective ROI area BlisterROI, the outer contour fitting ellipse ellipse, the number of detected contours edge_num, the edge feature data C1fea, etc.;

[0107] C2, lens obvious defect detection

[0108] C21, extracting the lens area image from the process image based on the outer contour fitting ellipse, and performing cross-calculation between the lens area image and the carrier small bowl area BlisterROI to obtain an intersection image C21Img; counting the number of pixel points in the intersection image C21Img that are greater than a preset edge parameter threshold (i.e., the lens edge parameter threshold T in A12) touch ), it is determined that the lens has a patch defect; the result item in GrossDefectResult is assigned the value "Touch" and exits, otherwise the next step, the expression is as follows:

[0109]

[0110] C22, using edge_num in C16 to identify large-scale defects of the lens. Count the feature image C1fea i,j The number of contours in the feature image C1fea i,j When the number of contours in is not the preset number, it is determined that the lens has a large-scale edge defect; specifically, the printed area of ​​the lens is annular, including an inner contour and an outer contour, so under normal circumstances, the number of contours is 2. If edge_num is not 2, that is, there is only an outer edge but no inner edge, then it is considered that the lens has a large-scale edge defect, and the result item in GrossDefectResult is assigned to "EdgeDefect" and exits, otherwise the next step, the expression is as follows:

[0111]

[0112] C23, using the major axis a and minor axis b in the outer contour fitting ellipse in C16 to judge the lens deformation. First, extract the major axis a and minor axis b of the outer contour fitting ellipse, and calculate the difference between the major axis a and the minor axis b, and the ratio of the major axis to the minor axis aspect; when the difference between the major axis and the minor axis is greater than or equal to the major axis difference, set the threshold T abdif , or the ratio of the major axis to the minor axis is less than a preset lens aspect ratio threshold value T edge_asp , it is determined that the lens has deformation defects; if the lens is deformed, the result item in GrossDefectResult is assigned the value "Distort" and exits, otherwise the next step is as follows:

[0113]

[0114] C24, using C1fea and ellipse in C16 to detect whether the lens is "multiple". Based on the outer contour fitting ellipse ellipse ellipse center EC and assumed radius For the feature image C1fea i,j Polar coordinates are expanded, and outliers are detected for the feature image in the polar coordinates. When the outliers meet the multi-lens feature, it is determined that the lens has a multilateral defect, wherein the assumed radius is the average value of the major axis and the minor axis of the outer contour fitting ellipse. In this embodiment, an outlier detection algorithm based on mathematical statistics is adopted, and the points with a large difference between the length axis and the assumed radius r in the polar coordinates are taken as outliers. If the number of outliers is large, it is considered that the multi-lens feature is met. When there are multi-lens defects, the result item in GrossDefectResult is assigned to "MutilLens" and exits. Otherwise, the next step is as follows:

[0115]

[0116] C25, extract the major axis a and the minor axis b of the outer contour fitting ellipse, and calculate the average value d=mean(a,b) of the major axis and the minor axis, regard the average value d as the lens diameter, compare the average value with the preset diameter setting threshold interval LensDiaRange, and when the average value is not within the preset diameter setting threshold interval, determine that the lens has a size defect, assign the result item in GrossDefectResult to "Offsize" and exit, otherwise, go to the next step, the expression is as follows:

[0117]

[0118] D. Lens defect detection

[0119] The lens defect detection module is mainly composed of various image detections. The current detection light source images generally include bright field, dark field and point light source images. Each image will be used for surface defect detection. Figure 3 This is a flowchart of lens defect detection in an embodiment of the present application, such as Figure 3 As shown, since the detection process of each image is basically the same, the bright field image is used as an example for description. The image sequence of this contact lens detection system is generally bright field image → dark field image → point light source image. The bright field image detection process is as follows:

[0120] Initialize the bright field surface processor BrightSurfaceProcessor;

[0121] Initialize the bright field surface extractor bright_surface_extractor and the surface feature pool SurfaceFeaturePool;

[0122] Call the bright_surface_extractor.extract method to extract the suspicious defect features of the bright field surface and put them into SurfaceFeaturePool;

[0123] Call the feature analysis module analyze_surface to filter and classify the features in SurfaceFeaturePool, and encapsulate the results into the defect object Defect.

[0124] Analyze the defect object Defect and generate the final detection result and information of the current bright field.

[0125] Surface defect detection is responsible for extracting surface defect features from each image using various feature extraction algorithms. Figure 4 This is the flow chart of surface defect feature extraction in this application, such as Figure 4 As shown, they are surface area division, surface bubble detection, surface feature extraction, feature attribute calculation, and defect filtering caused by bubbles. Figure 5 A schematic diagram of the process of dividing the surface area in this application, such as Figure 5 As shown, the surface area division includes:

[0126] D1, judging whether the bright field image is a transparent film based on preset parameters; if so, using the preset related parameters in A11 to divide the surface area; if not, entering the subsequent printing area extraction process;

[0127] D2, Printing Area Extraction

[0128] D21, downsampling and sharpening the bright field image to obtain a downsampled image sub_image; the purpose of downsampling is to eliminate the interference of the singular pattern, and the downsampled image is sharpened to highlight the pattern area information;

[0129] D22, performing binarization and morphological processing on the downsampled image sub_image to obtain a downsampled contour image sub_th;

[0130] D23, screening the contours in the downsampled contour image sub_th based on a pre-configured empirical area threshold to obtain an inner contour of the printing area and an outer contour of the printing area; wherein the outer contour outer is used as the end area of ​​the printing area, and the inner contour inner is used as the start area of ​​the printing area;

[0131] D24, fitting the inner contour of the printing area inner and the outer contour of the printing area outer respectively to obtain printing area features, wherein the printing area features include the inner ellipse of the printing area print_inner_ellipse, the outer ellipse of the printing area print_outer_ellipse and the printing area image surface_1st_region_roi_img;

[0132] D3, Optical Zone Extraction

[0133] D31, using a preset empirical parameter central optical zone ratio optical_pct, multiplying the pre-configured central optical zone ratio optical_pct by the outer contour fitting ellipse to obtain a scaled ellipse contour opt_ellipse, and using opt_ellipse to draw a contour image cfg_opt;

[0134] D32, drawing a first contour image cfg_opt based on the scaled ellipse contour, and drawing a second contour image print_opt based on the printing area inner ellipse print_inner_ellipse;

[0135] D33, performing an AND operation on the first contour image cfg_opt and the second contour image print_opt to obtain central optical zone features, wherein the central optical zone features include a central optical zone fitting ellipse opt_ellipse and an optical zone image of interest optical_region_roi_img.

[0136] D4, peripheral transparent area extraction

[0137] D41, drawing a global image of the lens based on the outer contour fitting ellipse; specifically, using the outer contour fitting ellipse in C to draw an image (grayscale 255), to obtain the lens global image whold_surface_roi_img;

[0138] D42, using the printed area outer contour outter to draw (with a grayscale of 0) the transparent area contour surface_2nd_region_roi_img around the lens in the global image whole_surface_roi_img;

[0139] D43, fitting the outline of the peripheral transparent area of ​​the lens to obtain a peripheral transparent area ellipse and a peripheral transparent area image.

[0140] D6, surface feature extraction

[0141] Figure 6FIG. 1 is a schematic diagram of a process for extracting surface features of a bright field image in an embodiment of the present application. Figure 6 As shown, taking the bright field image as an example, it includes:

[0142] D61, performing binarization processing on the target image to obtain a target feature image; wherein the target image is the bright field image, the dark field image or the point light source image;

[0143] D62, performing OR operation on the target characteristic image, the printing area image, the optical area image of interest and the peripheral transparent area image, respectively, to obtain a printing area characteristic image, an optical area characteristic image and a peripheral transparent area characteristic image;

[0144] D63, respectively extracting the contours of the printed area feature image, the optical area feature image, and the peripheral transparent area feature image to obtain surface defect features, and storing them in a feature pool FeaturePool.

[0145] D7, feature attribute calculation

[0146] The feature information mainly includes geometry information GeometryInfo and grayscale information GrayInfo; the geometry information GeometryInfo mainly includes area, minimum area rectangle min_rect, and further obtains attributes such as length, width, roundness, rectangularity, and whether there is an inner ring is_ring; GrayInfo mainly includes average grayscale gray_mean, maximum grayscale gray_max, minimum grayscale gray_min, gradient gradint, etc.

[0147] After the above feature extraction, it is also necessary to eliminate the interference caused by bubbles, including:

[0148] (1) calculating the minimum area rectangle of the surface defect feature;

[0149] (2) extracting the center of the minimum area rectangle and the center of the surface bubble feature;

[0150] (3) Determine whether there is a target surface defect feature whose center distance between the minimum area rectangle and the center of the surface bubble feature is less than a set value; if so, delete the target surface defect feature.

[0151] Taking the surface bubble feature EdgeBubble as an example, the contour contour of the feature pool FeaturePool is filtered through the surface bubble feature EdgeBubble in D1. The steps are as follows:

[0152] In D4, the minimum area moment min_rect of each contour contour has been obtained, and its center contour_center can be further obtained; then, by traversing the contours in EdgeBubble, the contour center Bubble_center is obtained, and the filter_bbl_rect algorithm (polling) is used to determine whether there is Bubble_center within a certain distance of contour_center. If there is, the contour is considered to be a bubble interference and deleted from the feature pool FeaturePool. If not, it is retained.

[0153] E. Feature Analysis

[0154] E1, selecting a determination condition that matches the surface defect feature, performing defect analysis on the surface defect feature based on the geometric information and grayscale information of the surface defect feature and the determination condition of the surface defect feature, and obtaining a defect detection result.

[0155] Specifically, the meta obtained in A12 includes light source attributes, region attributes, position attributes, and defect attributes. The light source attributes (ligth) are bright, dark, and point, i.e., bright field, dark field, and point light source; the region attribute (region) is surface, i.e., surface attribute, and the surface position attributes are: optical, print, and outer. The defect attribute (defect) is the names of various defects and their corresponding geometry and color information.

[0156] Specifically include:

[0157] E21, load meta[light] according to the current image light source information;

[0158] E22, further loading corresponding information meta[light][region] according to the current region attributes, that is, if it is surface feature analysis, then loading meta[light][surface];

[0159] E23, further loads the corresponding information meta[light][region][location] according to the feature location attribute. For example, if the feature is the optical region feature of the surface area of ​​the bright field image, then meta[bright][surfece][optical] is loaded.

[0160] The feature is filtered and analyzed through the obtained meta information, and the result is encapsulated into the defect Defect. Defect is a higher-level encapsulation of Feature, which includes two parts: defect attribute Attribute and feature Feature. Attribute stores the classification result information after feature analysis, and Feature contains the feature geometry and color information mentioned in A11. The specific process includes:

[0161] Assign the information loaded by E23 to the new variable config_data, and check whether config_data is empty. If it is empty, it means that no detection item is set in this area, and the current feature is judged as an interference defect. The result is encapsulated into the defect Defect. At this time, the defect attribute is Defect.attribute.name = noise, and the detection is completed; if it is not empty, go to the next step.

[0162] Traverse the defect types in config_data and divide them into three categories: bubble, noise and defect, and store them in three dictionaries, namely bubble_lists, noise_lists and defect_lists.

[0163] Send the current feature to the bubble_lists analysis function analyze_function for filtering and classification. If the conditions are met, Defect.attribute.name = bubble, the result is encapsulated as Defect, and the detection ends; if not, proceed to the next step.

[0164] Send the current feature to the noise_lists analysis function analyze_function for filtering and classification. If the conditions are met, Defect.attribute.name = noise, the result is encapsulated as Defect, and the detection is completed; if not, proceed to the next step.

[0165] Send the current feature to the defect_lists analysis function analyze_function for filtering and classification. If the conditions are met, Defect.attribute.name = defect, the result is encapsulated as Defect, and the detection ends; if not, Defect.attribute.name = other, the result is encapsulated as Defect, and the detection ends.

[0166] Furthermore, the principle of analyze_function is as follows: by judging whether the various geometric and color information in the feature is within the range of the geometric and color information of each defect in config_data, if all the information is satisfied, it is judged as the current defect and the result is encapsulated into Defect. If it is not satisfied, the current defect is skipped and the next defect is judged until all defects under the current config_data are traversed. Some related expressions are as follows:

[0167]

[0168] Defect={f1,f2,f3,…f i

[0169]

[0170] f i_geo = {solid i ,aspect i ,roundness i ,circularity i}

[0171] f i_gray = {gray i ,var i ,min_g i ,max_g i ,gradient i ,center_g i}

[0172] F. Result output: One is the result analysis of a single image, and the other is the final result analysis of the lens. It is responsible for making a comprehensive judgment on the above-mentioned carrier inspection results, lens rough inspection results, and lens image results by combining the project defect priority file, and outputting the final result of the lens and the corresponding annotation information.

[0173] Single image result analysis

[0174] Combine all the defects obtained in E into the defect pool Defects, analyze the data in Defects according to the priority configuration, and assign the defect information with the highest priority to the current image result imageResult.

[0175] Final analysis of lens results

[0176] Initialize the result data in LensResult to "Pass";

[0177] Analyze BlisterResult in module B and GrossDefectResult in module C. If any of the results in the above modules is not "Pass", assign the same defect code to LensResult.result and copy the relevant annotation data to the data structure corresponding to LensResult.

[0178] Load each image detection result imageResult, then assign the highest priority defect code to LensResult.result, and copy the relevant annotation data to the data structure corresponding to LensResult.

[0179] According to the corresponding detection results, the corresponding detection information and annotation information are output to end this module.

[0180] G, Dynamic Adjustment and Output: Responsible for packaging and outputting the results in F, and can dynamically adjust meta-related parameters in A11 through the software interface, preview the effects in real time, and save application parameters, etc. Specifically including:

[0181] G1, combined with the system parameters in A, packages the output results. If it is necessary to draw an image marking the location of the defect, then use the relevant position coordinate information of Defect, such as min_rect.

[0182] G2, through the relevant API, outputs the product detection result Res corresponding to the image analyzed in the detection step F, and presents the result to the corresponding front-end display interface and related data processing center, such as physical software, Web, mobile APP, etc.

[0183] G3, if the displayed result is not in line with expectations, you can dynamically adjust the parameters through the relevant software and view the current detection effect in real time. When the expected result is achieved, the parameters can be saved and applied to the detection system, and then return to G2 to continuously observe the detection effect and system operation status to achieve closed-loop adjustment.

[0184] The present invention discloses a method for detecting DR surface defects of contact lenses based on cloud-machine vision, which obtains the lens contour by preprocessing and positioning the contact lens image under multiple light fields. Then, obvious defect detection and defect feature extraction are performed based on the lens contour, and finally the defect features are analyzed using pre-configured analysis parameters. Thus, a comprehensive defect detection is performed on the surface of the contact lens. The system has better adaptability to the diversity, uncertainty and morphological instability of defects in the current contact lens production process, so that the system can be widely used in the contact lens automated detection system, reducing the cost of manual re-inspection, improving production efficiency, and thus improving the final product yield.

[0185] The present application also provides a contact lens surface defect DR detection device based on cloud-machine vision, comprising:

[0186] An acquisition module acquires a contact lens image and pre-processes the contact lens image to obtain a process image, wherein the contact lens image is obtained by photographing a contact lens placed in a carrier, and the contact lens image is a bright field image, a dark field image, or a point light source image;

[0187] A judgment module, which performs vehicle judgment from the process image based on a fixed threshold binarization method and a morphological method;

[0188] A contour and obvious defect extraction module, if there is a carrier in the process image, performs contour extraction on the process image, and extracts the lens contour from the contour of the process image based on pre-built screening parameters; and performs obvious defect detection based on the lens contour to obtain an obvious defect detection result;

[0189] A defect feature extraction module extracts defect features from the contact lens image based on the lens profile to obtain surface defect features;

[0190] The defect analysis module performs defect analysis on the surface defect features based on pre-built analysis parameters to obtain defect detection results.

[0191] The present invention discloses a contact lens surface defect DR detection device based on cloud-machine vision, which obtains the lens contour by preprocessing and positioning the contact lens image under multiple light fields. Then, obvious defect detection and defect feature extraction are performed based on the lens contour, and finally the defect features are analyzed using pre-configured analysis parameters. Thus, a comprehensive defect detection is performed on the surface of the contact lens. The system has better adaptability to the diversity, uncertainty and morphological instability of defects in the current contact lens production process, so that the system can be widely used in the contact lens automated detection system, reducing the cost of manual re-inspection, improving production efficiency, and thus improving the final product yield.

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

[0193] 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.

[0194] 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.

[0195] 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.

[0196] 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.

[0197] 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.

[0198] 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 skilled in the art according to 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.

[0199] 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 contact lens surface defect DR detection method based on cloud-machine vision, characterized in that: Includes steps: Acquire a contact lens image, and pre-process the contact lens image to obtain a process image, wherein the contact lens image is obtained by photographing a contact lens placed in a carrier, and the contact lens image is a bright field image, a dark field image, or a point light source image; Carrier determination is performed from the process image based on a fixed threshold binarization method and a morphological method; If there is a carrier in the process image, perform contour extraction on the process image, and extract a lens contour from the contour of the process image based on pre-constructed screening parameters; and perform obvious defect detection based on the lens contour to obtain an obvious defect detection result; Extracting defect features from the contact lens image based on the lens profile to obtain surface defect features; Based on the pre-constructed analysis parameters, the surface defect features are subjected to defect analysis to obtain defect detection results, wherein the analysis parameters are adjusted in a dynamic manner.

2. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 1, characterized in that: Performing contour extraction on the process image, and extracting a lens contour from the contour of the process image based on pre-built screening parameters, comprising: Performing two low-pass filtering on the process image to obtain a filtered image, wherein the kernel size of the first filtering is larger than the kernel size of the second filtering; Adaptive binarization is performed on the filtered image to obtain a binarized image C1a. i,j , where i,j are pixel coordinates; Construct the vehicle small bowl area BlisterROI based on the pre-configured small bowl fitting circle information; Based on the binary image C1a i,j The feature image C1fea is constructed with the BlisterROI of the small bowl area of ​​the vehicle i,j , wherein the characteristic image C1fea i,j The mathematical expression is: Extract the feature image C1fea i,j and based on the pre-configured contour filtering parameters, the feature image C1fea i,j The contours in are filtered to obtain the inner contour, outer contour, and outer contour fitting ellipse.

3. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 2, characterized in that: Performing obvious defect detection based on the lens profile to obtain obvious defect detection results includes: Extracting a lens area image from the process image based on the outer contour fitting ellipse, and performing cross-calculation between the lens area image and the carrier small bowl area BlisterROI to obtain an intersection image C21Img; when the number of pixel points in the intersection image C21Img is greater than a preset edge parameter threshold, determining that the lens has a patch defect; Count the feature image C1fea i,j The number of contours in the feature image C1fea i,j When the number of contours in is not the preset number, it is determined that the lens has large-size edge defects; Extracting the major axis and minor axis of the outer contour fitting ellipse, and calculating the difference between the major axis and the minor axis, and the ratio of the major axis to the minor axis; when the difference between the major axis and the minor axis is greater than or equal to a set threshold of the difference between the major and minor axes, or when the ratio of the major axis to the minor axis is less than a preset threshold of the lens aspect ratio, determining that the lens has a deformation defect; The feature image C1fea is obtained based on the ellipse center and the assumed radius of the outer contour fitting ellipse. i,j Perform polar coordinate expansion, and perform abnormal point detection on the characteristic image in the polar coordinates, and when the abnormal point satisfies the multi-piece feature, determine that the lens has multiple defects, wherein the assumed radius is the average value of the major axis and the minor axis of the outer contour fitting ellipse; The major axis and the minor axis of the outer contour fitting ellipse are extracted, and the average values ​​of the major axis and the minor axis are calculated, and the average value is compared with a preset diameter setting threshold range, and when the average value is not within the preset diameter setting threshold range, it is determined that the lens has a size defect.

4. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 2, characterized in that: Extracting defect features from the contact lens image based on the lens profile to obtain surface defect features includes: Divide the contact lens image into surface areas based on the lens contour to obtain a printed area, a central optical area, and a peripheral transparent area of ​​the contact lens; and perform surface bubble detection on the contact lens image based on the lens contour to obtain surface bubble features; Constructing an effective detection area based on a central optical area and a peripheral transparent area, and extracting initial surface defect features of the effective detection area; Extracting feature information of the surface defect feature, wherein the feature information includes geometric information and grayscale information; Based on the feature information of the surface bubble feature and the surface defect feature, the defects caused by water bubbles are filtered to obtain the surface defect feature.

5. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 4, characterized in that: The contact lens image is divided into surface areas based on the lens contour to obtain a printed area, a central optical area and a peripheral transparent area of ​​the contact lens, including: Determining whether the bright field image is a transparent film based on preset parameters; If not, downsampling and sharpening the bright field image to obtain a downsampled image; Binarizing and morphologically processing the downsampled image to obtain a downsampled contour image; Screening the contours in the downsampled contour image based on a pre-configured empirical area threshold to obtain an inner contour of the printing area and an outer contour of the printing area; Fitting the inner contour of the printing area and the outer contour of the printing area respectively to obtain printing area features, wherein the printing area features include an inner ellipse of the printing area, an outer ellipse of the printing area, and a printing area image; Multiplying the pre-configured central optical zone ratio by the outer contour fitting ellipse to obtain a scaled ellipse contour; drawing a first contour image based on the scaled ellipse contour, and drawing a second contour image based on the printed area inner ellipse; Performing an AND operation on the first contour image and the second contour image to obtain central optical zone features, wherein the central optical zone features include a central optical zone fitting ellipse and an optical zone image of interest; A global image of the lens is drawn based on the outer contour fitting ellipse, the outer contour of the printed area is used in the global image to draw the peripheral transparent area contour of the lens, and the peripheral transparent area contour of the lens is fitted to obtain a peripheral transparent area ellipse and a peripheral transparent area image.

6. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 5, characterized in that: Performing surface bubble detection on the contact lens image based on the lens profile to obtain surface bubble features includes: Extracting the lens surface area in the bright field image based on the major axis, the minor axis and the center of the outer contour fitting ellipse; Sequentially filtering, morphologically processing, and binarizing the bright field image to obtain a bright field binary image; Extracting surface features in the bright field binary image based on the lens edge region; Extract edge features in the bright field binary image that meet the bubble features to obtain a surface bubble defect detection result, wherein the bubble features include the roundness of the bubble feature being greater than a preset roundness threshold, the length and width of the bubble feature being greater than a preset bubble length-to-width ratio threshold, and the grayscale of the bubble feature being less than a preset bubble grayscale threshold; The contour of the bubble feature is reconstructed to obtain an edge bubble feature.

7. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 4, characterized in that: Based on the feature information of the surface bubble feature and the surface defect feature, the defects caused by the bubbles are filtered to obtain the surface defect feature, including: Calculating the minimum area rectangle of the surface defect feature; Extracting the center of the minimum area rectangle and the center of the surface bubble feature; It is determined whether there is a target surface defect feature whose center of the minimum area rectangle and the center of the surface bubble feature are less than a set value. If so, the target surface defect feature is deleted to obtain a surface defect feature.

8. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 7, characterized in that: Performing defect analysis on the surface defect features based on pre-built analysis parameters to obtain defect detection results, including: Calculating the geometric information and grayscale information of the surface defect feature, wherein the geometric information includes the area of ​​the contour, the length of the minimum circumscribed rectangle, the aspect ratio of the minimum circumscribed rectangle, the contour roundness and the contour rectangularity, and the grayscale information includes the average grayscale value, grayscale variance, gradient, maximum grayscale, minimum grayscale and central grayscale value; A determination condition matching the surface defect feature is selected, and defect analysis is performed on the surface defect feature based on the geometric information and grayscale information of the surface defect feature and the determination condition of the surface defect feature to obtain a defect detection result.

9. The method for detecting surface defects of contact lenses based on cloud-machine vision according to claim 8, characterized in that: Also includes: sending the defect detection result to a target object; When modification information from the target object is received, the analysis parameters are adjusted based on the modification information, and the adjusted analysis parameters are saved, wherein the modification information is generated based on the defect detection result.

10. A contact lens surface defect DR detection device based on cloud-machine vision, characterized in that: include: An acquisition module acquires a contact lens image and pre-processes the contact lens image to obtain a process image, wherein the contact lens image is obtained by photographing a contact lens placed in a carrier, and the contact lens image is a bright field image, a dark field image, or a point light source image; A judgment module, which performs vehicle judgment from the process image based on a fixed threshold binarization method and a morphological method; A contour and obvious defect extraction module, if there is a carrier in the process image, performs contour extraction on the process image, and extracts the lens contour from the contour of the process image based on pre-built screening parameters; and performs obvious defect detection based on the lens contour to obtain an obvious defect detection result; A defect feature extraction module extracts defect features from the contact lens image based on the lens profile to obtain surface defect features; The defect analysis module performs defect analysis on the surface defect features based on pre-built analysis parameters to obtain defect detection results, wherein the adjustment method of the analysis parameters is dynamic adjustment.

Citation Information

Patent Citations

  • Automatic optical detection system and contact lens surface flaw detection method thereof

    CN113390897A

Cited By

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

    CN120851911A

  • Tracking and traceability system based on intelligent production line for contact lenses

    CN120851911B