High-precision multi-light-field contact lens edge defect detection method and device based on cloud-machine vision

Through the multi-light field technology based on cloud-machine vision, high-precision detection of edge defects of contact lenses is achieved, and the problems of low manual detection efficiency and high cost in the existing technology are solved, and detection accuracy and production efficiency are improved.

CN119399232AInactive Publication Date: 2025-02-07SIGMA SQUARES (BEIJING) TECH CO LTD

Patent Information

Application Number
CN202411479387.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, the detection of the edges of contact lenses mainly relies on manual labor, resulting in frequent false detection and missed detection, low efficiency and high cost.

Method used

Using a high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision, pre-processing, glass bowl detection, contour feature extraction and edges are performed by obtaining the original multi-light field image of contact lenses immersed in water in glass bowls. Defect detection to achieve automated identification.

Benefits of technology

It improves the accuracy and efficiency of edge defect detection of contact lenses, reduces the cost of manual inspection, and improves the yield rate of production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399232A_ABST
    Figure CN119399232A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud and machine vision, in particular to a high-precision multi-light-field contact lens edge defect detection method and device based on cloud-machine vision, and the method comprises the steps: obtaining a multi-light-field original image of a printed contact lens soaked in water of a glass bowl, and carrying out the preprocessing of the multi-light-field original image, obtaining a bright field image, a dark field image and a preprocessed image; performing glass bowl detection on the preprocessed image, and extracting geometric features of the glass bowl; contour feature extraction is performed on the printed contact lenses in the glass bowl area based on the geometric features of the glass bowl; and then based on the extracted images and features, executing rough detection and edge defect detection under a Cartesian coordinate system and a polar coordinate system. The contact lens image acquired by the high-resolution camera is further utilized, the image is automatically identified, and whether the corresponding product is normal or not is judged, so that the purposes of reducing the labor cost, saving the time and improving the production yield are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud and machine vision technology, and in particular to a high-precision multi-light field contact lens edge defect detection method and device based on cloud-machine vision. Background Art

[0002] The main manufacturing methods of contact lenses include turning, casting, etc. Due to the different lens materials, various types of defects are prone to occur during the production process, such as lens edge adhesion, deformation, multiple lenses, abnormal size, etc.

[0003] In the prior art, manual inspection is generally used to detect the edges of printed contact lenses. Manual inspection is prone to various misdetections and omissions, and has high efficiency and low cost. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a high-precision multi-light field contact lens edge defect 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 high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision of the present invention comprises the steps of:

[0007] Acquire a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and pre-process the multi-light field original image to obtain a point light source image, a bright field image, a dark field image, and a pre-processed image, wherein the pre-processed image is obtained by filtering the bright field image;

[0008] Performing glass bowl detection on the preprocessed image, and extracting geometric features of the glass bowl when the glass bowl exists in the preprocessed image; performing contour feature extraction on the printed contact lens in the glass bowl area based on the geometric features of the glass bowl;

[0009] The printed contact lenses are roughly inspected based on the contour features of the printed contact lenses to obtain a rough inspection result; edge bubble detection is performed on the printed contact lenses based on the contour features of the printed contact lenses, the bright field image, the dark field image and the preprocessed image to obtain an edge bubble template image; in a Cartesian coordinate system and a polar coordinate system, edge defect detection is performed on the printed contact lenses based on the contour features of the printed contact lenses, the bright field image, the dark field image and the edge bubble template image to obtain an edge defect detection result.

[0010] The present application also provides a high-precision multi-light field contact lens edge defect detection device based on cloud-machine vision, comprising:

[0011] An acquisition and preprocessing module, used for acquiring a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and preprocessing the multi-light field original image to obtain a point light source image, a bright field image, a dark field image, and a preprocessed image, wherein the preprocessed image is obtained by filtering the bright field image;

[0012] A feature extraction module, used to detect a glass bowl in the preprocessed image, and extract geometric features of the glass bowl when the glass bowl exists in the preprocessed image; and extract contour features of the printed contact lens in the glass bowl area based on the geometric features of the glass bowl;

[0013] The defect detection module is used to perform a rough inspection on the printed contact lens based on the contour features of the printed contact lens to obtain a rough inspection result; perform edge bubble detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the preprocessed image to obtain an edge bubble template image; and perform edge defect detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the edge bubble template image in a Cartesian coordinate system and a polar coordinate system, respectively, to obtain an edge defect detection result.

[0014] The beneficial effects of the present invention are as follows: a high-precision multi-light field contact lens edge defect detection method and device based on cloud-machine vision of the present invention obtains a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and pre-processes the multi-light field original image to obtain a bright field image, a dark field image, and a pre-processed image; performs glass bowl detection on the pre-processed image, and extracts the geometric features of the glass bowl when there is a glass bowl in the pre-processed image; extracts contour features of the printed contact lens in the glass bowl area based on the geometric features of the glass bowl; and then performs rough inspection, Cartesian coordinate system, and polar coordinate system edge defect detection based on the above-mentioned extracted images and features. The present application further utilizes the contact lens images captured by a high-resolution camera, performs automatic identification on the image, and determines whether the corresponding product is normal or not, so as to reduce labor costs, save time, and improve production yield. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0016] Figure 1 This is a topological diagram of the technical solution in this application;

[0017] Figure 2 This is a schematic diagram of the computing algorithm in the cloud service of this application;

[0018] Figure 3This is a schematic diagram of the parameter configuration process in the implementation of this application;

[0019] Figure 4 is a flow chart of a high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision shown in one embodiment of the present application;

[0020] Figure 5 This is a schematic diagram of the preprocessing process in one embodiment of the present application;

[0021] Figure 6 This is a schematic diagram of the process of glass bowl detection in one embodiment of the present application;

[0022] Figure 7 A schematic diagram of the process of extracting the edge profile of the lens in this application;

[0023] Figure 8 It is a schematic diagram of the process of obvious defects of the lens in this application;

[0024] Fig. 9 A schematic diagram of the process of edge bubble detection in this application;

[0025] Fig.10 This is a schematic diagram of the process of lens lace detection in this application;

[0026] Fig.11 A schematic diagram of the process of detecting severe defects on the edge of a lens in this application;

[0027] Fig.12 This is a schematic diagram of the process of lens edge tear detection in this application;

[0028] Fig.13 This is a schematic diagram of the process of detecting excess material at the edge of a lens in this application;

[0029] Fig.14 This is a schematic diagram of the generation process of the polar coordinate data set in this application;

[0030] Fig.15 A schematic diagram of the process of detecting slight defects on the edge of a lens in this application;

[0031] Fig.16 This is a schematic diagram of the process of detecting slight defects on the edge of a lens based on bright field images in this application;

[0032] Fig.17 This is a schematic diagram of the process of detecting residual material at the edge of a lens based on bright field images in this application;

[0033] Fig.18 Schematic diagram of the process of edge roughness detection based on multi-light field images in this application. DETAILED DESCRIPTION

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

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

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

[0037] Figure 1 This is the topological diagram of the technical solution in this application, such as Figure 1 As shown, in this application, the printed contact lens product is photographed by an industrial camera to obtain a corresponding grayscale image; the image is transmitted to an industrial computer and forwarded to a cloud server via the industrial computer for defect detection; the product inspection result is obtained and pushed to the industrial computer and the subsequent data processing center.

[0038] Figure 2 This is a schematic diagram of the computing algorithm in the cloud service of this application, such as Figure 2 As shown, the algorithm of this application is mainly composed of 6 modules, including:

