Contact lens edge detection method and system based on cloud-machine vision

Cloud-machine vision technology is used to perform edge detection on contact lenses, extract contour features and filter detection parameters, solving the problems of low edge detection efficiency and missed detection in the existing technology, and achieving high-precision edge defect detection.

CN118570238APending Publication Date: 2024-08-30SIGMA SQUARES (BEIJING) TECH CO LTD

Patent Information

Application Number
CN202410714653.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the existing technology, contact lens edge detection is prone to missed detections and has low efficiency, mainly because it is difficult for manual quality inspection to accurately detect small edge defects.

Method used

An edge detection method based on cloud-machine vision is used to preprocess the process image of the contact lens, extract contour features, generate a contour collection, filter and detect the feature information list, and use pre-configured detection parameters to determine the integrity of the lens edge. sex.

Benefits of technology

It improves the accuracy and efficiency of contact lens edge detection, can accurately identify edge defects of lenses, and reduces missed detections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570238A
    Figure CN118570238A
Patent Text Reader

Abstract

The invention relates to a contact lens edge detection method and system based on cloud-machine vision. The method comprises the following steps: acquiring a process image of a contact lens; 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 the lens exists in the process image, extracting an edge contour image of the lens from the process image; generating a contour set based on the edge contour image and the process image, and extracting feature information of each contour in the contour set to obtain a feature information list; and performing traversal filtering on the feature information list based on a pre-configured detection parameter to obtain an incomplete detection result of each contour. According to the method, whether the lens exists in the process image or not is judged firstly, when the lens exists, the contour in the process image is extracted firstly, then the features of the contour are extracted, finally, the features and the pre-configured parameters are compared and filtered, detection can be completed, and high detection precision and detection efficiency are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine vision, and in particular to an edge detection method and system for 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 in the production process, such as edge defects.

[0003] In the prior art, edge defects of contact lenses are generally detected by manual quality inspection. Since the edge defects may be very small, it is easy to miss the detection. In addition, the detection efficiency is low. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a contact lens edge detection method and system based on cloud-machine vision to solve the problem of easy missed detection and low efficiency in contact lens edge detection in the prior art.

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

[0006] The edge detection method of contact lenses based on cloud-machine vision of the present invention comprises:

[0007] Acquire a process image of the contact lens, wherein the process image is generated based on preprocessing an original image of the contact lens;

