Defect detection method and system for printed contact lenses based on cloud-machine vision

Through the defect detection method and system of printed contact lenses based on cloud-machine vision, the problem of difficult detection of multiple defects in contact lenses in the prior art is solved, and efficient and accurate detection of multiple defects is achieved.

CN118505634BActive Publication Date: 2025-03-04SIGMA SQUARES (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410586559.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-13
Publication Date
2025-03-04
Estimated Expiration
2044-05-13

AI Technical Summary

Technical Problem

The prior art is difficult to effectively detect various types of defects in contact lenses.

Method used

The defect detection method and system of printed contact lenses based on cloud-machine vision is adopted to obtain original images, pre-process, extract contour features, and perform bilateral defect detection, edge defect detection, foreign object detection in printing area and foreign object detection in optical area.

Benefits of technology

Automatic detection of various defect types of contact lenses is achieved, improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118505634B_ABST
    Figure CN118505634B_ABST
Patent Text Reader

Abstract

The present invention relates to a defect detection method and system for printed contact lenses based on cloud-machine vision, which obtains the original image of the contact lens; pre-processes the original image to obtain a process image; extracts the contour features of the process image, and determines whether there is a lens in the process image based on the contour features of the process image; when there is a lens in the process image, performs bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image. The present application performs bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on contact lenses based on machine vision. Thereby, automatic detection of multiple defect types is achieved, and the detection efficiency is high and accurate.
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 technology, and in particular to a method and system for detecting defects of printed contact lenses 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 defects are prone to occur during the production process. Since there are many types of defects in contact lenses, it is very difficult to detect various types of defects in contact lenses in the existing technology. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a defect detection method and system for printed contact lenses based on cloud-machine vision, so as to solve the problem that it is difficult to detect various defects of contact lenses in the prior art.

[0004] In order to achieve the above object, the present invention adopts the following technical solutions:

[0005] The defect detection method of printed contact lenses based on cloud-machine vision of the present invention comprises:

[0006] Acquire a raw image of the contact lens;

[0007] Preprocessing the original image to obtain a process image;

[0008] Extracting contour features of the process image, and judging whether a lens exists in the process image based on the contour features of the process image;

[0009] When a lens exists in the process image, the process image is subjected to bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection.

[0010] In one embodiment of the present application, preprocessing the original image to obtain a process image includes:

[0011] Convert the original image from RAW format to RGB format to obtain an intermediate image;

[0012] Transforming the first intermediate image into a grayscale space to obtain a grayscale image;

[0013] Gaussian filtering is performed on the grayscale image to obtain a process image.

[0014] In one embodiment of the present application, extracting the contour features of the process image, and judging whether there is a lens in the process image based on the contour features of the process image, includes:

[0015] Extracting contour pixels of the process image based on a contour extraction operator;

[0016] Counting the outline pixel points to obtain the number of outline pixel points;

[0017] The number of contour pixel points is compared with a preset number threshold, and when the number of contour pixel points is greater than the preset number threshold, it is determined that a contact lens exists in the process image; when the number of contour pixel points is less than or equal to the preset number threshold, it is determined that no contact lens exists in the process image.

[0018] In one embodiment of the present application, performing bilateral defect detection on the process image includes:

[0019] Binarizing the process image to obtain a binary image;

[0020] Screening the contours in the binary image based on pre-configured shape parameters to obtain a target contour, wherein the shape parameters include a bilateral effective contour size, a rectangularity, and an aspect ratio;

[0021] Performing morphological processing on the target contour to obtain a target area that conforms to a preset morphology;

[0022] The number of pixels in the target area is counted, and the number of pixels in the target area is continuously compared with a preset threshold value of the number of effective pixels. When the number of pixels in the target area is greater than the threshold value of the number of effective pixels, it is determined that the process image has bilateral defects caused by contact lens overlap; otherwise, it is determined that the process image does not have bilateral defects.

[0023] In one embodiment of the present application, edge defect detection is performed on the process image, including:

[0024] Extracting an edge profile image of the lens and geometric parameters of the edge profile from the process image;

[0025] Performing convex hull extraction on the edge contour to obtain a convex hull image;

[0026] Performing a difference operation on the convex hull image and the edge contour image to obtain a difference image;

[0027] Extract the contours in the differential image to obtain a contour set; and extract feature information of each contour in the contour set to obtain a feature information list DefectList, wherein the feature information includes geometric information and grayscale information, and the mathematical expression of the feature information list DefectList is:

[0028] DefectList = {f1 ,f 2 ,f 3 ,…f i}

[0029]

[0030]

[0031] f i_gray = {gray i}

[0032] In the formula, f 1 ,f 2 ,f 3 ,…f i is the feature information of the 1st to i-th contours, is the geometric information of the i-th contour, f i_gray is the grayscale information of the i-th contour, area i is the area of ​​the i-th contour, l i is the length of the minimum circumscribed rectangle of the i-th contour, w i is the width of the minimum bounding rectangle of the i-th contour, gray i is the average gray value of the bounding box of the i-th contour;

[0033] The feature information list DefectList is traversed and filtered based on pre-configured detection parameters to obtain a defect detection result for each contour.

[0034] In one embodiment of the present application, extracting the edge contour image of the lens and the geometric parameters of the edge contour from the process image includes:

[0035] Extracting edge contours in the process image to obtain an edge contour image;

[0036] Screening the contours in the edge contour image based on pre-configured lens parameters to obtain the edge contour of the lens, wherein the lens parameters include the longest diameter interval, the shortest diameter interval, the maximum tolerance threshold range of the major and minor axes of the lens, and the aspect ratio of the lens;

[0037] Counting the number of pixel points of the edge profile of the lens to obtain the number of valid pixels; and performing integrity check on the edge profile of the lens based on the number of valid pixels;

[0038] When it is determined that the edge profile of the lens is complete, fitting the edge profile of the lens to obtain a fitting profile and geometric parameters of the fitting profile to be tested;

[0039] Performing geometric verification on the to-be-verified geometric parameters based on pre-configured lens parameters, and obtaining geometric parameters of the edge profile of the lens through the geometric verification of the to-be-verified geometric parameters;

[0040] An image template RoI is constructed based on the edge contour of the lens to obtain an edge contour image Edge.

[0041] In one embodiment of the present application, the pre-configured detection parameters include minimum length, minimum width, minimum area and minimum gray value;

[0042] The feature information list DefectList is traversed and filtered based on the pre-configured detection parameters to obtain the defect detection result of each contour, including:

[0043] Compare the feature information of the i-th contour in the feature information list DefectList with the minimum length, the minimum width and the minimum area;

[0044] The length l of the i-th contour i Greater than the minimum length, width w i Greater than the minimum width and area i When the area is greater than the minimum area, the average gray value of the i-th contour is gray i comparing with the minimum grayscale value;

[0045] The average gray value gray in the i-th contour i When the grayscale value is greater than the minimum grayscale value, the i-th contour is determined to have no incomplete defects; otherwise, the i-th contour is determined to have incomplete defects.

[0046] In one embodiment of the present application, the printing area foreign matter detection and the optical area foreign matter detection are performed on the process image, including:

[0047] Extracting a printing area image and an optical area image in the process image based on geometric parameters of an edge profile of the lens;

[0048] Performing mask processing on the process image based on the printing area image and the optical area image to obtain an optical area effective image and a printing area effective image;

[0049] Extract all contours to be detected from the optical area effective image or the printing area effective image;

[0050] Compare all the contours to be detected with the pre-configured minimum detection area of ​​foreign objects, and take the contours to be detected whose contour area is larger than the minimum detection area of ​​foreign objects as the detected contours;

[0051] Extracting foreign body features of the detected contour, wherein the foreign body features include the length of the minimum circumscribed rectangle, contour density, the aspect ratio of the minimum circumscribed rectangle, the roundness and circularity of the detected contour, and the average grayscale and grayscale variance within the detected contour;

[0052] All detected contours are filtered based on pre-configured foreign body detection parameters and the foreign body features of the detected contours, wherein the foreign body detection parameters include the shortest detected size, the detected density interval, the detected aspect ratio interval, the detected roundness interval, the detected roundness ratio interval, the detected gray value interval, and the detected gray variance interval; the screening conditions include: the length of the minimum circumscribed rectangle is greater than the shortest detected size, the contour density is within the detected density interval, the aspect ratio of the minimum circumscribed rectangle is within the detected aspect ratio interval, the roundness of the detected contour is within the detected roundness interval, the roundness of the detected contour is within the detected roundness interval, the average gray within the detected contour is within the detected gray value interval, and the gray variance within the detected contour is within the detected gray variance interval;

[0053] Performing gradient extraction on the target area within the detected contour that has passed the screening to obtain a gradient image;

[0054] The gradient image is morphologically processed to obtain a portion of the gradient image that meets the foreign matter defect, and the number of pixels in the portion that meets the foreign matter defect is counted; when the number of pixels in the portion that meets the foreign matter defect is greater than a preset foreign matter pixel number threshold, it is determined that the printing area image and the optical area image have foreign matter defects.

[0055] In one embodiment of the present application, extracting the printing area and the optical area in the process image based on the geometric parameters of the edge profile of the lens includes:

[0056] Performing polar coordinate transformation on the process image based on geometric parameters of the edge profile of the lens to obtain a polar coordinate image, wherein the printed area in the polar coordinate image is in the shape of a vertical strip;

[0057] Projecting the polar coordinate image along the vertical direction to obtain a one-dimensional vector, wherein the one-dimensional vector includes the number of printed textures at multiple positions;

[0058] Determine the starting point coordinates and the ending point coordinates of the printing area from the one-dimensional vector based on a preset printing area outer contour threshold and a printing area inner contour threshold;

[0059] The starting point coordinates and the ending point coordinates of the printing area are verified based on pre-set verification parameters, wherein the verification parameters include a threshold value of the outer contour of the printing area, a minimum radius of the printing ring, and a radius of the outer contour of the printing ring;

[0060] When the coordinates of the starting point and the coordinates of the ending point of the printing area are checked, the printing area is constructed based on the coordinates of the starting point and the coordinates of the ending point of the printing area;

[0061] The optical zone is determined based on the printed area and the edge contour of the lens.

[0062] The present application also provides a defect detection system for printed contact lenses based on cloud-machine vision, including:

[0063] An acquisition module, used for acquiring an original image of the contact lens;

[0064] A preprocessing module, used for preprocessing the original image to obtain a process image;

[0065] a lens determination module, configured to extract contour features of the process image, and determine whether a lens exists in the process image based on the contour features of the process image;

[0066] The defect detection module is used to perform bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image when there is a lens in the process image.

[0067] The beneficial effects of the present invention are as follows: the defect detection method and system for printed contact lenses based on cloud-machine vision of the present invention obtains the original image of the contact lens; pre-processes the original image to obtain a process image; extracts the contour features of the process image, and determines whether there is a lens in the process image based on the contour features of the process image; when there is a lens in the process image, performs bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image. The present application performs bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on contact lenses based on machine vision. Thereby, automatic detection of multiple defect types is achieved, and the detection efficiency is high and accurate. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0069] Figure 1 This is an application scenario diagram of the defect detection method for printed contact lenses based on cloud-machine vision in this application;

