Large-curvature lens appearance detection method and system based on RGB three-channel single shooting
By employing an RGB three-channel single-shot method and a deep learning model, the problems of glare interference and inefficient processes in the inspection of high-curvature lenses are solved, achieving efficient and accurate lens defect detection. This method is suitable for single or batch inspection of lenses of different specifications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG UNIV OF TECH
- Filing Date
- 2026-01-19
- Publication Date
- 2026-06-12
Smart Images

Figure CN122193256A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of optical component appearance inspection, and in particular to a method and system for appearance inspection of large curvature lenses based on a single RGB three-channel image capture. Background Technology
[0002] In recent years, the lens manufacturing industry has experienced rapid development and accelerated upgrading, leading to increasingly fierce market competition and ever-rising demands from end-users for product quality. This has made manufacturers increasingly focused on quality control of lens defects. Lens appearance defects, as one of the core indicators for evaluating component quality, are affected by various factors such as material properties, processing technology, and environmental conditions. Surface defects such as scratches, bubbles, and cracks are prone to occur during the production process. These defects not only reduce the optical performance of imaging systems but may also pose potential safety hazards. Therefore, conducting reliable and accurate lens appearance defect detection is crucial and a fundamental step in ensuring the overall performance and stability of optical systems.
[0003] Currently, manual inspection is still widely used in the industry for lens appearance inspection. However, manual inspection relies on operator experience, resulting in low efficiency, high subjectivity, and a high risk of missed or false detections. In recent years, machine vision inspection technology has become a major alternative to manual inspection due to its advantages such as high speed and stability. The existing machine vision inspection technologies for lens appearance mainly include the following:
[0004] Coaxial light source defect detection: The light source is diffused by a diffuser onto a semi-transparent, semi-reflective beam splitter. The light from the beam splitter is reflected onto the object under test, and then reflected again by the object to the CCD camera. Due to the characteristics of coaxial light sources, only flawless objects can reflect light into the CCD camera. Uneven or flawed objects will reflect light elsewhere, thus appearing dark in the image. However, this technique is only suitable for flat lenses or lenses with very small curvature. There is an inherent contradiction between the curved surface characteristics of high-curvature lenses and the requirements of imaging systems. The surface curvature causes uneven illumination and reduces the effective area for clear imaging. This problem directly restricts the realization of machine vision-based lens surface integrity detection technology.
[0005] Dark-field ring-lit inspection: In a dark environment, a ring light source is used to illuminate and inspect a high-curvature lens at an extremely low angle. Because the lens is cut and has rough sides, the edges appear brighter. When the workpiece is flawless, the light entering it is transmitted or refracted, resulting in a dark image of the center. If the workpiece has defects, the defective areas will be brightly imaged, while flawless areas will be dark. This method is highly useful for machine vision inspection of lens defects, significantly reducing background light interference and highlighting defects. While illuminating the lens with a ring light all at once can illuminate the lens and achieve comprehensive inspection of defects in high-curvature lenses, severe overexposure glare at the edges of the lens can mask surface defects in that area, posing a fundamental challenge to the integrity of machine vision inspection. Localized loss of image information directly prevents accurate measurement of the entire lens surface.
[0006] Dark-field imaging defect detection: To address the glare problem inherent in ring lighting, a multi-angle, multiple-stage lighting scheme is adopted. This method effectively overcomes the insufficient defect contrast caused by the averaging of light direction in single-stage lighting schemes such as ring lighting by sequentially switching illumination sources at different angles and simultaneously acquiring images. Its core advantage lies in its ability to obtain optimal imaging results for scratches in specific directions and to analyze the three-dimensional morphology of defects through multi-angle shadow variations. However, the main limitation of this strategy is the need for multiple lighting and image acquisition stages, as well as further image processing of the acquired images, which significantly increases the inspection time per product and makes it difficult to meet the high-speed production efficiency requirements of industrial settings.
[0007] In summary, due to the inevitable glare interference caused by the curved surface of large curvature lenses and the inefficiency of the process caused by multi-angle detection, existing technologies still cannot achieve high-precision and rapid detection of appearance defects in large curvature lenses. Summary of the Invention
[0008] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for appearance inspection of large curvature lenses based on a single RGB three-channel image capture.
[0009] To achieve the above objectives, the technical solution provided by this invention is as follows:
[0010] A method for appearance inspection of large curvature lenses based on a single RGB three-channel image capture includes:
[0011] The large curvature lens under test is illuminated from different angles by red, blue, and green light sources. The image acquisition module is placed directly above the large curvature lens under test to acquire images of the lens and transmits the acquired images to the detection module.
[0012] The detection module processes the acquired images as follows:
[0013] The base groove detection algorithm identifies the base grooves that support and are adapted to the large curvature lens under test from the acquired images, and obtains the detection mask image of the base grooves.
[0014] The acquired image is subjected to channel separation to obtain three grayscale images with different channels: red, green, and blue.
[0015] By combining the detection mask image of the base groove and three grayscale images of different channels, the detection results of the three channels are obtained through the lens defect detection algorithm;
[0016] The detection results from the three channels are fused and mapped onto the initially acquired image to obtain the final detection result.
[0017] Furthermore, the base groove for supporting the large curvature lens under test is identified from the acquired image using a base groove detection algorithm, including:
[0018] The acquired images are converted to grayscale.
[0019] The Hough circle transform algorithm is used to identify the circular outline of the base groove from the grayscale image;
[0020] Based on the identified circular outline of the base groove, a detection mask image of the base groove is obtained. This image retains only the area within the base groove, which is the effective detection area where the large curvature lens under test is located. Background areas, dust, and bubble interference factors outside the base groove are marked as invalid areas, thereby achieving precise isolation of the effective detection area.
[0021] Furthermore, the Hough circle transform algorithm is used to identify the circular outline of the base groove from the grayscale image, including:
[0022] Define an accumulator array ,in Let the coordinates be the center of the circle. The accumulator size is determined by the image size and the possible range of circle radii, where the radius is the circle radius.
[0023] For each edge pixel in the grayscale image According to Cartesian equation of a circle Derivation of all possible For each valid parameter combination, a vote is taken at the corresponding position in the accumulator array.
[0024] Traversing the accumulator array The system filters out parameter combinations that have more votes than a preset threshold. These parameter combinations correspond to potential circular structures in the image. Then, it uses a non-maximum suppression algorithm to remove duplicate or falsely detected circular results. Finally, it determines the accurate center coordinates and radius of the large curvature lens and the base groove, thus identifying the circular outline of the base groove.
[0025] Furthermore, the detection results for three channels are obtained through a lens defect detection algorithm, including:
[0026] We construct an image dataset of large curvature lenses with defects and a large curvature lens appearance detection model. We preprocess the constructed image dataset and divide the preprocessed image dataset into a training set and a test set.
[0027] Image labeling software was used to identify defects in the training and test sets.
[0028] The training set after defect labeling is input into the large curvature lens appearance detection model for training. Then, the test set is input into the trained large curvature lens appearance detection model to test and evaluate the training effect of the large curvature lens appearance detection model.
[0029] The detection mask image of the base groove corresponding to the large curvature lens under test and three grayscale images of different channels are input into the appearance detection model of the large curvature lens that has passed the test, so as to obtain the detection results of the three channels.
[0030] Furthermore, an image dataset of large curvature lenses with defects is constructed, including:
[0031] A diffusion generation model for images of flawed, high-curvature lenses is constructed. This model uses an improved U-Net-based network to adapt to the local feature extraction of lens images.
[0032] Input a real, flawed lens grayscale image into the flawed large curvature lens image diffusion generation model, and train the flawed large curvature lens image diffusion generation model. The training process includes forward noise addition and reverse noise reduction.
[0033] The forward noise addition process transforms a real image into a completely noisy image by progressively adding Gaussian noise. The process is as follows:
[0034] Noise definition: Random noise Follows a normal distribution , The noise variance is adaptively adjusted based on image features.
[0035] Noise addition formula: based on the number of iterations Gradually update the image The formula is:
[0036]
[0037] in, This is a preprocessed, realistic, and flawed grayscale image of the lens; This is the cumulative noise dispatch coefficient;
[0038] Iteration terminates: when When the preset maximum number of steps is reached, The image becomes completely noisy, completing the forward pass.
[0039] Conversely, in reverse denoising, a diffusion generation model for training images of flawed, highly curved lenses is used to generate images from completely noisy images. The process of reconstructing a grayscale image of a lens with true defect features from a mid-to-high-resolution image is as follows:
[0040] A loss function is constructed with the goal of minimizing the pixel error between the denoised image and the real image;
[0041] Model learning from arrive The denoising mapping is achieved by iteratively optimizing network parameters using the gradient descent algorithm; the denoising mapping formula is as follows:
[0042]
[0043] in, Step size The corresponding denoised image; This is the single-step noise scheduling coefficient; For parameters Predictive noise at that time; The standard deviation of the reverse process noise; For random noise that follows a normal distribution;
[0044] Training termination condition: When the loss function value of the model on a subset of the training set tends to stabilize, and the similarity between the defect features and surface characteristics of the generated image and the real image meets the preset threshold, training is stopped, and the final defect lens diffusion generation model is obtained.
[0045] A real, flawed lens grayscale image is input into the final flawed lens diffusion generation model to generate a large number of fake, flawed lens grayscale images.
[0046] By merging real and flawed lens grayscale images with fake and flawed lens grayscale images, an image dataset of flawed high-curvature lenses is constructed.
[0047] Furthermore, the detection results from the three channels are fused and mapped onto the initially acquired image, including:
[0048] In the detection results of each channel, each defect is marked by a corresponding detection box. After summarizing the detection results of the three channels, the detection boxes of all defects are arranged according to size, and the coordinates of the upper left corner and the lower right corner of each detection box are calculated.
[0049] Determine the intersection region of adjacent detection boxes:
[0050] Let there be two bounding boxes A and B, with the coordinates of the top-left corner of A being... The coordinates of the lower right corner of A are The coordinates of the top left corner of B are The coordinates of the lower right corner of B are ( The coordinates of the top-left corner of the intersection region of the two detection boxes are: The coordinates of the lower right corner of the intersection region are ;
[0051] Calculate the intersection area of the detection boxes:
[0052] If an intersection exists, the area of the intersection of the detection boxes is:
[0053] ;
[0054] If the intersection region does not exist, that is, the two detection boxes do not overlap at all, then the intersection area is 0;
[0055] Calculate the area of the union of the detection boxes:
[0056]
[0057] The areas of A and B are as follows:
[0058]
[0059]
[0060] Calculate the Intersection over Union (IoU) of the detection boxes:
[0061]
[0062] When IoU = 1, detection boxes A and B completely overlap; when IoU = 0, detection boxes A and B do not overlap at all. When detection boxes A and B partially overlap, the larger the IoU value, the higher the degree of overlap.
[0063] In the aggregated defect detection frames, if the IoU value calculated for each pair of detection frames is greater than the preset IoU threshold, then the two detection frames are considered to belong to the same defect, and only the detection frame with the largest size is retained.
[0064] All retained detection boxes are merged and mapped onto the initially acquired image.
[0065] Furthermore, to achieve the above objectives, the present invention also provides a large curvature lens appearance inspection system based on RGB three-channel single-shot imaging, used to implement the above-mentioned large curvature lens appearance inspection method based on RGB three-channel single-shot imaging, which includes a red light source, a blue light source, a green light source, an image acquisition module, and a detection module.
[0066] in,
[0067] The red, blue, and green light sources are used to illuminate the large curvature lens under test from different angles;
[0068] The image acquisition module is positioned directly above the large curvature lens being tested to acquire an image of the lens and transmits the acquired image to the detection module.
[0069] The detection module performs detection on the images acquired by the image acquisition module to obtain the final detection result.
[0070] Furthermore, the detection module includes a base groove detection unit, a channel separation unit, a single-channel lens defect detection unit, a single-channel detection result fusion unit, and a mapping unit;
[0071] The base groove detection unit is used to identify the base groove that is used to support the large curvature lens under test and is adapted to the large curvature lens under test from the acquired image, and to obtain the detection mask image of the base groove.
[0072] The channel separation unit is used to perform channel separation on the acquired image to obtain three grayscale images with different channels: red, green, and blue.
[0073] The single-channel lens defect detection unit, combining the detection mask image of the base groove and three grayscale images of different channels, obtains the detection results of the three channels through the lens defect detection algorithm;
[0074] The single-channel detection result fusion unit is used to fuse the detection results of the three channels;
[0075] The mapping unit is used to map the fused detection results onto the initially acquired image to obtain the final detection result.
[0076] Compared with existing technologies, the principles and advantages of this technical solution are as follows:
[0077] 1. By simultaneously illuminating the large curvature lens from different angles using RGB three-color light sources, a color image containing three-channel information can be acquired in a single shot with the help of a 3CMOS industrial camera. This eliminates the need for multiple lighting and shooting sessions, significantly shortening the inspection time, improving inspection efficiency, and meeting the high-speed production needs of industrial sites.
[0078] 2. Inheriting the advantages of multi-angle lighting detection, the physical separation of the RGB three channels can effectively reduce glare interference, allowing defects hidden in the high-brightness area of one channel to be clearly displayed in other channels, achieving complete detection of the entire surface of a large curvature lens.
[0079] 3. A deep learning model is used for defect identification, and Hough circle transform is used to accurately locate the lens area, which can eliminate background interference and achieve a high detection accuracy.
[0080] 4. Applicable to the inspection of large curvature lenses of different specifications, supporting simultaneous inspection of single lenses and batch lens groups (such as 2×2, 4×3 arrangement). Attached Figure Description
[0081] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0082] Figure 1 This is a schematic diagram of an appearance inspection system for large curvature lenses based on a single RGB three-channel image capture according to the present invention;
[0083] Figure 2 This is a connection block diagram of each unit inside the detection module of the appearance inspection system for large curvature lenses based on RGB three-channel single-shot imaging, according to the present invention.
[0084] Figure 3 This is a flowchart illustrating the principle of an appearance inspection method for large curvature lenses based on a single RGB three-channel image capture, according to the present invention.
[0085] Figure 4 This is an image acquired by the image acquisition module in the appearance inspection method for large curvature lenses based on a single RGB three-channel image capture according to the present invention.
[0086] Figure 5 This is the detection mask image for the base groove;
[0087] Figure 6 These are three grayscale images of different channels (red, green, and blue) obtained after channel separation.
[0088] Figure 7 The detection results of the three corresponding red, green, and blue channels are obtained by combining the detection mask image of the base groove and three grayscale images of different channels;
[0089] Figure 8 This is a fake, flawed lens grayscale image generated by the final flawed lens diffusion generation model.
[0090] Figure 9 The final detection result image is obtained by fusing the detection results of the red, green and blue channels and mapping them onto the initially acquired image.
[0091] Figure label:
[0092] 1-Red light source; 2-Blue light source; 3-Green light source; 4-Image acquisition module; 5-Detection module; 6-Base groove detection unit; 7-Channel separation unit; 8-Single-channel lens defect detection unit; 9-Single-channel detection result fusion unit; 10-Mapping unit; 11-Large curvature lens under test. Detailed Implementation
[0093] The present invention will be further described below with reference to specific embodiments:
[0094] like Figure 1 As shown in the figure, the appearance inspection system for large curvature lenses based on RGB three-channel single-shot imaging in this embodiment includes a red light source 1 with a wavelength of 620-645 nm, a blue light source 2 with a wavelength of 460-490 nm, a green light source 3 with a wavelength of 520-550 nm, an image acquisition module 4, and a detection module 5.
[0095] in,
[0096] Red light source 1, blue light source 2, and green light source 3 are used to illuminate the large curvature lens 11 under test from different angles; the image acquisition module 4 is placed directly above the large curvature lens 11 under test to acquire images of the large curvature lens 11 under test, and transmits the acquired images to the detection module 5; the detection module 5 detects the images acquired by the image acquisition module 4 to obtain the final detection results.
[0097] Specifically, such as Figure 2 As shown, the detection module 5 includes a base groove detection unit 6, a channel separation unit 7, a single-channel lens defect detection unit 8, a single-channel detection result fusion unit 9, and a mapping unit 10;
[0098] Among them, the base groove detection unit 6 is used to identify the base groove that is used to support the large curvature lens 11 under test and is adapted to the large curvature lens 11 under test from the acquired image, and obtain the detection mask image of the base groove.
[0099] The channel separation unit 7 is used to perform channel separation on the acquired image to obtain three grayscale images with different channels: red, green, and blue.
[0100] The single-channel lens defect detection unit 8 combines the detection mask image of the base groove with three grayscale images of different channels to obtain the detection results of the three channels through the lens defect detection algorithm.
[0101] The single-channel detection result fusion unit 9 is used to fuse the detection results of the three channels;
[0102] The mapping unit 10 is used to map the fused detection results onto the initially acquired image to obtain the final detection results.
[0103] Specifically, image acquisition module 4 is a 3200w pixel 3CMOS industrial camera.
[0104] like Figure 3 As shown, the working principle of the appearance inspection system for large curvature lenses based on RGB three-channel single-shot imaging is as follows:
[0105] The large curvature lens 11 under test is illuminated from different angles by red light source 1, blue light source 2, and green light source 3. The image acquisition module 4 is positioned directly above the large curvature lens 11 to acquire images of it, and the acquired images (such as...) are then displayed. Figure 4 (As shown) The data is transmitted to detection module 5;
[0106] The detection module 5 processes the acquired images as follows:
[0107] The base groove detection unit 6 uses a base groove detection algorithm to identify the base groove that supports the large curvature lens 11 under test and is adapted to the large curvature lens 11 from the acquired image, and obtains a detection mask image of the base groove, such as... Figure 5 As shown;
[0108] The recognition process is as follows:
[0109] The acquired images are converted to grayscale.
[0110] The circular outline of the base groove was identified from the grayscale image using the Hough circle transform algorithm.
[0111] Define an accumulator array ,in Let the coordinates be the center of the circle. The accumulator size is determined by the image size and the possible range of circle radii, where the radius is the circle radius.
[0112] For each edge pixel in the grayscale image According to Cartesian equation of a circle Derivation of all possible For each valid parameter combination, a vote is taken at the corresponding position in the accumulator array.
[0113] Traversing the accumulator array The system filters out parameter combinations that have more votes than a preset threshold. These parameter combinations correspond to potential circular structures in the image. Then, it uses a non-maximum suppression algorithm to remove duplicate or falsely detected circular results. Finally, it determines the accurate center coordinates and radius of the large curvature lens and the base groove, thus identifying the circular outline of the base groove.
[0114] Based on the identified circular outline of the base groove, a detection mask image of the base groove is obtained. This image retains only the area within the base groove, which is the effective detection area where the large curvature lens under test is located. Background areas, dust, and bubble interference factors outside the base groove are marked as invalid areas, thereby achieving precise isolation of the effective detection area.
[0115] The acquired image is separated into three grayscale images: red, green, and blue, by the channel separation unit 7. Figure 6 As shown;
[0116] The single-channel lens defect detection unit 8 combines the detection mask image of the base groove with three grayscale images of different channels, and obtains the detection results of the three channels through the lens defect detection algorithm, such as... Figure 7 As shown;
[0117] The specific process of obtaining the detection results of the three channels using the lens defect detection algorithm is as follows:
[0118] We construct an image dataset of large curvature lenses with defects and a large curvature lens appearance detection model. We preprocess the constructed image dataset and divide the preprocessed image dataset into a training set and a test set.
[0119] Image labeling software was used to identify defects in the training and test sets.
[0120] The training set after defect labeling is input into the large curvature lens appearance detection model for training. Then, the test set is input into the trained large curvature lens appearance detection model to test and evaluate the training effect of the large curvature lens appearance detection model.
[0121] The detection mask image of the base groove corresponding to the large curvature lens under test and three grayscale images of different channels are input into the appearance detection model of the large curvature lens that has passed the test, so as to obtain the detection results of the three channels.
[0122] The above describes the process of constructing an image dataset of a flawed, high-curvature lens.
[0123] A diffusion generation model for images of flawed, high-curvature lenses is constructed. This model uses an improved U-Net-based network to adapt to the local feature extraction of lens images.
[0124] Input a real, flawed lens grayscale image into the flawed large curvature lens image diffusion generation model, and train the flawed large curvature lens image diffusion generation model. The training process includes forward noise addition and reverse noise reduction.
[0125] The forward noise addition process transforms a real image into a completely noisy image by progressively adding Gaussian noise. The process is as follows:
[0126] Noise definition: Random noise Follows a normal distribution , The noise variance is adaptively adjusted based on image features.
[0127] Noise addition formula: based on the number of iterations Gradually update the image The formula is:
[0128]
[0129] in, This is a preprocessed, realistic, and flawed grayscale image of the lens; This is the cumulative noise dispatch coefficient;
[0130] Iteration terminates: when When the preset maximum number of steps is reached, The image becomes completely noisy, completing the forward pass.
[0131] Conversely, in reverse denoising, a diffusion generation model for training images of flawed, highly curved lenses is used to generate images from completely noisy images. The process of reconstructing a grayscale image of a lens with true defect features from a mid-to-high-resolution image is as follows:
[0132] A loss function is constructed with the goal of minimizing the pixel error between the denoised image and the real image;
[0133] Model learning from arrive The denoising mapping is achieved by iteratively optimizing network parameters using the gradient descent algorithm; the denoising mapping formula is as follows:
[0134]
[0135] in, Step size The corresponding denoised image; This is the single-step noise scheduling coefficient; For parameters Predictive noise at that time; The standard deviation of the reverse process noise; For random noise that follows a normal distribution;
[0136] Training termination condition: When the loss function value of the model on a subset of the training set tends to stabilize, and the similarity between the defect features and surface characteristics of the generated image and the real image meets the preset threshold, training is stopped, and the final defect lens diffusion generation model is obtained.
[0137] A real, flawed lens grayscale image is input into the final flawed lens diffusion generation model to generate a large number of fake, flawed lens grayscale images. Figure 8 The image shown is one of the generated fake and flawed lens grayscale images.
[0138] By merging real and flawed lens grayscale images with fake and flawed lens grayscale images, an image dataset of flawed high-curvature lenses is constructed.
[0139] The single-channel detection result fusion unit 9 fuses the detection results of the three channels and maps the fused detection result onto the initially acquired image through the mapping unit 10, thereby obtaining the final detection result, such as... Figure 9 As shown.
[0140] The specific process for this step is as follows:
[0141] In the detection results of each channel, each defect is marked by a corresponding detection box. After summarizing the detection results of the three channels, the detection boxes of all defects are arranged according to size, and the coordinates of the upper left corner and the lower right corner of each detection box are calculated.
[0142] Determine the intersection region of adjacent detection boxes:
[0143] Let there be two bounding boxes A and B, with the coordinates of the top-left corner of A being... The coordinates of the lower right corner of A are The coordinates of the top left corner of B are The coordinates of the lower right corner of B are ( The coordinates of the top-left corner of the intersection region of the two detection boxes are: The coordinates of the lower right corner of the intersection region are ;
[0144] Calculate the intersection area of the detection boxes:
[0145] If an intersection exists, the area of the intersection of the detection boxes is:
[0146] ;
[0147] If the intersection region does not exist, that is, the two detection boxes do not overlap at all, then the intersection area is 0;
[0148] Calculate the area of the union of the detection boxes:
[0149]
[0150] The areas of A and B are as follows:
[0151]
[0152]
[0153] Calculate the Intersection over Union (IoU) of the detection boxes:
[0154]
[0155] When IoU = 1, detection boxes A and B completely overlap; when IoU = 0, detection boxes A and B do not overlap at all. When detection boxes A and B partially overlap, the larger the IoU value, the higher the degree of overlap.
[0156] In the aggregated defect detection frames, if the IoU value calculated for each pair of detection frames is greater than the preset IoU threshold, then the two detection frames are considered to belong to the same defect, and only the detection frame with the largest size is retained.
[0157] All retained detection boxes are merged and mapped onto the initially acquired image.
[0158] The above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Therefore, any changes made in accordance with the shape and principle of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for appearance inspection of large curvature lenses based on a single RGB three-channel image capture, characterized in that, include: The large curvature lens under test is illuminated from different angles by red, blue, and green light sources. The image acquisition module is placed directly above the large curvature lens under test to acquire images of the lens and transmits the acquired images to the detection module. The detection module processes the acquired images as follows: The base groove detection algorithm identifies the base grooves that support and are adapted to the large curvature lens under test from the acquired images, and obtains the detection mask image of the base grooves. The acquired image is subjected to channel separation to obtain three grayscale images with different channels: red, green, and blue. By combining the detection mask image of the base groove and three grayscale images of different channels, the detection results of the three channels are obtained through the lens defect detection algorithm; The detection results from the three channels are fused and mapped onto the initially acquired image to obtain the final detection result.
2. The method for appearance inspection of a large curvature lens based on a single RGB three-channel image capture according to claim 1, characterized in that, The base groove detection algorithm identifies the base groove used to support the large curvature lens under test from the acquired image, including: The acquired images are converted to grayscale. The Hough circle transform algorithm is used to identify the circular outline of the base groove from the grayscale image; Based on the identified circular outline of the base groove, a detection mask image of the base groove is obtained. This image retains only the area within the base groove, which is the effective detection area where the large curvature lens under test is located. Background areas, dust, and bubble interference factors outside the base groove are marked as invalid areas, thereby achieving precise isolation of the effective detection area.
3. The method for appearance inspection of a large curvature lens based on a single RGB three-channel image capture according to claim 2, characterized in that, The Hough circle transform algorithm is used to identify the circular outline of the base groove from the grayscale image, including: Define an accumulator array ,in Let r be the coordinates of the center of the circle, and r be the radius of the circle. The size of the accumulator is determined by the image size and the possible range of circle radii. For each edge pixel in the grayscale image According to Cartesian equation of a circle Derivation of all possible For each valid parameter combination, a vote is taken at the corresponding position in the accumulator array. Traversing the accumulator array The system filters out parameter combinations that have more votes than a preset threshold. These parameter combinations correspond to potential circular structures in the image. Then, it uses a non-maximum suppression algorithm to remove duplicate or falsely detected circular results. Finally, it determines the accurate center coordinates and radius of the large curvature lens and the base groove, thus identifying the circular outline of the base groove.
4. The method for appearance inspection of a large curvature lens based on a single RGB three-channel image capture according to claim 1, characterized in that, The detection results for three channels are obtained using a lens defect detection algorithm, including: We construct an image dataset of large curvature lenses with defects and a large curvature lens appearance detection model. We preprocess the constructed image dataset and divide the preprocessed image dataset into a training set and a test set. Image labeling software was used to identify defects in the training and test sets. The training set after defect labeling is input into the large curvature lens appearance detection model for training. Then, the test set is input into the trained large curvature lens appearance detection model to test and evaluate the training effect of the large curvature lens appearance detection model. The detection mask image of the base groove corresponding to the large curvature lens under test and three grayscale images of different channels are input into the appearance detection model of the large curvature lens that has passed the test, so as to obtain the detection results of the three channels.
5. The method for appearance inspection of a large curvature lens based on a single RGB three-channel image capture according to claim 1, characterized in that, Construct an image dataset of high-curvature lenses with defects, including: A diffusion generation model for images of flawed, high-curvature lenses is constructed. This model uses an improved U-Net-based network to adapt to the local feature extraction of lens images. Input a real, flawed lens grayscale image into the flawed large curvature lens image diffusion generation model, and train the flawed large curvature lens image diffusion generation model. The training process includes forward noise addition and reverse noise reduction. The forward noise addition process transforms a real image into a completely noisy image by progressively adding Gaussian noise. The process is as follows: Noise definition: Random noise Follows a normal distribution , The noise variance is adaptively adjusted based on image features. Noise addition formula: Update the image step by step according to the number of iterations t. The formula is: ; in, This is a preprocessed, realistic, and flawed grayscale image of the lens; This is the cumulative noise dispatch coefficient; Iteration termination: When t reaches the preset maximum number of steps, The image becomes completely noisy, completing the forward pass. Conversely, in reverse denoising, a diffusion generation model for training images of flawed, highly curved lenses is used to generate images from completely noisy images. The process of reconstructing a grayscale image of a lens with true defect features from a mid-to-high-resolution image is as follows: A loss function is constructed with the goal of minimizing the pixel error between the denoised image and the real image; Model learning from arrive The denoising mapping is achieved by iteratively optimizing network parameters using the gradient descent algorithm; the denoising mapping formula is as follows: ; in, Step size The corresponding denoised image; This is the single-step noise scheduling coefficient; For parameters Predictive noise at that time; denoted as the standard deviation of the noise in the reverse process; z represents random noise that follows a normal distribution. Training termination condition: When the loss function value of the model on a subset of the training set tends to stabilize, and the similarity between the defect features and surface characteristics of the generated image and the real image meets the preset threshold, training is stopped, and the final defect lens diffusion generation model is obtained. A real, flawed lens grayscale image is input into the final flawed lens diffusion generation model to generate a large number of fake, flawed lens grayscale images. By merging real and flawed lens grayscale images with fake and flawed lens grayscale images, an image dataset of a flawed high-curvature lens is constructed.
6. The method for appearance inspection of a large curvature lens based on a single RGB three-channel image capture according to claim 1, characterized in that, The detection results from the three channels are fused and mapped onto the initially acquired image, including: In the detection results of each channel, each defect is marked by a corresponding detection box. After summarizing the detection results of the three channels, the detection boxes of all defects are arranged according to size, and the coordinates of the upper left corner and the lower right corner of each detection box are calculated. Determine the intersection region of adjacent detection boxes: Let there be two bounding boxes A and B, with the coordinates of the top-left corner of A being... The coordinates of the lower right corner of A are The coordinates of the upper left corner of B are The coordinates of the lower right corner of B are The coordinates of the top-left corner of the intersection region of the two detection boxes are: The coordinates of the lower right corner of the intersection region are ; Calculate the intersection area of the detection boxes: If an intersection exists, the area of the intersection of the detection boxes is: If the intersection region does not exist, that is, the two detection boxes do not overlap at all, then the intersection area is 0. Calculate the area of the union of the detection boxes: , The areas of A and B are as follows: , , Calculate the Intersection over Union (IoU) of the detection boxes: When IoU = 1, detection boxes A and B completely overlap; when IoU = 0, detection boxes A and B do not overlap at all. When detection boxes A and B partially overlap, the larger the IoU value, the higher the degree of overlap. In the aggregated defect detection frames, if the IoU value calculated for each pair of detection frames is greater than the preset IoU threshold, then the two detection frames are considered to belong to the same defect, and only the detection frame with the largest size is retained. All retained detection boxes are merged and mapped onto the initially acquired image.
7. A large curvature lens appearance inspection system based on RGB three-channel single-shot imaging, used to implement the large curvature lens appearance inspection method based on RGB three-channel single-shot imaging as described in any one of claims 1-6, characterized in that, It includes a red light source, a blue light source, a green light source, an image acquisition module, and a detection module; in, The red, blue, and green light sources are used to illuminate the large curvature lens under test from different angles; The image acquisition module is positioned directly above the large curvature lens being tested to acquire an image of the lens and transmits the acquired image to the detection module. The detection module performs detection on the images acquired by the image acquisition module to obtain the final detection result.
8. The appearance inspection system for a large curvature lens based on RGB three-channel single-shot imaging according to claim 7, characterized in that, The detection module includes a base groove detection unit, a channel separation unit, a single-channel lens defect detection unit, a single-channel detection result fusion unit, and a mapping unit. The base groove detection unit is used to identify the base groove that is used to support the large curvature lens under test and is adapted to the large curvature lens under test from the acquired image, and to obtain the detection mask image of the base groove. The channel separation unit is used to perform channel separation on the acquired image to obtain three grayscale images with different channels: red, green, and blue. The single-channel lens defect detection unit, combining the detection mask image of the base groove and three grayscale images of different channels, obtains the detection results of the three channels through the lens defect detection algorithm; The single-channel detection result fusion unit is used to fuse the detection results of the three channels; The mapping unit is used to map the fused detection results onto the initially acquired image to obtain the final detection result.
9. The appearance inspection system for a large curvature lens based on RGB three-channel single-shot imaging according to claim 7, characterized in that, The image acquisition module is a 3CMOS industrial camera.