[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, extracting an edge contour image of the lens from the process image;

[0010] Generate a contour set based on the edge contour image and the process image, and extract feature information of each contour in the contour set to obtain a feature information list;

[0011] The feature information list is traversed and filtered based on pre-configured detection parameters to obtain an incomplete detection result for each contour.

[0012] In one embodiment of the present application, obtaining a process image of a contact lens includes:

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

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

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

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

[0017] 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:

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

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

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

[0021] In one embodiment of the present application, generating a contour set based on the edge contour image and the process image includes:

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

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

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

[0025] Contours in the differential image are extracted to obtain a contour set.

[0026] In an embodiment of the present application, feature information of each contour in the contour set is extracted to obtain a feature information list, including:

[0027] Calculate the bounding box of each contour in the contour set to obtain the minimum circumscribed rectangle of each contour;

[0028] Extracting the area area of ​​each contour, and extracting the length ι and width w of the corresponding minimum circumscribed rectangle, and constructing geometric information based on the area area of ​​the contour, the length l and the width w of the minimum circumscribed rectangle;

[0029] A mask is constructed based on the contour within the minimum enclosing rectangle, and the process image is cropped based on the mask and the minimum enclosing rectangle to obtain a cropped image sub_pro i',j', the cropped image sun_pro i',j' And the mathematical expression of mask is:

[0030] sub_pro i',j' =Process Image i-x,j-y *mask i-x,j-y

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

[0032]

[0033] Among them, (i, j) is the original image coordinate, (x, y) is the starting point coordinate in the minimum bounding rectangle, (i', j') is the cropped image coordinate, and contour is the contour set;

[0034] Extract the cropped image sub_pro i',j' Grayscale information gray, where gray = mean (sub_pro);

[0035] Construct a feature information list DefectList based on the geometric information and grayscale information of each contour in the contour set.

[0036] In an embodiment of the present application, the mathematical expression of the feature information list DefectList is:

[0037] DefectList={f1,f2,f3,…f i}

[0038]

[0039] f i_gray = {gray i}

[0040] In the formula, f1,f2,f3,…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 grayscale value of the bounding box of the i-th contour.

[0041] In one embodiment of the present application, extracting an edge contour image of a lens from the process image includes:

[0042] Extracting edge contours in the process image to obtain a contour image;

[0043] Screening the contours in the 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;

[0044] 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;

[0045] 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;

[0046] 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;

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

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

[0049] 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:

[0050] 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;

[0051] 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;

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

[0053] In one embodiment of the present application, the detection results are packaged and output to the target object.

[0054] The present application also provides a contact lens edge detection system based on cloud-machine vision, including:

[0055] An acquisition module, used for acquiring a process image of the contact lens, wherein the process image is generated based on preprocessing an original image of the contact lens;

[0056] A judgment module, used for 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;

[0057] An edge extraction module, used for extracting an edge contour image of the lens from the process image when the lens exists in the process image;

[0058] A feature extraction module, used for generating a contour set based on the edge contour image and the process image, and extracting feature information of each contour in the contour set to obtain a feature information list;

[0059] The detection module is used to traverse and filter the feature information list based on pre-configured detection parameters to obtain an incomplete detection result for each contour.

[0060] The beneficial effects of the present invention are as follows: the edge detection method and system of contact lenses based on cloud-machine vision of the present invention obtains a process image of the contact lens; extracts the contour features of the process image, and determines 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, extracts the edge contour image of the lens from the process image; generates a contour set based on the edge contour image and the process image, and extracts the feature information of each contour in the contour set to obtain a feature information list; traverses and filters the feature information list based on pre-configured detection parameters to obtain an incomplete detection result for each contour. The present application first determines whether there is a lens in the process image. When a lens exists, the contour in the process image is first extracted, and then the features of the contour are extracted. Finally, the features are compared and filtered with the pre-configured parameters to complete the detection, and the detection has high detection accuracy and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0063] Figure 2 A flowchart of the edge detection method of contact lenses based on cloud-machine vision in this application;

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

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

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

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

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

[0069] Figure 8 A schematic diagram of a result output object in an embodiment of the present application;

[0070] Fig. 9 This is a structural diagram of the edge detection system for contact lenses based on cloud-machine vision in this application. DETAILED DESCRIPTION

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

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

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

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

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

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

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

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

[0079] 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;

[0080] 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;

[0081] S4, when there is a lens in the process image, performing edge defect detection on the process image.

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

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

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

[0085] A. Preprocessing and initialization configuration;

[0086] 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:

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

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

[0089] 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's major and minor axes DDiff, the lens's aspect ratio AspectRatio, etc.

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

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

[0092] For step S4: the minimum Crack detection size, including length minCrackLength, width minCrackWidth, minimum Crack detection area minCrackArea, minimum detection grayscale minCrackGray, etc.

[0093] A2. Pretreatment:

[0094] 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:

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

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

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

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

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

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

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

[0102] Figure 5The 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:

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

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

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

[0106] B3, counting the contour pixel points to obtain the number of contour pixel points PixNum;

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

[0108] 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:

[0109]

[0110] C. Edge defect detection

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

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

[0113] Figure 7 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 7As 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:

[0114] C11, extracting edge contours in the process image to obtain an edge contour image;

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

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

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

[0118] The specific screening process includes:

[0119] C121, extracting geometric parameters of the contour in the edge contour image, wherein the geometric parameters of the contour include a major axis diameter a1, a minor axis diameter b1, an average diameter d1, a diameter difference dif1, and an aspect ratio asp1, d1 = mean(a1, b1), dif1 = abs(a1-b1), asp1 = b1 / a1;

[0120] C122, 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:

[0121] The average diameter d1 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0122] The aspect ratio asp1 is greater than or equal to the lens aspect ratio ASPectRatio;

[0123] The diameter difference dif1 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

[0124] The expression of the screening process is:

[0125]

[0126] C13, 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;

[0127] After obtaining the edge contour of the contact lens, it is necessary to perform a completeness check. The complete contour can be directly fitted to obtain the complete elliptical lens contour. The incomplete contour cannot be fitted.

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

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

[0130] The expression for integrity check is:

[0131]

[0132] C14, 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;

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