[0039] A. Initialization configuration module: responsible for initializing the configuration of the detection system, and reading, loading, color space conversion, noise reduction and other operations on the contact lens images collected by the camera to reduce the interference caused by environmental noise, and finally generate the Process Image;

[0040] B. Glass bowl detection module: responsible for extracting the small bowl ROI and determining the size of the small bowl.

[0041] C. Lens rough inspection module: responsible for using edge extraction algorithm on process image to extract lens edge contour and detect obvious defects of lens, including lens edge adhesion, deformation, multiple lenses, size abnormality, etc.

[0042] D. Lens edge detection module: responsible for three functions, namely edge bubble extraction, edge defect detection in Cartesian coordinate system and edge defect detection in polar coordinate system;

[0043] E. Result analysis and generation module: Integrate the results in modules B to D to obtain the final lens test results.

[0044] F. Output module: Package and output the results in step E.

[0045] Before conducting formal testing, this application needs to load relevant configuration parameters. Figure 3 This is a schematic diagram of the parameter configuration process in the implementation of this application. Figure 3 As shown in the figure, the parameter configuration process includes:

[0046] A1. The initialization configuration process is as follows.

[0047] A11. Import the configuration table file. This parameter configuration file contains lens system parameters, light source configuration parameters, algorithm configuration parameters, system setting parameters, etc. Among them, load the system configuration parameters to set whether to enable the surface detection module and whether to output images; load the algorithm parameters, including extraction parameters and analysis parameters, etc. The details are as follows:

[0048] For module B: small bowl area BlisterArea; effective small bowl radius (BlisterRL, BlisterRU), the former is the lower bound and the latter is the upper bound;

[0049] For module C: lens edge determination threshold T touch , the major and minor axis difference judgment threshold T abdif , lens aspect ratio threshold T edge_asp , lens size diameter setting threshold range LensDiaRange;

[0050] For module D: Lace threshold T flower , polar coordinate sampling angle deg, minimum edge detection size EMinL, minimum bright field edge detection grayscale BEMinG, minimum dark field edge detection grayscale DEMinG, minimum point light source edge detection grayscale PEMinG;

[0051] For module E: defect priority configuration table Priority;

[0052] Read and load the light source configuration parameters and verify them, load the light source parameters used by the system, and compare the parameters with the industrial computer light source system. If the light source settings are inconsistent, return the corresponding error code and exit the system, otherwise enter A14.

[0053] Initialize the image object related data structure used by the algorithm. In this embodiment, it includes the following:

[0054] Input image group, ImagePacket;

[0055] Apply the image group, LensImageGroup;

[0056] Polar coordinate image group, LwnsPolarImageGroup;

[0057] Defect data group, Set;

[0058] Initialize the relevant result objects used by the algorithm. This embodiment includes the following:

[0059] Step B, glass bowl detection result, BlisterResult;

[0060] Step C, edge extraction result, LensEdgeExtRes;

[0061] Step C, lens rough inspection result, LensRoughRes;

[0062] Step D, lens edge detection result, LensEdgeRes;

[0063] Step E, detecting the final result, LensResult;

[0064] A12, read and load the light source configuration parameters and verify, load the light source parameters used by the system, and compare the parameters with the industrial computer light source system. If the light source settings are inconsistent, return the corresponding error code and exit the system, otherwise enter A14.

[0065] A13. Initialize the image object related data structure used by the algorithm. In this embodiment, the following is included:

[0066] Input image group, ImagePacket;

[0067] Apply the image group, LensImageGroup;

[0068] Polar coordinate image group, LensPolarImageGroup;

[0069] Defect data group, Set;

[0070] A14. Initialize the relevant result objects used by the algorithm. In this embodiment, the following is included:

[0071] Step B, glass bowl test result, BlisterResult

[0072] Step C, edge extraction result, LensEdgeExtRes;

[0073] Step C, lens rough inspection results, LensRoughRes

[0074] Step D, lens edge detection result, LensEdgeRes

[0075] Step E: Detect the final result, LensResult

[0076] Figure 4 is a flow chart of a high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision shown in an embodiment of the present application, such as Figure 4 As shown in the figure, a high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision in this embodiment may include the following steps:

[0077] S410, acquiring a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and preprocessing the multi-light field original image to obtain a point light source image, a bright field image, a dark field image, and a preprocessed image, wherein the preprocessed image is obtained by filtering the bright field image;

[0078] Figure 5 Schematic diagram of the preprocessing process in one embodiment of the present application. Figure 5 As shown, the process of preprocessing the multi-light field original image in the present application includes:

[0079] A2, pre-processing:

[0080] A21 reads the image data transmitted by the camera, divides the image data according to the multi-light field settings of bright field, dark field, and point light source, that is, the multi-light field original image, converts the image data from RAW to RGB format, and temporarily stores it in ImagePacket.

[0081] A22, transforms all light field image data in ImagePackett in A21 into grayscale space, obtains grayscale images and stores them in the corresponding array in LensImageGroup, specifically including bright field image BrightImage, dark field image DarkImage, and point light source image.

[0082] A23 performs Gaussian filtering with a kernel of 3×3 and normalization stretching processing on the bright field image BrightImage in the LensImageGroup in A22 to obtain a denoised preprocessed image ProcessImage, the purpose of which is to reduce the interference caused by environmental noise.

[0083] S420, performing glass bowl detection on the preprocessed image, and extracting geometric features of the glass bowl when the glass bowl exists in the preprocessed image; and extracting contour features of the printed contact lens in the glass bowl area based on the geometric features of the glass bowl;

[0084] Figure 6 FIG. 1 is a flow chart of glass bowl detection in an embodiment of the present application. Figure 6 As shown, the glass bowl test includes:

[0085] B. Glass bowl detection module: It is responsible for applying the segmentation algorithm to the preprocessed image ProcessImage and determining whether there is a glass bowl and whether the size is consistent based on the extracted relevant pixel content. Specifically, it includes:

[0086] B1, load the pre-processed image ProcessImage obtained in A23, the effective small bowl radius (BlisterRL, BlisterRU) and the glass bowl area BlisterArea configured in A11;

[0087] B2, binarizing the preprocessed image and extracting the contour features of the glass bowl in the binarized preprocessed image; applying a segmentation algorithm to the preprocessed image ProcessImage in B1 to perform binarization segmentation and extract the corresponding region of interest ROI;

[0088] B3. Fit the minimum inscribed circle of the glass bowl contour whose area is larger than the pre-configured glass bowl area BlisterArea to obtain the radius R and center C of the minimum inscribed circle. First, filter the contours extracted in B2 in turn by area. If it is larger than BlisterArea in B1, fit the minimum inscribed circle to the contour and obtain the radius R and center C of the circle, and then proceed to B4. If none of them are satisfied, end.

[0089] B4. Compare the radius R of the minimum inscribed circle with a preconfigured radius range (BlisterRL, BlisterRU), and when the radius of the minimum inscribed circle falls within the preconfigured radius range, determine that a glass bowl exists in the preprocessed image, and use the radius and center of the minimum inscribed circle as geometric features of the glass bowl.

[0090] Specifically, the radius R obtained in B3 is judged using (BlisterRL, BlisterRU) in B1. If R is not within the range, the result item in the glass bowl detection result BlisterResult is assigned "No Blister"; otherwise, it is considered that this module has passed and BlisterResult is assigned "Pass" and enters B5. The expression is as follows:

[0091]