[0070] Figure 2 This is a flow chart of the defect detection method for printed contact lenses based on cloud-machine vision in this application;

[0071] Figure 3 Initialization configuration flow chart in this application;

[0072] Figure 4 This is the pre-processing flow chart of this application;

[0073] Figure 5 It is a schematic diagram of the process of judging whether there is a lens in this application;

[0074] Figure 6 It is a schematic diagram of the bilateral defect detection process in this application;

[0075] Figure 7 This is a schematic diagram of the edge defect detection process in this application;

[0076] Figure 8 Schematic diagram of the edge contour image and the geometric parameter extraction process of the edge contour in this application;

[0077] Fig. 9 It is a schematic diagram of the process of printing area foreign matter detection and optical area foreign matter detection in this application;

[0078] Fig.10 is a schematic diagram of a vertical projection in an embodiment of the present application;

[0079] Fig.11 A schematic diagram of a result output object in an embodiment of the present application;

[0080] Fig.12 This is a structural diagram of the cloud-machine vision-based printed contact lens defect detection system in this application. DETAILED DESCRIPTION

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

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

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

[0084] Figure 1This is an application scenario diagram of the defect detection method for printed contact lenses based on cloud-machine vision in this application, such as Figure 1 As shown, in the present 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.

[0085] Figure 2 : is a flow chart of a defect detection method for printed contact lenses based on cloud-machine vision shown in an embodiment of the present application, such as Figure 2 As shown, this application includes:

[0086] S1, obtain the original image of the contact lens;

[0087] S2, preprocessing the original image to obtain a process image;

[0088] The preprocessing process reads, loads, converts the color space, reduces noise, and other operations on the contact lens image collected by the camera to reduce the interference caused by environmental noise, and finally generates a process image.

[0089] S3, extracting contour features of the process image, and judging whether a lens exists in the process image based on the contour features of the process image;

[0090] Step S3 uses a contour extraction algorithm (such as a canny algorithm) on the process image Process Image, and determines whether there is a lens based on the extracted relevant pixel content;

[0091] S4, when there is a lens in the process image, performing bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image.

[0092] Among them, the double-sided defect is caused by the overlap of two lenses. The process image is subjected to contour extraction and morphological processing to extract the corresponding lens contour and count the number of contour pixels. Finally, the pixel data is statistically analyzed to determine whether it is a double lens.

[0093] Edge defect detection mainly processes the edge image Edge extracted from S3, uses pre-configured parameters to perform C filtering and screening, and determines whether the contour is Crack (incomplete).

[0094] Printing zone foreign body detection and optical zone foreign body detection require the extraction of the printing zone and optical zone first, and the edge image Edge is extracted using pre-configured parameters to obtain the printing zone Print Zone and the optical zone Optical Zone. Then the printing zone Print Zone and the optical zone Optical Zone are used to crop the process image, locate foreign bodies, and analyze them.

[0095] Finally, the above test results are packaged and output.

[0096] Each step of the above process is described in detail below. The specific introduction is as follows:

[0097] A. Preprocessing and initialization configuration;

[0098] Figure 3 The initialization configuration flow chart in this application is as follows Figure 3 As shown in the figure, before conducting formal detection and analysis, the required parameters must be configured, including:

[0099] A1. The initialization configuration process is as follows:

[0100] A11. Read the parameter configuration file, which includes lens size parameters, algorithm configuration parameters, system setting parameters, etc.

[0101] A12. Load lens size parameters, including 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.

[0102] A13. Load algorithm parameters, including extraction parameters and analysis parameters, etc. The details are as follows:

[0103] For step S3: Canny algorithm offset parameter edgeC, no-slice threshold parameter missTh;

[0104] For step S4: the minimum threshold of the number of valid edge sampling points edgeSamNumMin, the lens edge ratio rateTh; the bilateral effective contour size doubleL, the threshold of the number of valid pixels doubleTh; the minimum Crack detection size, including length minCrackLength, width minCrackWidth, minimum Crack detection area minCrackArea, and minimum detection grayscale minCrackGray; polar coordinate sampling angle deg, printing area inner contour threshold printInnerTh, printing area outer contour threshold printOuterTh, printing ring minimum radius printRMin, printing ring outer contour radius printOuterR; module enable value FMSwitch, minimum foreign body detection area FMminArea, shortest detection size FMminL, detection density range SolidRange, detection aspect ratio range AspRange, detection roundness range RoundRange, detection roundness range CirRange, detection grayscale value range GrayRange, detection grayscale variance range VarRange, effective pixel number threshold PixTh, etc.

[0105] A2. Pretreatment:

[0106] Figure 4 This is the preprocessing flow chart of this application, such as Figure 4 As shown, the original image is preprocessed to obtain a process image, including:

[0107] A21, converting the original image from RAW format to RGB format to obtain an intermediate image;

[0108] This step loads, decodes, reads the image data of the original image, and converts it from RAW to RGB format to obtain the intermediate image Image.

[0109] A22, transforming the first intermediate image into a grayscale space to obtain a grayscale image;

[0110] Transform the intermediate image Image to grayscale space to obtain the grayscale image GrayImage

[0111] A23, performing Gaussian filtering on the grayscale image to obtain a process image.

[0112] The gray image GrayImage is subjected to Gaussian filtering with a kernel of 3×3 to obtain the process image ProcessImage, in order to reduce the interference caused by environmental noise.

[0113] B. Whether the lens has a judgment.

[0114] Figure 5 The figure is a schematic diagram of the process of judging whether there is a lens in this application. Figure 5 As shown, extracting the contour features of the process image, and judging whether there is a lens in the process image based on the contour features of the process image, comprises:

[0115] B1, load process image Process Image, Canny algorithm offset parameter edgeC, no-slice threshold parameter missTh;

[0116] B2, extracting contour pixel points of the process image based on a contour extraction operator;

[0117] Specifically, the Canny algorithm using the algorithm offset parameter edgeC is applied to the process image Process Image to roughly extract the lens edge and the printing area.

[0118] B3, counting the contour pixels to obtain the number of contour pixels PixNum;