[0134] The geometric parameters of the fitted ellipse of the corresponding contour are obtained, which are the major axis diameter a2, the minor axis diameter b2, the average diameter d2, the diameter difference dif2 and the aspect ratio asp2, where d2=mean(a2,b2), dif2=abs(a2-b2), asp2=b2 / a2 (a2≠0).

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

[0136] The method of geometric verification is consistent with the screening process in step C12, including:

[0137] 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:

[0138] The average diameter d2 is within the intersection interval DMaxRange&DMinRange of the longest diameter interval DMaxRange and the shortest diameter interval DMinRange;

[0139] The aspect ratio asp2 is greater than or equal to the lens aspect ratio ASPectRatio;

[0140] The diameter difference dif2 is within the maximum tolerance threshold range DDiff of the major and minor axes of the lens.

[0141] Its expression is:

[0142]

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

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

[0145] Finally, use Cnt to construct the template image RoI and obtain the required edge image ECge. The expression is:

[0146]

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

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

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

[0150] C4, 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:

[0151] DefectList={f1,f2,f3,…fi}

[0152]

[0153] f i_gray = {gray i}

[0154] Where f1, f2, f3, … 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;

[0155] 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:

[0156] sub_pro i',j' =Process Image i-x,j-y *mask i-x,j-y

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

[0158]

[0159] 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:

[0160] gray=mean(sub_pro)

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

[0162] 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:

[0163] 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:

[0164] C51, 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;

[0165] C52, 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:

[0166]

[0167] C53, the average gray value of 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:

[0168]

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

[0170] Figure 8 Schematic diagram of the result output object in one embodiment of the present application, such as Figure 8 As shown, the detection results are finally packaged and output to the target object. Through the relevant API, the product detection result Res corresponding to the image analyzed by the above process 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.

[0171] The edge detection method of contact lenses based on cloud-machine vision of the present invention obtains a process image of the contact lens; extracts the contour features of the process image, and determines 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, extracts the edge contour image of the lens from the process image; generates a contour set based on the edge contour image and the process image, and extracts the feature information of each contour in the contour set to obtain a feature information list; traverses and filters the feature information list based on pre-configured detection parameters to obtain an incomplete detection result for each contour. The present application first determines whether a lens exists in the process image. When a lens exists, the contour in the process image is first extracted, and then the features of the contour are extracted. Finally, the features are compared and filtered with the pre-configured parameters to complete the detection, and the detection has high detection accuracy and efficiency.

[0172] like Fig. 9 As shown, the present application also provides an edge detection system for contact lenses based on cloud-machine vision, including:

[0173] An acquisition module, used for acquiring a process image of the contact lens, wherein the process image is generated based on preprocessing an original image of the contact lens;

[0174] A judgment module, used for 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;

[0175] An edge extraction module, used for extracting an edge contour image of the lens from the process image when the lens exists in the process image;

[0176] A feature extraction module, used for generating a contour set based on the edge contour image and the process image, and extracting feature information of each contour in the contour set to obtain a feature information list;

[0177] The detection module is used to traverse and filter the feature information list based on pre-configured detection parameters to obtain an incomplete detection result for each contour.

[0178] The edge detection system for contact lenses based on cloud-machine vision of the present invention obtains a process image of the contact lens; extracts contour features of the process image, and determines 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, extracts an edge contour image of the lens from the process image; generates a contour set based on the edge contour image and the process image, and extracts feature information of each contour in the contour set to obtain a feature information list; traverses and filters the feature information list based on pre-configured detection parameters to obtain an incomplete detection result for each contour. The present application first determines whether a lens exists in the process image. When a lens exists, the contour in the process image is first extracted, and then the features of the contour are extracted. Finally, the features are compared and filtered with the pre-configured parameters to complete the detection, and the detection has high detection accuracy and efficiency.

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

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

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

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

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

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

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

[0186] In the above-mentioned embodiments, although the present invention has been described in conjunction with the specific embodiments of the present invention, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art according to the foregoing description. The embodiments of the present invention are intended to cover all such replacements, modifications and variations falling within the broad scope of the appended claims.

[0187] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A contact lens edge detection method based on cloud-machine vision, characterized in that: Includes steps: Acquire a process image of the contact lens, wherein the process image is generated based on preprocessing an original image of the contact lens; 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, extracting an edge contour image of the lens from the process image; Generate a contour set based on the edge contour image and the process image, and extract feature information of each contour in the contour set to obtain a feature information list; The feature information list is traversed and filtered based on pre-configured detection parameters to obtain an incomplete detection result for each contour.