[0092] B5. Store the radius R and center C obtained in B3 in BlisterResult.

[0093] S430, performing a rough inspection on the printed contact lens based on the contour features of the printed contact lens to obtain a rough inspection result; performing edge bubble detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the preprocessed image to obtain an edge bubble template image; performing edge defect detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the edge bubble template image in a Cartesian coordinate system and a polar coordinate system, respectively, to obtain an edge defect detection result.

[0094] Finally, detection is performed based on the various features extracted above. The detection content is as follows:

[0095] C. Lens rough inspection, responsible for: extraction of lens edge contour and detection of obvious lens defects, including lens edge adhesion, deformation, multiple lenses, abnormal size, etc., including:

[0096] C1. Contour extraction, Figure 7 The schematic diagram of the process of extracting the edge profile of the lens in this application is as follows: Figure 7 As shown, including:

[0097] C11, filtering and binarizing the preprocessed image to obtain a binary image C1a; specifically, performing two low-pass filtering processes on the preprocessed image ProcessImage generated by A, wherein the first filtering kernel size is 5×5, and the second filtering kernel size is a Gaussian kernel of 3×3, to obtain a filtered image Filtered; then performing an adaptive algorithm on the filtered image Filtered to obtain a binary image C1a;

[0098] C12. Constructing a glass bowl region BlisterROI based on the geometric features of the glass bowl; specifically, constructing a small bowl ROI, BlisterROI, using the small bowl fitting circle information (radius R and center C) stored in BlisterResult in B;

[0099] C13, constructing a first feature image C1fea based on the glass bowl region BlisterROI and the binary image C1a, wherein the mathematical expression of the first feature image C1fea is:

[0100]

[0101] Where, C1fea i,jis the pixel with coordinates (i, j) in the first feature image C1fea, C1a i,j is the pixel with coordinates (i, j) in the binary image C1a, BlisterROI i,j is the pixel with coordinates (i, j) in the glass bowl region BlisterROI;

[0102] C14, extracting the contour features in the first feature image C1fea, and extracting the inner contour inner and the outer contour outer of the printed contact lens based on the pre-constructed lens parameters, wherein the lens parameters include the major and minor axis difference determination threshold T abdif , lens aspect ratio threshold T edge_asp , the lens size diameter sets the threshold interval LensDiaRange; fit the outer contour of the printed contact lens to obtain the ellipse contour ellipse. And save it to the data structure corresponding to LensEdgeExtRes, enter C15; if both the inner and outer contours do not exist, it is considered that there is no lens, and the result item in LensEdgeExtRes is assigned the value "NoLens" and exit;

[0103] C15, verify and integrate the internal and external contours saved in C14, and supplement the relevant data in LensEdgeExtRes, including the effective ROI area BlisterROI, the lens edge fitting ellipse ellipse, the number of detected contours edge_num, the edge feature data C1fea, etc.;

[0104] C2, lens obvious defect detection, Figure 8 It is a schematic diagram of the process of obvious defects of the lens in this application, such as Figure 8 As shown, including:

[0105] C21, using BlisterROI and ellipse integrated by LensEdgeExtRes in C15 to judge the edge of the lens. It includes generating a lens area image based on the ellipse outline ellipse, and extracting the intersection image C21Img of the glass bowl area BlisterROI and the lens area image by "and" operation. When the number of pixels in the intersection image C21Img is greater than a preset number threshold, it is determined that there is a lens edge defect;

[0106] If the number of pixel values ​​at the intersection is greater than the lens edge parameter threshold T in A12 touch , then the lens is considered to be touching the edge, the result item in LensRoughRes is assigned the value of "Touch" and exit, otherwise the next step, the expression is as follows;

[0107]

[0108] C22. When the printed contact lens only has an outer contour, it is determined that the lens has a large-scale edge defect;

[0109] Use edge_num in C15 to identify large-scale defects in the lens. If edge_num is not 2, that is, only the outer edge exists but not the inner edge, the lens is considered to have large-scale edge defects, and the result item in LensRoughRes is assigned the value "EdgeDefect" and exits. Otherwise, the next step is as follows:

[0110]

[0111] C23, extracting the major axis a and the minor axis b of the ellipse profile ellipse, calculating the difference between the major axis a and the minor axis b, and calculating the aspect ratio of the major axis a and the minor axis b; when the difference is greater than a preset major-minor axis difference threshold, or when the aspect ratio is less than a preset aspect ratio threshold, determining that the lens has a deformation defect;

[0112] The lens deformation is judged by using the major axis a and minor axis b in the ellipse in C15. If the difference between the major axis and the minor axis is greater than the difference between the major axis and the minor axis in A13, the threshold T is set. abdif , the lens is considered deformed; in addition, the aspect ratio of a and b is checked. If the aspect ratio is less than the preset lens aspect ratio threshold T edge_asp , the lens is considered deformed. If the lens is deformed, the result item in LensRoughRes is assigned the value "Distort" and exits, otherwise the next step is as follows:

[0113]

[0114] C24, extracting the ellipse center and assumed radius r of the ellipse outline, wherein the assumed radius Based on the ellipse center and the assumed radius r, the contour features in the first feature image Clfea are expanded in polar coordinates, and the average value and variance of the polar diameters of all contour pixel points in the polar coordinates are calculated, and a filtering range based on the 3sigma principle is constructed based on the average value and variance of the polar diameters, and contour points that do not fall into the filtering range are regarded as abnormal points. When the number of abnormal points is greater than a preset multiple-piece determination number threshold, it is determined that the lens has multiple defects;

[0115] Use C1fea and ellipse in C15 to detect whether the lens is "multiple". For C1fea, use the center of the ellipse EC in ellipse and the assumed radius of the major and minor axes. Polar coordinates are expanded, and the "multi-piece" detection is performed using an outlier detection algorithm based on mathematical statistics. That is, the mean and variance of the polar diameters of all contour pixels in polar coordinates are used to construct a filtering range based on the 3sigma principle. Contour points that do not fall into the filtering range are regarded as outliers. When the number of outliers is greater than the preset multi-piece judgment threshold, it is considered to meet the "multi-piece" feature. The result item in LensRoughRes is assigned to "MutilLens" and exits. Otherwise, the next step is expressed as follows:

[0116]

[0117] C25, extract the major axis a and minor axis b of the ellipse, and use the major axis a and minor axis b in ellipse in C15 to determine the lens size. Calculate the mean d=mean(a,b) of the major axis a and the minor axis b, consider d as the lens diameter, and compare the mean d of the major axis a and the minor axis b with the preset lens size diameter setting threshold interval LensDiaRange. When the mean of the major axis a and the minor axis b is not within the preset lens size diameter setting threshold interval LensDiaRange, it is determined that the lens has a size non-compliant defect. If it is not within this size range, it is considered that the size does not match, and the result item in LensRoughRes is assigned to "Offsize" and exit, otherwise the next step, the expression is as follows:

[0118]

[0119] D. Lens edge detection module: responsible for using the edge extraction algorithm on the pre-processed image ProcessImage generated by A. It is mainly responsible for three functions, namely edge bubble extraction, edge defect detection in Cartesian coordinate system, and edge defect detection in polar coordinate system.

[0120] D1. Edge bubble detection, Fig. 9 Schematic diagram of the process of edge bubble detection in this application, such as Fig. 9 As shown, including:

[0121] D11, extracting the lens edge region of the bright field image based on the ellipse outline ellipse; specifically, constructing the lens edge region D1ROI by combining the ellipse information in LebsEdgeExtRes in C15 and the bright field image BrightImage in LensImageGroup, using parameters of the major axis a, the minor axis b, and the ellipse center EC;