[0119] B4, comparing the number of the contour pixel points with a preset number threshold, and when the number of the contour pixel points is greater than the preset number threshold, determining that a contact lens exists in the process image, and when the number of the contour pixel points is less than or equal to the preset number threshold, determining that no contact lens exists in the process image.

[0120] For the number of contour pixels PixNum obtained, the missing lens threshold parameter missTh is used for judgment. If it is less than or equal to, there is no lens and the lens result Res is assigned "Missing Lens" and output. Otherwise, it is considered that this module passes and the lens result Res is assigned "Pass". The expression is as follows:

[0121]

[0122] C. Double-sided defect detection

[0123] Figure 6 This is a schematic diagram of the bilateral defect detection process in this application, such as Figure 6 As shown, bilateral defect detection is performed on the process image, including:

[0124] C1, performing binarization processing on the process image to obtain a binarized image;

[0125] The process image Process Image is subjected to a binary image generation using an adaptive binarization algorithm to generate a binary image D-bin.

[0126] C2, screening the contours in the binary image based on pre-configured shape parameters to obtain a target contour, wherein the shape parameters include a bilateral effective contour size, a rectangularity, and an aspect ratio;

[0127] Use the default algorithm parameters, such as rectangularity, aspect ratio, and bilateral effective contour size doubleL, to perform contour screening and obtain the contour D-cnt that meets the conditions.

[0128] C3, performing morphological processing on the target contour D-cnt to obtain a target region D-morph that conforms to a preset morphology;

[0129] C4, counting the number of pixels DoubleNum of the target area D-morph, and continuing to compare the number of pixels DoubleNum of the target area with the preset effective pixel number threshold doubleTh. When the number of pixels DoubleNum of the target area is greater than the effective pixel number threshold doubleTh, it is determined that the process image has a bilateral defect caused by the overlap of the contact lens; otherwise, it is determined that the process image does not have a bilateral defect. The expression is as follows:

[0130]

[0131] Expression explanation: If DoubleNum is greater than doubleTh, the image is considered to have a double-sided defect, the image result Res is set to Double, the process ends and the result Res is output; if satisfied, the process proceeds to the next process, which is edge defect detection.

[0132] D. Edge defect detection

[0133] Figure 7 This is a schematic diagram of the edge defect detection process in this application, such as Figure 7 As shown, edge defect detection is performed on the process image, including:

[0134] D1, extracting the edge contour image Edge of the lens and the geometric parameters Pars of the edge contour from the process image;

[0135] Figure 8 FIG. 1 is a schematic diagram of the process of extracting the edge contour image and the geometric parameters of the edge contour in this application. Figure 8 As shown, in this application, ProcessImage uses an edge extraction algorithm to adaptively extract the corresponding lens edge image Edge and the lens geometric parameters Pars such as the centroid, major and minor axes of the corresponding fitting ellipse, specifically including:

[0136] D11, extracting edge contours in the process image to obtain an edge contour image;

[0137] This application uses an adaptive algorithm to extract the edge of ProcessImage to obtain the corresponding edge contour image Bin. Other edge detection operators such as Sobel, Canny, Robert, etc. can also be used in the specific implementation.

[0138] D12, screening the contours in the edge contour image based on pre-configured lens parameters to obtain an edge contour of the contact lens;

[0139] Specifically, the lens size parameters configured in the previous text are used for screening. If the contour meets the lens size parameters, the subsequent process is entered; if not, the result of the image is set to "Reverse", and the process ends and outputs the result.

[0140] The specific screening process includes:

[0141] D121, extracting geometric parameters of the contour in the edge contour image, wherein the geometric parameters of the contour include the major axis diameter a 1 , minor axis diameter b 1 , average diameter d 1 , diameter difference dif 1 And the aspect ratio asp 1 , d 1 =mean(a 1 ,b 1 ), dif 1 = abs(a 1 -b 1 ), asp 1 =b 1 / a 1 ;

[0142] D122, matching the geometric parameters of the contour in the edge contour image with the preconfigured lens parameters, and when the geometric parameters of the contour in the edge contour image and the preconfigured lens parameters meet a first target condition, using the contour in the edge contour image as the edge contour of the contact lens, wherein the first target condition includes:

[0143] Average diameter d 1 It is in the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0144] Aspect ratio 1 Greater than or equal to the lens aspect ratio AspectRatio;

[0145] Diameter difference dif 1 It is within the maximum tolerance threshold range DDiff of the lens major and minor axes.

[0146] The expression of the screening process is:

[0147]

[0148] D13, counting the number of pixel points of the edge contour of the contact lens to obtain the number of valid pixels PixNum; and performing integrity check on the edge contour of the contact lens based on the number of valid pixels PixNum;

[0149] After obtaining the edge contour of the contact lens, a completeness check is required. A complete contour can be directly fitted to obtain an elliptical complete lens contour. An incomplete contour cannot be fitted.

[0150] Among them, when the number of valid pixels PixNum satisfies PixNum / edgeSamNumMin>rateTh, the edge contour of the contact lens is determined to be complete and enters the subsequent process; otherwise, the edge contour of the contact lens is determined to be incomplete, wherein edgeSamNumMin is a preset minimum threshold value of the number of valid edge sampling points, and rateTh is a preset lens edge ratio.

[0151] When the edge contour of the contact lens is incomplete, the image result is set to Crack, the process ends and the result is output.

[0152] The expression for integrity check is:

[0153]

[0154] D14, when it is determined that the edge profile of the contact lens is complete, fitting the edge profile of the contact lens to obtain a fitting profile and geometric parameters of the fitting profile to be tested;

[0155] The method used in this application is a least squares fitting ellipse algorithm based on PCA. In the specific implementation, other fitting ellipse algorithms can also be used, such as a three-arc combination selection algorithm.