2. The edge detection method of contact lenses based on cloud-machine vision according to claim 1, characterized in that: Acquire images of contact lens process, including: Acquire a raw image of the contact lens; Convert the original image from RAW format to RGB format to obtain an intermediate image; Transforming the first 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 edge detection method of 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 edge detection method of contact lenses based on cloud-machine vision according to claim 1, characterized in that: Generating a contour set based on the edge contour image and the process image comprises: Extracting an edge profile image of the lens and geometric parameters of the edge profile from the process image; Performing convex hull extraction on the edge contour image to obtain a convex hull image; Performing a difference operation on the convex hull image and the edge contour image to obtain a difference image; Contours in the differential image are extracted to obtain a contour set.

5. The edge detection method of contact lenses based on cloud-machine vision according to claim 1, characterized in that: Extract feature information of each contour in the contour set to obtain a feature information list, including: Calculate the bounding box of each contour in the contour set to obtain the minimum circumscribed rectangle of each contour; Extracting the area area of ​​each contour, and extracting the length l and width w of the corresponding minimum circumscribed rectangle, and constructing geometric information based on the area area of ​​the contour, the length l and the width w of the minimum circumscribed rectangle; A mask is constructed based on the contour within the minimum enclosing rectangle, and the process image is cropped based on the mask and the minimum enclosing rectangle to obtain a cropped image sub_pro i,j′ , the cropped image sub_pro i′,j′ And the mathematical expression of mask is: sub_pro i′,j′ =Process Image i-x,j-y *mask i-x,j-y (0≤i′ <h,0≤j′<w) Where (i, j) is the original image coordinate, (x, y) is the starting point coordinate within the minimum bounding rectangle, (i′, j′) is the cropped image coordinate, and contour is the contour set; Extract the cropped image sub_pro i′,j′ Grayscale information gray, where gray = mean (sub_pro); Construct a feature information list DefectList based on the geometric information and grayscale information of each contour in the contour set.

6. The edge detection method of contact lenses based on cloud-machine vision according to claim 5, characterized in that: The mathematical expression of the feature information list DefectList is: DefectList={f1,f2,f3,...f i } f i_gray ={gray i } Where, f1, f2, f3, ... 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 grayscale value of the bounding box of the i-th contour.

7. The edge detection method of contact lenses based on cloud-machine vision according to claim 1, characterized in that: Extracting an edge contour image of the lens from the process image comprises: Extracting edge contours in the process image to obtain a contour image; Screening the contours in the 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; An image template RoI is constructed based on the edge contour of the lens to obtain an edge contour image Edge.

8. The edge detection method of contact lenses based on cloud-machine vision according to claim 6, characterized in that: The pre-configured detection parameters include minimum length, minimum width, minimum area and minimum grayscale value; 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: 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; 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; 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.

9. The edge detection method of contact lenses based on cloud-machine vision according to claim 1, characterized in that: Package the detection results and output them to the target object.

10. The edge detection system of contact lenses based on cloud-machine vision is characterized in that: include: An acquisition module, used for acquiring a process image of the contact lens, wherein the process image is generated based on preprocessing an original image of the contact lens; A judgment module, used for 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; An edge extraction module, used for extracting an edge contour image of the lens from the process image when the lens exists in the process image; A feature extraction module, used for generating a contour set based on the edge contour image and the process image, and extracting feature information of each contour in the contour set to obtain a feature information list; The detection module is used to traverse and filter the feature information list based on pre-configured detection parameters to obtain an incomplete detection result for each contour.

Citation Information

Patent Citations

  • Method for extracting morphologic characteristic of human body bare footprint feature

    CN101327126A

  • Real-time dynamic target tracking method and device

    CN106875369A

  • Medical ultrasonic image recognition method and device and storage medium

    CN114757953A

  • Pantograph carbon slide strip defect detection method based on image

    CN115631146A

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

    CN117269179A

Cited By

  • Blood barrel opening flaw detection method and device based on cloud-machine vision

    CN119648684A

  • A cloud-machine vision-based blood barrel mouth flaw detection method and device

    CN119648684B