[0122] D12, sequentially filtering, morphologically processing and binarizing the bright field image to obtain a bright field binary image D1bin;

[0123] D13, extracting edge features D1feature in the bright field binary image based on the edge area of ​​the lens;

[0124] D14, extract edge features in the bright field binary image that meet the bubble features, and obtain edge bubble defect detection results. Specifically, it is necessary to combine the bright field image data BrightImage in LensImageGroup and the dark field image data DarkImage to perform feature analysis and filtering on the edge feature d1feature, and store the features that meet the edge bubble in D1EB. The bubble features include the roundness of the edge being greater than the preset roundness threshold, the length and width of the edge being greater than the preset bubble aspect ratio threshold, and the grayscale of the contour being less than the preset bubble grayscale threshold;

[0125] D15, reconstructing the outline of the bubble feature to obtain an edge bubble template image. Finally, using D1EB in D14 to reconstruct the edge bubble template image EdgeBubble in LensImageGroup, generating a corresponding edge bubble template image WdgeBubble.

[0126] D2. Defect detection based on Cartesian coordinates:

[0127] D21, Lens edge detection based on profile statistics, Fig.10 The flowchart of the lens edge detection in this application is shown in FIG. Fig.10 As shown, including:

[0128] D211, use the convex hull extraction algorithm for the inner contour and outer contour of the printed contact lens to obtain the inner contour convex hull vertex inner_pt and the outer contour convex hull vertex outter_p;

[0129] D212, calculating the Euclidean distance between the vertices of the inner contour convex hull and the vertices of the outer contour convex hull one by one, and when the Euclidean distance is greater than a preset lace threshold, determining that the printed contact lens has a lace defect and storing the lace position;

[0130] Specifically, inner_pt and outer_pt are looped, and the Euclidean distance between them is judged. If the lace threshold T in A11 is met, flower , consider this point as the location of the "lace" and store it in Set;

[0131] D22, severe defect detection of lens edge, Fig.11 The schematic diagram of the process of detecting severe defects on the edge of the lens in this application is as follows: Fig.11 As shown, including:

[0132] D221, use the convex hull extraction algorithm for the inner contour inner stored in LensEdgeExtRes in C15 to obtain the inner contour convex hull image inner_hull;

[0133] D221, performing morphological processing on the inner contour convex hull image inner_hull to obtain an inner edge image inner_edg; performing a difference operation on the inner edge image inner_edg and the outer contour outter to obtain a first severe edge feature D22feature;

[0134] D223. Extract the minimum circumscribed rectangle of the first serious edge feature D22feature, and when the length of the minimum circumscribed rectangle of the first serious edge feature D22feature is greater than the preset minimum edge detection size, determine that the printed contact lens has serious defects on the lens edge; if satisfied, store to Set; otherwise, next one.

[0135] D23, lens edge tear detection, Fig.12 The schematic diagram of the process of detecting the tear at the edge of the lens in this application is as follows: Fig.12 As shown, including:

[0136] D231, use the convex hull extraction algorithm for the inner contour inner stored in LensEdgeExtRes in C15 to obtain the inner contour convex hull image inner_hull;

[0137] D232, performing morphological processing on the inner contour convex hull image inner_hull to obtain an inner edge image inner_edg;

[0138] D233, performing a median filter of size 3 on the inner edge image to obtain a median filter image to eliminate noise; and performing bubble interference elimination on the median filter image based on the edge bubble template image edgeBubble to obtain a second severe edge feature D23feature;

[0139] When removing bubble interference, the features in the edge bubble template image EdgeBubble in the median filter image can be removed. The same is true for the bubble interference removal in the following text.

[0140] D234. Extract the geometric features of the second severe edge feature D23feature, wherein the geometric features of the second severe edge feature D23feature include length, width, aspect ratio, roundness, convexity, sharpness, and rectangularity. When the geometric features of the second severe edge feature meet a preset edge tearing condition, it is determined that the printed contact lens has an edge tearing defect; if the edge tearing condition is met, store the corresponding minimum circumscribed rectangle in Set, otherwise discard it.

[0141] The edge tearing conditions include:

[0142]

[0143] This means that for the feature image to be judged, its following geometric features satisfy:

[0144] The length is greater than the preset minimum tear detection length Min_spL;

[0145] The width width is greater than the preset minimum tear detection width Min_spW;

[0146] The aspect ratio aspect is within the preset aspect ratio tear detection interval (Min_spASP, Max_spASP), where Min_spASP is the lower limit of the aspect ratio tear detection interval and Max_spASP is the upper limit of the aspect ratio tear detection interval;

[0147] The roundness is within the preset roundness tear detection interval (Min_spRD, Max_spRD), where Min_spRD is the lower limit of the roundness tear detection interval and Max_spRD is the upper limit of the roundness tear detection interval;

[0148] The density convexity is within the preset density tear detection interval (Min_spConv, Max_spConv), where Min_spConv is the lower limit of the density tear detection interval and Max_spConv is the upper limit of the density tear detection interval;

[0149] The sharpness is within the preset sharpness tear detection interval (Min_spsharp, Max_spsharp), Min_spsharp is the lower limit of the sharpness tear detection interval, and Max_spsharp is the upper limit of the sharpness tear detection interval;

[0150] The rectangularity is within the preset rectangularity tear detection interval (Min_spRL, Max_spRL), Min_spRL is the lower limit value of the rectangularity tear detection interval, and Max_spRL is the upper limit value of the rectangularity tear detection interval.

[0151] D24, lens edge residual material detection, Fig.13 The schematic diagram of the process of detecting residual material at the edge of the lens in this application is as follows: Fig.13 As shown, including:

[0152] D241, fitting the outer contour outter of the printed contact lens to obtain the outer contour ellipse outter_ellipse;

[0153] D242, calculate the Euclidean distance dis between the center D24EC (x, y) of the outer contour ellipse and all points of the outer contour i and angle i , where the Euclidean distance dis and the angle angle i The mathematical expression is:

[0154]

[0155] In the formula, (i≤n), where (p ix ,p iy ) is the coordinate of each outer contour point, n is the length of the outer contour point, and finally the arrays dis and angle are obtained;

[0156] dis=(dis1,dis2,…,dis i )

[0157] angle=(angle1,angle2,…,angle i )

[0158] D243, Euclidean distance dis based on all points i and angle i Generate a Euclidean distance set dis and an angle set angle, perform normalization filtering and smoothing processing on the Euclidean distance set and the angle set, and generate a normalized, filtered and smoothed Euclidean distance set norm_dis;

[0159] D244, Euclidean distance set norm_dis and angle set angle based on normalized filtering and smoothing i Generate outer contour image fit img ;

[0160] D245, fitting the outer contour image based on the edge bubble template image EdgeBubble img Eliminate bubbles to obtain a second feature image D24feature;

[0161] D246, extracting contour features from the second feature image, the contour features including length', width', aspect', roundness', convexity', sharpness', and rectangularity'. When the contour features of the second feature image meet the preset edge residual material condition, it is determined that the printed contact lens has residual material defects. If the edge residual material condition is met, the corresponding minimum circumscribed rectangle is stored in Set, otherwise it is discarded.

[0162] Residue defects refer to defects such as burrs and curling that occur on the edges of contact lenses when they are cut.

[0163] Among them, the edge material defect conditions include:

[0164]