[0156] Thus, the geometric parameters of the fitted ellipse corresponding to the contour are obtained, which are the major axis diameter a 2 , minor axis diameter b 2 , average diameter d 2 , diameter difference dif 2 And the aspect ratio asp 2 , where d 2 =mean(a 2 ,b 2 ), dif 2 = abs(a 2 -b 2 ), asp2 =b 2 / a 2 (a 2 ≠0).

[0157] D15, performing geometric verification on the geometric parameters to be verified based on the pre-configured lens parameters, and obtaining the geometric parameters of the edge profile of the contact lens through the geometric verification of the geometric parameters to be verified.

[0158] The method of geometric verification is consistent with the screening process in step D12, specifically including:

[0159] Matching the geometric parameters to be checked with the pre-configured lens parameters, and when the geometric parameters to be checked and the pre-configured lens parameters meet a second target condition, performing a geometric check on the geometric parameters to be checked, wherein the second target condition includes:

[0160] Average diameter d 2 It is in the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0161] Aspect ratio 2 Greater than or equal to the lens aspect ratio AspectRatio;

[0162] Diameter difference dif 2 It is within the maximum tolerance threshold range DDiff of the lens major and minor axes.

[0163] Its expression is:

[0164]

[0165] If the geometry check is passed, the subsequent process will proceed. If the geometry check fails, the process will end and the result will be output.

[0166] D16, constructing an image template RoI based on the edge contour of the lens to obtain an edge contour image Edge;

[0167] Finally, use Cnt to construct the template image RoI and get the required edge image Edge. The expression is:

[0168]

[0169] Among them, i,j are the corresponding image coordinates.

[0170] D2, extracting the convex hull of the edge contour image Edge to obtain a convex hull image hull_img;

[0171] D3, performing a difference operation on the convex hull image hull_img and the edge contour image Edge to obtain a difference image Dif_img;

[0172] D4, extracting contours in the differential image Dif_img to obtain a contour set Contours; and extracting feature information of each contour in the contour set Contours to obtain a feature information list DefectList, wherein the feature information includes geometric information and grayscale information, and the mathematical expression of the feature information list DefectList is:

[0173] DefectList = {f 1 ,f 2 ,f 3 ,…f i}

[0174]

[0175]

[0176] f i_gray = {gray i}

[0177] In the formula, f 1 ,f 2 ,f 3 ,…f i is the feature information of the 1st to i-th contours, is the geometric information of the i-th contour, f i_gray is the grayscale information of the i-th contour, area i is the area of ​​the i-th contour, l i is the length of the minimum circumscribed rectangle of the i-th contour, w i is the width of the minimum bounding rectangle of the i-th contour, gray i is the average gray value of the bounding box of the i-th contour;

[0178] When extracting the average gray value, use the bounding box bound_box: (x, y, w, h) to crop the process image and construct the mask inside the contour corresponding to the contour to obtain the cropped image sub_pro. The expression is as follows:

[0179] sub_proi i',j' =Process Image i-x,j-y *mask i-x,j-y

[0180] (0≤i' <h,0≤j'<w)

[0181]

[0182] Among them, (i,j) is the original image coordinate, (x,y) is the starting point coordinate in bound_box, and (i',j') is the cropped image coordinate. By obtaining the above sub_pro, the corresponding contour grayscale information can be calculated, specifically:

[0183] gray=mean(sub_pro)

[0184] D5, traversing and filtering the feature information list DefectList based on pre-configured detection parameters to obtain a defect detection result for each contour.

[0185] For each Defect object in DefectList, if any geometric information or grayscale information in the Defect does not meet the detection parameters, it will be discarded; if all geometric attributes and grayscale attributes meet the detection parameters, the Defect object will be retained, and the lens tested this time will be regarded as a "broken" defect. Then the lens result Res is assigned to "Crack Lens" and the result is output. The specific process is as follows:

[0186] The pre-configured detection parameters include the minimum length minCrackLength, the minimum width minCrackWidth, the minimum area minCrackArea and the minimum gray value minCrackGray; the specific traversal filtering process includes:

[0187] D51, comparing the feature information of the i-th contour in the feature information list DefectList with the minimum length, the minimum width and the minimum area;

[0188] D52, the length l of the i-th contour i Greater than the minimum length, width w i Greater than the minimum width and area i When the area is greater than the minimum area, the average gray value of the i-th contour is gray i Compare with the minimum gray value; the expression is:

[0189]

[0190]

[0191] D53, the average gray value gray in the i-th contour i When it is greater than the minimum grayscale value, it is determined that the i-th contour has no incomplete defects; otherwise, it is determined that the i-th contour has incomplete defects; the expression is:

[0192]

[0193] The Defect objects that meet all conditions are stored in the generated crack array, and the lens result Res is assigned to "Crack Lens" and then the result is output.

[0194] E. Lens foreign body detection

[0195] Fig. 9 Schematic diagram of the process of printing area foreign body detection and optical area foreign body detection in this application, such as Fig. 9 As shown, the process image is subjected to printing area foreign body detection and optical area foreign body detection, including:

[0196] E1, extracting the printing area image and the optical area image in the process image based on the geometric parameters of the edge profile of the lens; the specific extraction process includes:

[0197] E11, performing polar coordinate transformation on the process image based on geometric parameters of the edge profile of the contact lens to obtain a polar coordinate image, wherein the printed area in the polar coordinate image is in a vertical strip shape;

[0198] This application uses the geometric parameters Pars extracted in the previous text to perform polar coordinate transformation on the process image ProcessImage to obtain the polar coordinate image Polar_Pro; specifically:

[0199] Perform a radial scan with the center coordinates of the circle as the center point.

[0200] The center of the circle required by the polar coordinate transformation formula is the center of the ellipse in Pars c(cx,cy), and the radius is r=mean(a 2 / / 2, b 2 / / 2), in the polar coordinate system, the horizontal axis is the polar angle and the vertical axis is the polar diameter. The transformation formula here is:

[0201]

[0202] The sampling angle deg is pre-configured, and the number of samples is

[0203] Therefore, this application uses c,cnt to perform polar coordinate transformation on the process image ProcessImag, and the interpolation method is nearest neighbor interpolation to obtain the polar coordinate image to Polar_Pro; the ring in the original image is transformed into a strip through polar coordinate transformation.

[0204] E12, projecting the polar coordinate image along the vertical direction to obtain a one-dimensional vector, wherein the one-dimensional vector includes the number of printed textures at multiple positions;

[0205] Fig.10 is a schematic diagram of a vertical projection in an embodiment of the present application, such as Fig.10 As shown, the polar coordinate image Polar_Pro is vertically projected along the edge line to obtain the corresponding one-dimensional vector vec. The arrow in the figure indicates the projection direction, and the left part is the printed pattern part of the lens.

[0206] E13, determining the starting point coordinates and the ending point coordinates of the printing area from the one-dimensional vector based on a preset printing area outer contour threshold and a printing area inner contour threshold;

[0207] This application uses the pre-configured printing area inner contour threshold printInnerTh and printing area outer contour threshold printOuterTh to screen and traverse vec to determine the corresponding vec subscript, which is the starting point ps, pe of the printing area.

[0208] In this embodiment, the comparison may be continued in sequence, with the area meeting the printing area inner contour threshold printInnerTh being taken as the starting point ps, and the area meeting the printing area outer contour threshold printOuterTh being taken as the ending point ps.

[0209] Among them, since the center of the circle in Pars is used as the polar coordinate system, it can be considered that the inner ring radius of the printing area is the horizontal coordinate sx where ps is located, and the outer ring radius of the printing area is the horizontal coordinate ex where ps is located, where sx <ex

[0210] E14, verifying the starting point coordinates and the ending point coordinates of the printing area based on pre-set verification parameters, wherein the verification parameters include the printing area outer contour threshold printOuterTh, the printing ring minimum radius printRMin and the printing ring outer contour radius printOuterR;

[0211] If all conditions are met, the extraction of the printing area is considered successful and the subsequent process is entered; otherwise, the process exits and assigns the lens result Res to "Print Failed" and finally outputs the result.

[0212] E15, constructing a printing area based on the starting point coordinates and the ending point coordinates of the printing area by verifying the starting point coordinates and the ending point coordinates of the printing area.

[0213] E16, determining an optical zone based on the printed area and an edge contour of the lens.

[0214] E2, performing mask processing on the process image based on the printing area image and the optical area image to obtain an optical area effective image OptImage and a printing area effective image PrtImage; the mathematical expression of the mask processing is:

[0215] img i,j =Process Image i,j *ROI i,j

[0216] E3, extracting all contours to be detected in the optical area effective image or the printing area effective image; specifically, using an adaptive binarization algorithm to extract the contours to be detected.

[0217] E4, comparing all the contours to be detected contour with the pre-configured foreign body minimum detection area FMminArea, and taking the contour to be detected contour whose contour area is larger than the foreign body minimum detection area FMminArea as the detected contour;

[0218] E5, extracting foreign body features of the detected contour, wherein the foreign body features include the length of the minimum circumscribed rectangle, contour density, aspect ratio of the minimum circumscribed rectangle, roundness and circularity of the detected contour, and average grayscale and grayscale variance within the detected contour;

[0219] Among them, this application calculates the bounding box bound_box of the detected contour to extract the length l of the minimum enclosing rectangle, the contour density solid, and the aspect ratio aspect of the minimum enclosing rectangle. And extracts the average grayscale and grayscale variance by image cropping, specifically including:

[0220] The effective image OptImage in the optical area or the effective image PrtImage in the printing area is cropped, and a mask inside the contour is constructed according to the contour to obtain the cropped image sub_opt. The corresponding expression is as follows:

[0221] sub_opt i',j' =OptImage i-m,j-n *mask i-m,j-n

[0222] (0≤i' <H,0≤j'<W)

[0223]

[0224] Among them, (i,j) is the polar coordinate image coordinate, (m,n) is the minimum coordinate within the bound_box, and (i',j') is the cropped image coordinate.

[0225] Extract the grayscale features of the cropped image sub_opt, including the average grayscale gray and variance var. The corresponding expressions are as follows:

[0226] gray=mean(sub_pro)

[0227] var=var(sub_pro)

[0228] E6, filtering all detected contours based on pre-configured foreign body detection parameters and foreign body features of the detected contours, wherein the foreign body detection parameters include the shortest detected size, the detected density interval, the detected aspect ratio interval, the detected roundness interval, the detected roundness interval, the detected gray value interval, and the detected gray variance interval;

[0229] The screening conditions include: the length of the minimum circumscribed rectangle is greater than the shortest detected size, the contour density is within the detected density range, the aspect ratio of the minimum circumscribed rectangle is within the detected aspect ratio range, the roundness of the detected contour is within the detected roundness range, the circularity of the detected contour is within the detected circularity range, the average grayscale within the detected contour is within the detected grayscale value range, and the grayscale variance within the detected contour is within the detected grayscale variance range; the expression is as follows:

[0230]

[0231] E7, extract the gradient of the target area within the detected contour that has passed the screening to obtain the gradient image Grad; apply the canny algorithm to sub_opt to extract the refined gradient image Grad.

[0232] E8, performing morphological processing on the gradient image to obtain a portion of the gradient image that meets the foreign matter defect, and counting the number of pixels of the portion that meets the foreign matter defect; when the number of pixels of the portion that meets the foreign matter defect is greater than a preset foreign matter pixel number threshold, determining that the printing area image and the optical area image have foreign matter defects.