[0165] This means that for the feature image to be judged, its following geometric features satisfy:

[0166] The length length′ is greater than the preset minimum residual material detection length Min_flL;

[0167] The width width′ is greater than the preset minimum residual material detection width Min_flW;

[0168] The aspect ratio aspect′ is within the preset aspect ratio residual material detection interval (Min_flASP, Max_flASP), where Min_flASP is the lower limit value of the aspect ratio residual material detection interval, and Max_flASP is the upper limit value of the aspect ratio residual material detection interval;

[0169] The roundness' is within the preset roundness residual material detection interval (Min_flRD, Max_flRD), where Min_flRD is the lower limit of the roundness residual material detection interval and Max_flRD is the upper limit of the roundness residual material detection interval;

[0170] The density convexity′ is within the preset density residual material detection interval (Min_flConv, Max_flConv), where Min_flConv is the lower limit of the density residual material detection interval, and Max_flConv is the upper limit of the density residual material detection interval;

[0171] The sharpness' is within the preset sharpness residual material detection interval (Min_flsharp, Max_flsharp), Min_flsharp is the lower limit value of the sharpness residual material detection interval, and Max_flsharp is the upper limit value of the sharpness residual material detection interval;

[0172] The rectangularity' is within a preset rectangularity residual material detection interval (Min_flRL, Max_flRL), where Min_flRL is the lower limit value of the rectangularity residual material detection interval, and Max_flRL is the upper limit value of the rectangularity residual material detection interval.

[0173] D3, defect detection based on polar coordinates;

[0174] D31, generation of polar coordinate data set, Fig.14 The schematic diagram of the generation process of the polar coordinate data set in this application is as follows: Fig.14 As shown, including:

[0175] D311. Perform secondary construction on the ellipse outline stored in LensEdgeExtRes in C16 to obtain the corresponding circle data, where the center of the circle is the ellipse center EC and the radius is Extract the ellipse center and radius of the ellipse outline ellipse;

[0176] D312, based on the center and radius of the ellipse, the point light source image, the bright field image, the dark field image, the inner contour of the printed contact lens and the outer contour of the printed contact lens are converted into polar coordinates to obtain a point light source polar coordinate image, a bright field polar coordinate image LensPolarImageGroup.bright, a dark field polar coordinate image LensPolarImageGroup.dark, an inner contour polar coordinate image LensPolarImageGroup.inner and an outer contour polar coordinate image LensPolarImageGroup.outter;

[0177] Specifically, combined with EC and r in D331 and the polar coordinate sampling angle deg=0.2 configured in A11, the outer contour image, inner contour image, bright field, dark field, point light source image, etc. in LensImageGroup are transformed into polar coordinates. The corresponding image space coordinate system and polar coordinate system conversion is specifically to perform radial scanning with EC as the center point. In the polar coordinate system, the horizontal axis is the polar angle and the vertical axis is the polar diameter. The transformation formula is: The number of samples is The interpolation method is nearest neighbor interpolation. In specific implementation, the interpolation method can be replaced by bilinear interpolation, cubic interpolation, etc.

[0178] D313, according to the polar coordinate images generated in D332, the polar coordinate data group LensPolarImageGroup is respectively assigned corresponding values ​​and supplemented.

[0179] D32, detection of slight defects on the edge of the lens, Fig.15 The schematic diagram of the process of detecting slight defects on the edge of the lens in this application is as follows: Fig.15 As shown, including:

[0180] D321, performing morphological processing on the outer contour polar coordinate image LensPolarImageGroup.outter to obtain a processed image D321outter_image;

[0181] D322, performing difference processing on the processed image D321outter_image and the outer contour polar coordinate image LensPolarImageGroup.outter to obtain a third feature image D32feature;

[0182] D323, extracting the minimum circumscribed rectangle of the third feature image D32feature, and performing lens edge slight defect detection based on the size of the minimum circumscribed rectangle of the third feature image and a preset minimum detection size; if the preset minimum detection size is met, storing it in Set; otherwise, the next one.

[0183] D33, Detection of slight defects on the edge of the lens based on bright field images, Fig.16 This is a schematic diagram of the process of detecting slight defects on the edge of a lens based on bright field images in this application. Fig.16 As shown, including:

[0184] D331, performing morphological processing on the outer contour polar coordinate image LensPolarImageGroup.outter to obtain the edge region of interest edgeRoI, and storing it in LensPolarImageGroup;

[0185] D332, merging the edge region of interest edgeRoI with the bright field polar coordinate image LensPolarImageGroup.bright to obtain a bright field edge image bright_edge, and storing it in LensPolarImageGroup;

[0186] D333, performing mean projection on the bright field edge image to obtain one-dimensional bright field data bright_data;

[0187] D334, using an outlier search algorithm to perform outlier detection on the one-dimensional bright field data bright_data, and obtain each outlier point p i =(x i ,y i ); the outlier search algorithm includes:

[0188] Step 1: Use 3sigma check based on statistical distribution for the one-dimensional bright field data bright_data. If the number of singular points N is large enough, that is, N>Tn, go to step 2; otherwise exit;

[0189] Step 2: Calculate the variance Var for the singular point data in step 1. If the variance Var>BrVar, go to step 3; otherwise exit, where BrVar is the detection variance threshold of the defect;

[0190] Step 3: Smooth filter the one-dimensional bright field data bright_data to construct the filtered data smooth_data;

[0191] Step 4: Calculate the absolute difference between the one-dimensional bright field data bright_data and the filtered data smooth_data in step 3, mark the part where the absolute difference abs_sub>Tsub, and obtain the labeled image label;

[0192] Step 5: Perform morphological close calculation on the label, with the kernel being a rectangle and the size being k;

[0193] Step 6: Extract the contour of the label image and calculate the corresponding contour length L. If L meets the defect length threshold brL, the contour is retained and drawn, otherwise it is discarded;

[0194] Step 7: Match the retained contour with the original bright_data to obtain the corresponding data points, i.e., the outliers;

[0195] D335, converting the abnormal points into a Cartesian coordinate system, and removing the abnormal points belonging to the edge bubbles in the Cartesian coordinate system based on the edge bubble template image, to obtain a fourth feature image D33feature, removing interference belonging to the edge bubbles;

[0196] D336. Extract the minimum circumscribed rectangle of the fourth feature image, and perform a bright field image-based detection of slight defects on the edge of the lens based on the size of the minimum circumscribed rectangle of the fourth feature image and a preset minimum detection size; if the minimum detection size is met, store it in Set; otherwise, the next one.

[0197] D34, lens edge slight defect detection based on dark field image, including:

[0198] D341, performing morphological processing on the outer contour polar coordinate image to obtain an edge region of interest;

[0199] D342, merging the edge region of interest with the dark field polar coordinate image to obtain a dark field edge image;

[0200] D343, performing mean projection on the dark field edge image to obtain one-dimensional dark field data;

[0201] D344, performing outlier detection on the one-dimensional dark field data to obtain outliers; the outliers here also use the outlier search algorithm as described above, which will not be repeated here.

[0202] D345, converting the abnormal points into a Cartesian coordinate system, and removing the abnormal points belonging to the edge bubbles in the Cartesian coordinate system based on the edge bubble template image, to obtain a fifth feature image;

[0203] D346, extracting the minimum circumscribed rectangle of the fifth characteristic image, and performing a dark field image-based slight defect detection on the edge of the lens based on the size of the minimum circumscribed rectangle of the fifth characteristic image and a preset minimum detection size;