[0233] Finally, for each contour that meets the conditions, the min_rect data (foreign body defect location) is stored in Set, otherwise it is discarded.

[0234] Finally, if Set is 0, it is considered that there is no "foreign matter" defect, the detection lens is considered to have passed, and Res is set to "Pass"; otherwise, the detection lens is considered to have "foreign matter", Res is set to "FM", and the result is then output.

[0235] F. Package and output the results of the above steps B to E.

[0236] Package the output results. If you need to draw an image to mark the location of the defect, use the relevant position coordinates in the above steps, such as min_rect.

[0237] Fig.11Schematic diagram of the result output object in one embodiment of the present application, such as Fig.11 As shown, through the relevant API, the product detection result Res corresponding to the image obtained by the above process analysis is output, and the result is presented to the corresponding front-end display interface and related data processing center, such as physical software, Web, mobile APP, etc.

[0238] The defect detection method for printed contact lenses based on cloud-machine vision of the present invention obtains the original image of the contact lens; pre-processes the original image to obtain a process image; extracts the contour features of the process image, and determines whether there is a lens in the process image based on the contour features of the process image; when there is a lens in the process image, performs bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image. The present application performs bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on contact lenses based on machine vision. Thereby, automatic detection of multiple defect types is achieved, and the detection efficiency is high and accurate.

[0239] like Fig.12 As shown, the present application also provides a defect detection system for printed contact lenses based on cloud-machine vision, including:

[0240] An acquisition module, used for acquiring an original image of the contact lens;

[0241] A preprocessing module, used for preprocessing the original image to obtain a process image;

[0242] a lens determination module, configured to extract contour features of the process image, and determine whether a lens exists in the process image based on the contour features of the process image;

[0243] The defect detection module is used to perform bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image when there is a lens in the process image.

[0244] The defect detection system for printed contact lenses based on cloud-machine vision of the present invention obtains the original image of the contact lens; pre-processes the original image to obtain a process image; extracts the contour features of the process image, and determines whether there is a lens in the process image based on the contour features of the process image; when there is a lens in the process image, performs bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image. The present application is based on machine vision to perform bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on contact lenses. Thereby, automatic detection of multiple defect types is achieved, and the detection efficiency is high and accurate.

[0245] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in this embodiment is implemented, wherein the method is the execution logic of this system.

[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 defect detection method for printed contact lenses based on cloud-machine vision, characterized in that: Includes steps: Acquire a raw image of the contact lens; Preprocessing the original image to obtain a process image; Extracting contour features of the process image, and judging whether a lens exists in the process image based on the contour features of the process image; When a lens exists in the process image, bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection are performed on the process image, and edge defect detection is performed on the process image, including: extracting an edge contour image of the lens and geometric parameters of the edge contour from the process image; performing convex hull extraction on the edge contour to obtain a convex hull image; performing a differential operation on the convex hull image and the edge contour image to obtain a differential image; extracting contours in the differential image to obtain a contour set; and extracting feature information of each contour in the contour set to obtain a feature information list , wherein the feature information includes geometric information and grayscale information, and the feature information list The mathematical expression is: In the formula, For the The characteristic information of the contour, For the The geometric information of the contour, For the The grayscale information of the contour, For the The area of ​​the contour, For the The length of the minimum circumscribed rectangle of the contours, For the The width of the minimum bounding rectangle of the contours, For the The average gray value of the bounding box of the contour; the feature information list based on the pre-configured detection parameters Perform traversal filtering to obtain the incomplete detection results of each contour.

2. The defect detection method for printed contact lenses based on cloud-machine vision according to claim 1, characterized in that: Preprocessing the original image to obtain a process image includes: Convert the original image from RAW format to RGB format to obtain an intermediate image; Transforming the intermediate image into a grayscale space to obtain a grayscale image; Gaussian filtering is performed on the grayscale image to obtain a process image.

3. The defect detection method for printed contact lenses based on cloud-machine vision according to claim 1, characterized in that: Extracting contour features of the process image, and judging whether a lens exists in the process image based on the contour features of the process image, comprises: Extracting contour pixels of the process image based on a contour extraction operator; Counting the outline pixel points to obtain the number of outline pixel points; The number of contour pixel points is compared with a preset number threshold, and when the number of contour pixel points is greater than the preset number threshold, it is determined that a contact lens exists in the process image; when the number of contour pixel points is less than or equal to the preset number threshold, it is determined that no contact lens exists in the process image.

4. The defect detection method for printed contact lenses based on cloud-machine vision according to claim 1, characterized in that: Performing bilateral defect detection on the process image includes: Binarizing the process image to obtain a binary image; Screening the contours in the binary image based on pre-configured shape parameters to obtain a target contour, wherein the shape parameters include a bilateral effective contour size, a rectangularity, and an aspect ratio; Performing morphological processing on the target contour to obtain a target area that conforms to a preset morphology; The number of pixels in the target area is counted, and the number of pixels in the target area is continuously compared with a preset threshold value of the number of effective pixels. When the number of pixels in the target area is greater than the threshold value of the number of effective pixels, it is determined that the process image has bilateral defects caused by contact lens overlap; otherwise, it is determined that the process image does not have bilateral defects.

5. The defect detection method for printed contact lenses based on cloud-machine vision according to claim 1, characterized in that: Extracting the edge profile image of the lens and geometric parameters of the edge profile from the process image includes: Extracting edge contours in the process image to obtain an edge contour image; Screening the contours in the edge contour image based on pre-configured lens parameters to obtain the edge contour of the lens, wherein the lens parameters include the longest diameter interval, the shortest diameter interval, the maximum tolerance threshold range of the major and minor axes of the lens, and the aspect ratio of the lens; Counting the number of pixel points of the edge profile of the lens to obtain the number of valid pixels; and performing integrity check on the edge profile of the lens based on the number of valid pixels; When it is determined that the edge profile of the lens is complete, fitting the edge profile of the lens to obtain a fitting profile and geometric parameters of the fitting profile to be tested; Performing geometric verification on the to-be-verified geometric parameters based on pre-configured lens parameters, and obtaining geometric parameters of the edge profile of the lens through the geometric verification of the to-be-verified geometric parameters; Constructing an image template based on the edge profile of the lens , get the edge contour image .

6. The defect detection method for printed contact lenses based on cloud-machine vision according to claim 1, characterized in that: The pre-configured detection parameters include minimum length, minimum width, minimum area and minimum grayscale value; The feature information list is analyzed based on the pre-configured detection parameters. Perform traversal filtering to obtain the incomplete detection results of each contour, including: The feature information list Middle The characteristic information of each contour is compared with the minimum length, the minimum width and the minimum area; In the The length of the contour Greater than the minimum length, width is greater than the minimum width, and the area When the area is greater than the minimum area, The average gray value of the contour comparing with the minimum grayscale value; In the The average gray value of the contour When the gray value is greater than the minimum gray value, the The first contour has no incomplete defects; otherwise, it is determined that the There are incomplete defects in the outline.

7. The defect detection method for printed contact lenses based on cloud-machine vision according to claim 5, characterized in that: Performing printing area foreign body detection and optical area foreign body detection on the process image includes: Extracting a printing area image and an optical area image in the process image based on geometric parameters of an edge profile of the lens; Performing mask processing on the process image based on the printing area image and the optical area image to obtain an optical area effective image and a printing area effective image; Extract all contours to be detected from the optical area effective image or the printing area effective image; Compare all the contours to be detected with the pre-configured minimum detection area of ​​foreign objects, and take the contours to be detected whose contour area is larger than the minimum detection area of ​​foreign objects as the detected contours; Extracting foreign body features of the detected contour, wherein the foreign body features include the length of the minimum circumscribed rectangle, contour density, the aspect ratio of the minimum circumscribed rectangle, the roundness and circularity of the detected contour, and the average grayscale and grayscale variance within the detected contour; All detected contours are filtered based on pre-configured foreign body detection parameters and the foreign body features of the detected contours, wherein the foreign body detection parameters include the shortest detected size, the detected density interval, the detected aspect ratio interval, the detected roundness interval, the detected roundness ratio interval, the detected gray value interval, and the detected gray variance interval; the screening conditions include: the length of the minimum circumscribed rectangle is greater than the shortest detected size, the contour density is within the detected density interval, the aspect ratio of the minimum circumscribed rectangle is within the detected aspect ratio interval, the roundness of the detected contour is within the detected roundness interval, the roundness of the detected contour is within the detected roundness interval, the average gray within the detected contour is within the detected gray value interval, and the gray variance within the detected contour is within the detected gray variance interval; Performing gradient extraction on the target area within the detected contour that has passed the screening to obtain a gradient image; The gradient image is morphologically processed to obtain a portion of the gradient image that meets the foreign matter defect, and the number of pixels in the portion that meets the foreign matter defect is counted; when the number of pixels in the portion that meets the foreign matter defect is greater than a preset foreign matter pixel number threshold, it is determined that the printing area image and the optical area image have foreign matter defects.

8. The defect detection method for printed contact lenses based on cloud-machine vision according to claim 7, characterized in that: Extracting the printing area and the optical area in the process image based on the geometric parameters of the edge profile of the lens comprises: Performing polar coordinate transformation on the process image based on geometric parameters of the edge profile of the lens to obtain a polar coordinate image, wherein the printed area in the polar coordinate image is in the shape of a vertical strip; Projecting the polar coordinate image along the vertical direction to obtain a one-dimensional vector, wherein the one-dimensional vector includes the number of printed textures at multiple positions; Determine the starting point coordinates and the ending point coordinates of the printing area from the one-dimensional vector based on a preset printing area outer contour threshold and a printing area inner contour threshold; The starting point coordinates and the ending point coordinates of the printing area are verified based on pre-set verification parameters, wherein the verification parameters include a threshold value of the outer contour of the printing area, a minimum radius of the printing ring, and a radius of the outer contour of the printing ring; When checking the starting point coordinates and the ending point coordinates of the printing area, constructing the printing area based on the starting point coordinates and the ending point coordinates of the printing area; The optical zone is determined based on the printed area and the edge contour of the lens.

9. A defect detection system for printed contact lenses based on cloud-machine vision, characterized in that: include: An acquisition module, used for acquiring an original image of the contact lens; A preprocessing module, used for preprocessing the original image to obtain a process image; a lens determination module, configured to extract contour features of the process image, and determine whether a lens exists in the process image based on the contour features of the process image; The defect detection module is used to perform bilateral defect detection, edge defect detection, printing area foreign matter detection and optical area foreign matter detection on the process image when there is a lens in the process image, and perform edge defect detection on the process image, including: extracting the edge contour image of the lens and the geometric parameters of the edge contour from the process image; performing convex hull extraction on the edge contour to obtain a convex hull image; performing a difference operation between the convex hull image and the edge contour image to obtain a difference image; extracting the contour in the difference image to obtain a contour set; and extracting the feature information of each contour in the contour set to obtain a feature information list , wherein the feature information includes geometric information and grayscale information, and the feature information list The mathematical expression is: In the formula, For the The characteristic information of the contour, For the The geometric information of the contour, For the The grayscale information of the contour, For the The area of ​​the contour, For the The length of the minimum circumscribed rectangle of the contours, For the The width of the minimum bounding rectangle of the contour, For the The average gray value of the bounding box of the contour; the feature information list based on the pre-configured detection parameters Perform traversal filtering to obtain the incomplete detection results of each contour.

Citation Information

Patent Citations

  • High-precision contact lens edge defect detection method and system based on machine vision

    CN117269179A