[0204] The principle is consistent with the detection of slight defects on the edge of the lens based on bright field images, so it will not be described in detail.

[0205] D35, lens edge residual material detection based on bright field image, Fig.17 Schematic diagram of the process of detecting residual material at the edge of the lens based on bright field images in this application, as shown in FIG. Fig.17 As shown, including:

[0206] D351, performing a gradient operation on the bright field edge image bright_edge in LensPolarImageGroup to obtain a bright field binary image b_canny; this embodiment uses the canny operator to perform the gradient operation.

[0207] D352, performing morphological processing on the edge region of interest edgeRoI to obtain an edge target region of interest D35edgeRoI;

[0208] D353, merging the edge target region of interest D35edgeRoI with the bright field binary image b_canny and converting them to a Cartesian coordinate system to obtain a bright field merged image; removing edge bubble interference from the bright field merged image based on an edge bubble template image to obtain a sixth feature image D35feature;

[0209] D354, extracting geometric information of each contour in the sixth characteristic image, the geometric information of the contour includes, and performing bright field residual material defect detection based on the pre-built residual material detection condition and the geometric information of each contour in the sixth characteristic image. If the residual material detection standard is met, store it in Set; otherwise, the next one.

[0210] D36, edge roughness detection based on multi-light field images, Fig.18 FIG. 1 is a flow chart of edge roughness detection based on multi-light field images in this application. Fig.18 As shown, including:

[0211] D361, performing an adaptive binarization algorithm on the bright field edge image right_edge in LensPolarImageGroup to obtain a bright field edge binarization image b_th;

[0212] D362, extracting contours of the bright field edge binary image, and screening out target contours with an aspect ratio less than a target value (0.2), and constructing an edge region of interest D36EdgeRoI based on the target contours in the bright field edge binary image;

[0213] D363, performing an adaptive binarization algorithm on the dark field edge image dark_edge in LensPolarImageGroup to obtain a dark field edge binarization image d_th;

[0214] D364, merging the dark field edge binary image d_th and the edge region of interest D36EdgeRoI and converting them into a Cartesian coordinate system to obtain a seventh feature image D36feature;

[0215] D365. Extract geometric information of each contour in the seventh feature image, the geometric information including length", width", aspect ratio", roundness", convexity", sharpness" and rectangularity", and perform edge roughness defect detection based on the pre-constructed edge roughness detection condition and the geometric information of each contour in the seventh feature image; if the edge roughness detection standard is met, store it in Set; otherwise, next one.

[0216] Among them, edge roughness detection conditions include:

[0217]

[0218] This means that for the feature image to be judged, its following geometric features satisfy:

[0219] The length "length" is greater than the preset minimum roughness detection length Min_ERL;

[0220] The width "width" is greater than the preset minimum roughness detection width Min_ERW;

[0221] "Aspect ratio" is within the preset roughness detection range of aspect ratio (Min_ERASP, Max_ERASP), Min_ERASP is the lower limit of the roughness detection range of aspect ratio, and Max_ERASP is the upper limit of the roughness detection range of aspect ratio;

[0222] "Roundness" is within the preset roundness roughness detection interval (Min_ERRD, Max_ERRD), Min_ERRD is the lower limit of the roundness roughness detection interval, and Max_ERRD is the upper limit of the roundness roughness detection interval;

[0223] Density convexity" is within the preset density rough detection interval (Min_ERConv, Max_ERConv), Min_ERConv is the lower limit of the density rough detection interval, and Max_ERConv is the upper limit of the density rough detection interval;

[0224] "Sharpness" is within the preset sharpness and roughness detection interval (Min_ERsharp, Max_ERsharp), Min_ERsharp is the lower limit of the sharpness and roughness detection interval, and Max_ERsharp is the upper limit of the sharpness and roughness detection interval;

[0225] "Rectangularity" is within the preset rectangularity rough detection interval (Min_ERRL, Max_ERRL), Min_ERRL is the lower limit value of the rectangularity rough detection interval, and Max_ERRL is the upper limit value of the rectangularity rough detection interval.

[0226] D37, defect restoration, since step D3 is performed in the polar coordinate system, the data in the corresponding Set needs to be inversely transformed to the original Cartesian coordinate system, and when there is a defect in any of the lens edge slight defect detection results, the lens edge slight defect detection results based on the bright field image, the lens edge slight defect detection results based on the dark field image, the bright field residual material defect detection results, and the edge roughness defect detection results, the defect is restored to the Cartesian coordinate system. The specific process is as follows:

[0227] Specifically, the feature data in the stored Set is traversed, and for each stored minimum bounding rectangle min_rect, the four vertices of the rectangle (p1, p2, p3, p4) are found, and the above four vertices are inversely transformed in polar coordinates so that they can correspond to the image coordinate system to obtain (p1′, p2', p3′, p4′). The transformation formula is as follows:

[0228]

[0229] Among them, (cx, cy), r are the geometric parameters of the fitted ellipse obtained in C, cnt is the number of samples in C, (x i ,y i ) is the vertex p i Coordinates, (x i ′,y i ′) is the corresponding vertex transformed to the image coordinate system p i ′’s coordinates.

[0230] Use the newly obtained p i ′, reconstruct the contour to generate the corresponding min_rect′, and replace min_rect in Set with min_rect′.

[0231] E. Result analysis and generation module: It is mainly responsible for making a comprehensive judgment on the above-mentioned glass bowl inspection results, lens rough inspection results, lens edge inspection and surface inspection results by combining the project defect priority file, and outputting the final result of the lens and the corresponding annotation information, including:

[0232] E1. Initialize the result data in LensResult to "Pass";

[0233] E2. Search BlisterResult in module B, LensEdgeExtRes and LensRoughRes in module C. If any of the results in the above three modules is not "Pass", assign the same defect code to LensResult.result, copy the relevant annotation data to the data structure corresponding to LensResult, and enter E5. Otherwise, enter E3.

[0234] E3. Determine the length of the defect Set in module D. If the length is 0, end this module, otherwise go to E4;

[0235] E4. Load the Priority data in A11, build a priority queue, prioritize the defect codes in Set, assign the defect code with the highest priority to LensResult.result, and copy the related annotation data to the data structure corresponding to LensResult.

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

[0237] F. Result output: Package and output the result in step E.

[0238] F1. Combine the system parameters in A14 to package the output results. If it is necessary to draw an image to mark the location of the defect, use the relevant position coordinates of module F, such as min_rect.

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

[0240] A high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision is invented. The method obtains a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and pre-processes the multi-light field original image to obtain a bright field image, a dark field image, and a pre-processed image; performs glass bowl detection on the pre-processed image, and extracts the geometric features of the glass bowl when there is a glass bowl in the pre-processed image; extracts contour features of the printed contact lens in the glass bowl area based on the geometric features of the glass bowl; and then performs rough inspection, Cartesian coordinate system, and polar coordinate system edge defect detection based on the above-extracted images and features. The present application further utilizes the contact lens images captured by a high-resolution camera, performs automated identification on the image, and determines whether the corresponding product is normal or not, so as to reduce labor costs, save time, and improve production yield.

[0241] The present application also provides a high-precision multi-light field contact lens edge defect detection device based on cloud-machine vision, comprising:

[0242] An acquisition and preprocessing module, used for acquiring a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and preprocessing the multi-light field original image to obtain a point light source image, a bright field image, a dark field image, and a preprocessed image, wherein the preprocessed image is obtained by filtering the bright field image;

[0243] A feature extraction module, used to detect a glass bowl in the preprocessed image, and extract geometric features of the glass bowl when the glass bowl exists in the preprocessed image; and extract contour features of the printed contact lens in the glass bowl area based on the geometric features of the glass bowl;

[0244] The defect detection module is used to perform a rough inspection on the printed contact lens based on the contour features of the printed contact lens to obtain a rough inspection result; perform edge bubble detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the preprocessed image to obtain an edge bubble template image; and perform edge defect detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the edge bubble template image in a Cartesian coordinate system and a polar coordinate system, respectively, to obtain an edge defect detection result.

[0245] The present invention provides a high-precision multi-light field contact lens edge defect detection device based on cloud-machine vision. The device obtains a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and pre-processes the multi-light field original image to obtain a bright field image, a dark field image, and a pre-processed image; performs glass bowl detection on the pre-processed image, and extracts the geometric features of the glass bowl when the glass bowl exists in the pre-processed image; extracts contour features of the printed contact lens in the glass bowl area based on the geometric features of the glass bowl; and then performs rough inspection, Cartesian coordinate system, and polar coordinate system edge defect detection based on the above-extracted images and features. The present application further utilizes the contact lens images captured by a high-resolution camera, performs automated identification on the image, and determines whether the corresponding product is normal or not, so as to reduce labor costs, save time, and improve production yield.

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

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

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

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

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

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

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

[0253] 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 high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision, characterized in that: Includes steps: Acquire a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and pre-process the multi-light field original image to obtain a point light source image, a bright field image, a dark field image, and a pre-processed image, wherein the pre-processed image is obtained by filtering the bright field image; Performing glass bowl detection on the preprocessed image, and extracting geometric features of the glass bowl when the glass bowl exists in the preprocessed image; performing contour feature extraction on the printed contact lens in the glass bowl area based on the geometric features of the glass bowl; The printed contact lenses are roughly inspected based on the contour features of the printed contact lenses to obtain a rough inspection result; edge bubble detection is performed on the printed contact lenses based on the contour features of the printed contact lenses, the bright field image, the dark field image and the preprocessed image to obtain an edge bubble template image; in a Cartesian coordinate system and a polar coordinate system, edge defect detection is performed on the printed contact lenses based on the contour features of the printed contact lenses, the bright field image, the dark field image and the edge bubble template image to obtain an edge defect detection result.

2. According to claim 1, a high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision is characterized in that: Performing glass bowl detection on the preprocessed image and extracting geometric features of the glass bowl when the glass bowl exists in the preprocessed image includes: Binarizing the preprocessed image and extracting the contour features of the glass bowl in the preprocessed image after the binarization process; Fitting the minimum inscribed circle of the glass bowl contour whose area is larger than the pre-configured glass bowl area to obtain the radius and center of the minimum inscribed circle; The radius of the minimum inscribed circle is compared with a preconfigured radius range, and when the radius of the minimum inscribed circle falls within the preconfigured radius range, it is determined that a glass bowl exists in the preprocessed image, and the radius and center of the minimum inscribed circle are used as geometric features of the glass bowl.

3. The high-precision multi-light field contact lens edge defect detection method based on a Cartesian coordinate system according to claim 1, characterized in that: Perform a rough inspection on the printed contact lens based on the contour features of the printed contact lens to obtain a rough inspection result; Extracting contour features of the printed contact lens in the glass bowl region based on the preprocessed image and the geometric features of the glass bowl to obtain an elliptical contour of the printed contact lens; Extracting contour features of the printed contact lens in the glass bowl region based on the preprocessed image and the geometric features of the glass bowl to obtain an elliptical contour of the printed contact lens includes: Filtering and binarizing the preprocessed image to obtain a binarized image C1a; Constructing a glass bowl region BlisterROI based on the geometric features of the glass bowl; A first feature image C1fea is constructed based on the glass bowl region BlisterROI and the binary image C1a, wherein the mathematical expression of the first feature image C1fea is: Where, C1fea i,j is the pixel with coordinates (i, j) in the first feature image C1fea, C1a i,j is the pixel with coordinates (i, j) in the binary image C1a, BlisterROI i,j is the pixel with coordinates (i, j) in the glass bowl region BlisterROI; Extract the contour features in the first feature image Clfea, and extract the inner contour and outer contour of the printed contact lens based on the pre-constructed lens parameters, wherein the lens parameters include the major and minor axis difference determination threshold T abdif , lens aspect ratio threshold T edge_asp , lens size diameter setting threshold range LensDiaRange; Fitting the outer contour of the printed contact lens to obtain an ellipse contour; Based on the elliptical contour of the printed contact lens and the geometric features of the glass bowl, obvious defect detection is performed to obtain a rough inspection result.

4. The high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision according to claim 3 is characterized in that: Based on the elliptical contour of the printed contact lens and the geometric features of the glass bowl, obvious defect detection is performed to obtain a rough inspection result, including: Generate a lens area image based on the ellipse outline, and extract an intersection image C21Img between the glass bowl area BlisterROI and the lens area image, and determine that there is a lens edge defect when the number of pixel points in the intersection image C21Img is greater than a preset number threshold; When the printed contact lens only has an outer contour, it is determined that the lens has a large-scale edge defect; Extracting the major axis a and the minor axis b of the ellipse profile ellipse, calculating the difference between the major axis a and the minor axis b, and calculating the aspect ratio of the major axis a and the minor axis b; when the difference is greater than a preset major-minor axis difference threshold, or when the aspect ratio is less than a preset aspect ratio threshold, determining that the lens has a deformation defect; Extract the ellipse center and assumed radius r of the ellipse outline ellipse, where the assumed radius Based on the ellipse center and the assumed radius r, the contour features in the first feature image Clfea are expanded in polar coordinates, and the average value and variance of the polar diameters of all contour pixel points in the polar coordinates are calculated, and a filtering range based on the 3sigma principle is constructed based on the average value and variance of the polar diameters, and contour points that do not fall into the filtering range are regarded as abnormal points. When the number of abnormal points is greater than a preset multiple-piece determination number threshold, it is determined that the lens has multiple defects; The major axis a and the minor axis b of the ellipse outline ellipse are extracted, the mean of the major axis a and the minor axis b are calculated, and the mean of the major axis a and the minor axis b are compared with a preset lens size diameter setting threshold interval LensDiaRange. When the mean of the major axis a and the minor axis b is not within the preset lens size diameter setting threshold interval LensDiaRange, it is determined that the lens has a size non-compliance defect.

5. The high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision according to claim 3 is characterized in that: The method performs edge bubble detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the pre-processed image to obtain an edge bubble template image, including: Extracting the lens edge area of ​​the bright field image based on the ellipse outline; The bright field image is sequentially filtered, morphologically processed and binarized to obtain a bright field binary image; Extracting edge 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 characteristics to obtain edge bubble defect detection results, wherein the bubble characteristics include edge roundness greater than a preset roundness threshold, edge length and width greater than a preset bubble aspect ratio threshold, and contour grayscale less than a preset bubble grayscale threshold; The contour of the bubble feature is reconstructed to obtain an edge bubble template image.

6. The high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision according to claim 5, characterized in that: In a Cartesian coordinate system, edge defect detection is performed on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image, and the edge bubble template image to obtain an edge defect detection result, including: Using a convex hull extraction algorithm for the inner contour and the outer contour of the printed contact lens respectively, obtaining the vertices of the inner contour convex hull and the vertices of the outer contour convex hull, calculating the Euclidean distance between the vertices of the inner contour convex hull and the vertices of the outer contour convex hull one by one, and when the Euclidean distance is greater than a preset lace threshold, determining that the printed contact lens has lace defects and storing the lace position; Perform morphological processing on the inner contour convex hull image to obtain an inner edge image; perform a differential operation on the inner edge image and the outer contour to obtain a first severe edge feature; perform a minimum circumscribed rectangle extraction on the first severe edge feature, and when the length of the minimum circumscribed rectangle of the first severe edge feature is greater than a preset minimum edge detection size, determine that the printed contact lens has a severe defect on the lens edge.

7. The high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision according to claim 5, characterized in that: In a Cartesian coordinate system, edge defect detection is performed on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image, and the edge bubble template image to obtain an edge defect detection result, including: Performing median filtering on the inner edge image to obtain a median filtered image; performing bubble interference elimination on the median filtered image based on the edge bubble template image to obtain a second severe edge feature; extracting geometric features of the second severe edge feature, and determining that the printed contact lens has an edge tear defect when the geometric features of the second severe edge feature meet a preset edge tear condition; Fit the outer contour of the printed contact lens to obtain an outer contour ellipse; calculate the Euclidean distance dis between the center of the outer contour ellipse and all points of the outer contour i and angle i , where the Euclidean distance dis and the angle angle i The mathematical expression is: dis i =sqrt((xp ix ) 2 +(yp iy ) 2 ) In the formula, (p ix ,p iy ) is the coordinate of the outer contour point, (x, y) is the coordinate of the center of the outer contour ellipse; based on the Euclidean distance dis of all points i and angle i Generate a Euclidean distance set and an angle set, perform normalization filtering and smoothing on the Euclidean distance set and the angle set, and generate an outer contour image fit based on the normalized, filtered and smoothed Euclidean distance set and the angle set img , fit the outer contour image based on the edge bubble template image img The bubbles are eliminated to obtain a second characteristic image, and contour features are extracted from the second characteristic image. When the contour features of the second characteristic image meet the preset edge residual material condition, it is determined that the printed contact lens has residual material defects.

8. The high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision according to claim 5, characterized in that: In a polar coordinate system, edge defect detection is performed on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image, and the edge bubble template image to obtain an edge defect detection result, including: Extracting the ellipse center and radius of the ellipse outline ellipse, and performing polar coordinate transformation on the point light source image, the bright field image, the dark field image, the inner contour of the printed contact lens, and the outer contour of the printed contact lens based on the ellipse center and radius, to obtain a point light source polar coordinate image, a bright field polar coordinate image, a dark field polar coordinate image, an inner contour polar coordinate image, and an outer contour polar coordinate image; Performing morphological processing on the outer contour polar coordinate image to obtain a processed image; performing differential processing on the processed image and the outer contour polar coordinate image to obtain a third feature image; extracting the minimum circumscribed rectangle of the third feature image, and performing slight defect detection on the edge of the lens based on the size of the minimum circumscribed rectangle of the third feature image and a preset minimum detection size to obtain a slight defect detection result on the edge of the lens; Performing morphological processing on the outer contour polar coordinate image to obtain an edge region of interest; merging the edge region of interest with the bright field polar coordinate image to obtain a bright field edge image; performing mean projection on the bright field edge image to obtain one-dimensional bright field data; performing outlier detection on the one-dimensional bright field data to obtain outliers; converting the outliers to a Cartesian coordinate system, and removing outliers belonging to edge bubbles in the Cartesian coordinate system based on the edge bubble template image to obtain a fourth feature image; extracting a minimum circumscribed rectangle of the fourth feature image, and performing a lens edge slight defect detection based on a bright field image based on the size of the minimum circumscribed rectangle of the fourth feature image and a preset minimum detection size to obtain a lens edge slight defect detection result based on a bright field image; Perform morphological processing on the outer contour polar coordinate image to obtain an edge region of interest; merge the edge region of interest with the dark field polar coordinate image to obtain a dark field edge image; perform mean projection on the dark field edge image to obtain one-dimensional dark field data; perform outlier detection on the one-dimensional dark field data to obtain outliers; convert the outliers to a Cartesian coordinate system, and remove the outliers belonging to edge bubbles in the Cartesian coordinate system based on the edge bubble template image to obtain a fifth feature image; extract the minimum circumscribed rectangle of the fifth feature image, and perform dark field image-based detection of slight defect on the edge of the lens based on the size of the minimum circumscribed rectangle of the fifth feature image and a preset minimum detection size to obtain a dark field image-based detection result of slight defect on the edge of the lens.

9. The high-precision multi-light field contact lens edge defect detection method based on cloud-machine vision according to claim 8, characterized in that: In a polar coordinate system, edge defect detection is performed on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image, and the edge bubble template image to obtain an edge defect detection result, further comprising: Performing gradient operation on the bright field edge image to obtain a bright field binary image; performing morphological processing on the edge region of interest to obtain an edge target region of interest; merging the edge target region of interest with the bright field binary image and converting them into a Cartesian coordinate system to obtain a bright field merged image; removing edge bubble interference of the bright field merged image based on an edge bubble template image to obtain a sixth feature image; extracting geometric information of each contour in the sixth feature image, and performing bright field residual material defect detection based on pre-constructed residual material detection conditions and the geometric information of each contour in the sixth feature image; Performing an adaptive binarization algorithm on the bright field edge image to obtain a bright field edge binarization image; performing contour extraction on the bright field edge binarization image, and screening out target contours with an aspect ratio less than a target value, and constructing an edge region of interest based on the target contours in the bright field edge binarization image; performing an adaptive binarization algorithm on the dark field edge image to obtain a dark field edge binarization image; merging the dark field edge binarization image with the edge region of interest and converting them into a Cartesian coordinate system to obtain a seventh feature image; extracting geometric information of each contour in the seventh feature image, and performing edge roughness defect detection based on a pre-constructed edge roughness detection condition and the geometric information of each contour in the seventh feature image; When there is a defect in any of the lens edge slight defect detection result, the lens edge slight defect detection result based on the bright field image, the lens edge slight defect detection result based on the dark field image, the bright field residual material defect detection result, and the edge roughness defect detection result, the defect is restored to the Cartesian coordinate system.

10. A high-precision multi-light field contact lens edge defect detection device based on cloud-machine vision, characterized in that: include: An acquisition and preprocessing module, used for acquiring a multi-light field original image of a printed contact lens immersed in water in a glass bowl, and preprocessing the multi-light field original image to obtain a point light source image, a bright field image, a dark field image, and a preprocessed image, wherein the preprocessed image is obtained by filtering the bright field image; A feature extraction module, used to detect a glass bowl in the preprocessed image, and extract geometric features of the glass bowl when the glass bowl exists in the preprocessed image; and extract contour features of the printed contact lens in the glass bowl area based on the geometric features of the glass bowl; The defect detection module is used to perform a rough inspection on the printed contact lens based on the contour features of the printed contact lens to obtain a rough inspection result; perform edge bubble detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the preprocessed image to obtain an edge bubble template image; and perform edge defect detection on the printed contact lens based on the contour features of the printed contact lens, the bright field image, the dark field image and the edge bubble template image in a Cartesian coordinate system and a polar coordinate system, respectively, to obtain an edge defect detection result.

Citation Information

Patent Citations

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

    CN118505634A

  • High-precision multi-light-field contact lens flaw detection method and device based on cloud-machine vision

    CN119477817A

Cited By

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

    CN119338796A

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

    CN119338796B