A lens module defect detection system and a detection method

By designing a lens module defect detection system including data acquisition, foreign object detection, lens detection and defect warning modules, the pixel value change curve group and abnormal coefficients are used to identify lens defects, the problem of difficulty in detecting lens manufacturing errors and oxidation in existing systems is solved, and higher detection accuracy and effect are achieved.

CN119125155BActive Publication Date: 2025-06-17SHENZHEN ZHUOCHENG ELECTRONICS CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411279921.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-06-17
Estimated Expiration
2044-09-12

AI Technical Summary

Technical Problem

The existing lens module defect detection system is difficult to effectively detect lens defects caused by errors in lens manufacturing, lens changes, and lens oxidation due to environmental influences.

Method used

A lens module defect detection system is designed, including a data acquisition module, a foreign object detection module, a lens detection module, a defect warning module and a database. By acquiring the appearance detection image of the lens module captured by the image detection device, preprocessing is performed, and element images and corresponding tags are generated based on the preprocessed image. Using the normal lens image in the database as a reference, a group of pixel value change curves is generated, and anomaly coefficients are calculated to generate a deviation alarm signal.

Benefits of technology

The accuracy of lens detection is improved, the detection effect of the lens module is enhanced, and defects such as errors during lens manufacturing and oxidation under the influence of the environment can be more effectively identified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119125155B_ABST
    Figure CN119125155B_ABST
Patent Text Reader

Abstract

The present application discloses a lens module defect detection system and a detection method, which relates to the technical field of defect detection, and solves the technical problem that the existing lens module detection system has unsatisfactory lens defect detection effects due to errors in lens manufacturing, lens changes caused by environmental impacts such as lens oxidation during production or use, etc.; including: a data acquisition module: obtaining appearance detection images; a foreign object detection module: generating component images, component labels, and detection labels according to the appearance detection images; generating a component alarm signal according to the detection labels; a lens detection module: generating a corresponding pixel value change curve group according to the component images; when the detection label of the lens is normal; generating an abnormality coefficient according to the pixel value change curve group and the component images; generating a deviation alarm signal according to the abnormality coefficient; a defect warning module: performing an alarm according to the component abnormality alarm signal and the deviation alarm signal; enhancing the detection effect of the lens module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of defect detection, involving defect detection technology, and specifically relates to a lens module defect detection system and a detection method. Background Art

[0002] The compact camera module (CCM), due to its precise and compact characteristics, is widely used in products such as smartphones and portable computers, as well as in many fields such as security, medical, automotive, and the Internet of Things. The main components of the CCM are: a lens, a base, an image sensor (Sensor), digital signal processing (DSP), and a flexible printed circuit (FPC). Its working principle is as follows: The scene passes through the lens, and the generated optical image is projected onto the sensor. Then the optical image is converted into an electrical signal, and the electrical signal is further converted into a digital signal through analog-to-digital conversion. After being processed by the DSP, it is finally converted into a digital image.

[0003] The prior art (a patent for invention with the publication number CN109406527B) discloses a fine appearance defect detection system and method for a lens of a micro camera module. The system includes a metallurgical microscope imaging platform, a stage, and an industrial control computer. The metallurgical microscope imaging platform consists of a microscopic magnification device, a coaxial light source, and an industrial camera. The stage includes X and Y axis encoders, a grating scale, and a motor box. The industrial control computer is used to control the displacement of the electric stage and implement a precise defect detection algorithm. The method includes: (1) calibrating the camera of the metallurgical microscope platform; (2) positioning the first camera module in the mold; (3) sequentially collecting images of the micro camera module using the "Z" - shaped method; (4) detecting fine appearance defects of the lens of the micro module using an image processing algorithm; (5) feeding back the camera module with defective lenses and the type of defects. This invention can achieve precise detection of micron - level defects on the appearance of the camera module, improve the detection accuracy and automation level, and provide guarantee for product quality.

[0004] The above - mentioned lens module defect detection system detects the appearance image of the lens module, segments the image of the camera lens surface, detects the largest - area circle in the image of the camera module, and segments the area inside the circle. It extracts defect features through edge extraction, threshold segmentation, and curve fitting techniques to identify fine defects such as scratches, cracks, foreign objects, and dust on the appearance of the camera module. However, the defects of the lens are not limited to scratches, cracks, foreign objects, and dust on the lens. Errors during lens manufacturing, changes in the lens due to oxidation of the lens caused by environmental influences during production or use, etc. may also cause the lens module to be unqualified. These reasons are difficult to be clearly shown in the lens, making it difficult to detect these defects through defect recognition, resulting in low detection accuracy of the lens module detection system. There is a need for a lens module defect detection system. Summary of the Invention

[0005] This application aims to solve at least one of the technical problems existing in the prior art; for this purpose, this application proposes a lens module defect detection system and a detection method, which are used to solve the technical problem that the existing lens module detection system has unsatisfactory detection effects on lens defects caused by errors during lens manufacturing, lens oxidation due to environmental impacts during production or use, and other reasons.

[0006] To achieve the above object, a first aspect of this application provides a lens module defect detection system, including: a data acquisition module, a foreign object detection module, a lens detection module, a defect warning module, and a database;

[0007] The data acquisition module: is used to obtain the appearance detection image of the lens module collected by the image detection device; and preprocess the appearance detection image;

[0008] The foreign object detection module: obtains the preprocessed appearance detection image; generates an element image, as well as its corresponding element label and detection label according to the appearance detection image; and generates an element alarm signal according to the detection label;

[0009] The lens detection module: obtains a plurality of element images with a detection label of normal and an element label of lens through the connected database; generates a corresponding pixel value change curve group according to the element image; and,

[0010] obtains the element image with an element label of lens, when its corresponding detection label is normal; generates an abnormal coefficient according to the pixel value change curve group and the element image; and generates a deviation alarm signal according to the abnormal coefficient;

[0011] The defect warning module: obtains the element abnormal alarm signal and the deviation alarm signal, and issues an alarm.

[0012] This application obtains the appearance detection image of the lens module collected by the image detection device; preprocesses the appearance detection image; generates an element image, as well as its corresponding element label and detection label according to the preprocessed appearance detection image; generates an element alarm signal according to the detection label; obtains a plurality of element images with a detection label of normal and an element label of lens through the connected database; generates a corresponding pixel value change curve group according to the element image; when the detection label of the element with an element label of lens is normal, generates an abnormal coefficient according to the pixel value change curve group and the element image; generates a deviation alarm signal according to the abnormal coefficient; uses the normal lens image of the corresponding model lens module itself as a reference to generate its corresponding pixel value change curve group to compare whether the lens of the currently detected lens module is qualified, so that the accuracy of lens detection is higher; and enhances the detection effect of the lens module.

[0013] Preferably, the preprocessing includes image enhancement and image denoising.

[0014] Preferably, generating the component image, as well as the corresponding component label and detection label according to the appearance detection image, includes:

[0015] Obtain the preprocessed appearance detection image; input the appearance detection image into the component segmentation model to obtain a number of component images and their corresponding component labels; input each component image and component label into the foreign object detection model to obtain detection labels; the component segmentation model is trained through an artificial intelligence model; the foreign object detection model is trained through an artificial intelligence model.

[0016] Preferably, the component segmentation model is trained through an artificial intelligence model, including:

[0017] Obtain a number of clear appearance detection images of the lens module, as well as a number of component images and corresponding component labels from the database; integrate the appearance detection images, component images and component labels into a number of groups of training data and test data;

[0018] Use the training data to train the artificial intelligence model, and use the test data to test the trained artificial intelligence model, and finally obtain an input of an appearance detection image and an output of a corresponding number of component images and component labels; the artificial intelligence model includes a BP neural network model and an RBF neural network model.

[0019] Preferably, the foreign object detection model is trained through an artificial intelligence model, including:

[0020] Obtain a number of component images, as well as their corresponding component labels and detection labels through the database; the detection labels include normal and abnormal; integrate the component images, component labels and detection labels into a number of groups of training data and test data;

[0021] Use the training data to train the artificial intelligence model correspondingly, and use the test data to test the trained artificial intelligence model, and finally obtain a foreign object detection model with an input of a component label and a component image and an output of its corresponding detection label; the artificial intelligence model includes a BP neural network model and an RBF neural network model.

[0022] This application improves the efficiency of defect detection by using a trained artificial intelligence model.

[0023] Preferably, generating the component alarm signal according to the detection label includes:

[0024] Obtain the detection labels corresponding to each component image; sequentially determine whether each detection label is abnormal. If so, mark the component corresponding to the component image as an abnormal component; if not, mark the component corresponding to the component image as a normal component.

[0025] Integrate each abnormal component and its corresponding component image into an abnormal component table; and generate a component alarm signal.

[0026] Preferably, generating the pixel value change curve group according to the component image includes the steps of:

[0027] Obtain several component images with normal detection labels and component labels of lenses through the connected database. The component images corresponding to the lenses are circular images.

[0028] Perform grayscale processing on the component image to obtain a grayscale lens image; convert the component image to the RGB color space to obtain channel lens images corresponding to each channel thereof. The channel lens images include a red channel lens image, a green channel lens image, and a blue channel lens image.

[0029] Generate a pixel value change curve group corresponding to each component image according to the grayscale lens image and the channel lens images.

[0030] Preferably, generating the pixel value change curve group corresponding to each component image according to the grayscale lens image and the channel lens images includes:

[0031] Obtain the grayscale lens image and the channel lens images corresponding to each component image.

[0032] Take the grayscale lens image as the image to be processed, generate a change curve according to the image to be processed, and mark the change curve as a grayscale change curve.

[0033] Take the red channel lens image as the image to be processed, generate a change curve according to the image to be processed, and mark the change curve as a red channel change curve.

[0034] Take the green channel lens image as the image to be processed, generate a change curve according to the image to be processed, and mark the change curve as a green channel change curve.

[0035] Take the blue channel lens image as the image to be processed, generate a change curve according to the image to be processed, and mark the change curve as a blue channel change curve.

[0036] Integrate the grayscale change curve, red channel change curve, green channel change curve, and blue channel change curve corresponding to each component image into its corresponding pixel value change curve group.

[0037] Preferably, generating a change curve according to the image to be processed includes the following steps:

[0038] Step 1: Obtain the image to be processed; the image to be processed is a circular image.

[0039] Step 2: Establish a plane rectangular coordinate system with the center point of the image to be processed as the coordinate origin; obtain a number of calibration radii, make circles centered on the coordinate origin according to the calibration radii, and record them as calibration circles.

[0040] Step 3: Obtain the pixel values of each pixel point on the circumference of each calibration circle; take the mode of the pixel values on each circumference as the calibration pixel value of the calibration circle.

[0041] Step 4: Use the calibration radius of the calibration circle as the abscissa and the calibration pixel value of the calibration circle as the ordinate to fit the calibration pixel values corresponding to each calibration circle into a variation curve.

[0042] Preferably, generating the anomaly coefficient according to the pixel value variation curve group and the component image includes:

[0043] Obtain the component image, perform grayscale processing on the component image to obtain a grayscale lens image; convert the component image to the RGB color space to obtain channel lens images corresponding to each channel thereof.

[0044] Respectively use the grayscale lens image and each channel lens image as the image to be processed to generate a grayscale variation curve, a red channel variation curve, a green channel variation curve, and a blue channel variation curve; and mark them as Fh(r), Fr(r), Fg(r), and Fb(r) respectively.

[0045] Obtain a number of pixel value variation curve groups, extract the grayscale variation curve, red channel variation curve, green channel variation curve, and blue channel variation curve within each pixel value variation curve group; mark them as Bhi(r), Bri(r), Bgi(r), and Bbi(r) respectively; i is the number of the pixel value variation curve group.

[0046] Calculate the grayscale value deviation Phi corresponding to the pixel curve group numbered i through the formula Phi = ∫(|Fh(r) - Bhi(r)|).

[0047] Calculate the red channel pixel value deviation Pri corresponding to the pixel curve group numbered i through the formula Pri = ∫(|Fr(r) - Bri(r)|).

[0048] Calculate the green channel pixel value deviation Pgi corresponding to the pixel curve group numbered i through the formula Pgi = ∫(|Fg(r) - Bgi(r)|).

[0049] The blue channel pixel value deviation Pbi corresponding to the pixel curve group numbered i is calculated by the formula Pbi = ∫(|Fb(r) - Bbi(r)|); where r is the calibration radius, and r ∈ (0, R), and R is the radius corresponding to the component image;

[0050] The anomaly coefficient YCi corresponding to the pixel curve group numbered i is calculated by the formula YCi = α1×Phi + α2×(Pri + Pgi + Pbi); where α1 and α2 are weight coefficients.

[0051] Preferably, generating a deviation alarm signal according to the anomaly coefficient includes:

[0052] Obtain the anomaly coefficients corresponding to each pixel curve group, and determine whether the minimum value of the anomaly coefficients is greater than the set anomaly coefficient threshold;

[0053] Yes, generate an overall deviation alarm signal;

[0054] No, then when the minimum value of the grayscale value deviation is greater than the set grayscale value deviation threshold, generate a grayscale value deviation alarm signal; otherwise, when any one of the red channel pixel value deviation, green channel pixel value deviation, and blue channel pixel value deviation is greater than the set pixel value deviation threshold, generate a channel pixel value deviation alarm signal; The deviation alarm signal includes an overall deviation alarm signal, a grayscale value deviation alarm signal, and a channel pixel value deviation alarm signal.

[0055] Another aspect of the present application provides a method for detecting lens module defects, including the following steps:

[0056] Step 1: Obtain the appearance detection image of the lens module collected by the image detection device; preprocess the appearance detection image;

[0057] Step 2: Obtain the preprocessed appearance detection image; generate a component image, as well as its corresponding component label and detection label according to the appearance detection image;

[0058] Step 3: Generate a component alarm signal according to the detection label;

[0059] Step 4: Determine whether the detection label of the component image with the component label of the lens is normal; if yes, obtain a plurality of pixel value change curve groups; the pixel value change curve groups are generated according to a plurality of component images with detection labels being normal and component labels being lenses in the database; enter Step 5; if no, enter Step 6;

[0060] Step 5: Generate an anomaly coefficient according to the pixel value change curve group and the component image; generate a deviation alarm signal according to the anomaly coefficient;

[0061] Step 6: Obtain component anomaly alarm signals and deviation alarm signals, and issue alarms.

[0062] Compared with the prior art, the beneficial effects of the present application are as follows:

[0063] 1. In the present application, an appearance detection image of a lens module collected by an image detection device is obtained; the appearance detection image is preprocessed; a component image, as well as its corresponding component label and detection label, are generated based on the preprocessed appearance detection image; a component alarm signal is generated based on the detection label; several component images with normal detection labels and component labels being lenses are obtained through a connected database; a corresponding pixel value change curve group is generated based on the component images; when the detection label of a component with a component label being a lens is normal, an anomaly coefficient is generated based on the pixel value change curve group and the component image; a deviation alarm signal is generated based on the anomaly coefficient; a corresponding pixel value change curve group is generated based on the normal lens image of the lens module of the corresponding model itself as a reference to compare whether the lenses of the currently detected lens module are qualified, making the accuracy of lens detection higher; and the detection effect of the lens module is enhanced.

[0064] 2. In the present application, the efficiency of defect detection is improved by using a trained artificial intelligence model. Description of the Drawings

[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0066] Figure 1 It is a schematic diagram of the principle of the lens module defect detection system in the present application;

[0067] Figure 2 It is a schematic diagram of the method steps in the present application;

[0068] Figure 3 It is a flowchart for generating a calibration radius in the present application. Detailed Embodiments

[0069] The following will clearly and completely describe the technical solutions of the present application in combination with the embodiments. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.

[0070] Embodiment 1

[0071] Please refer to Figure 1 , a first aspect of the present application provides a lens module defect detection system, including: a data acquisition module, a foreign object detection module, a lens detection module, a defect warning module, and a database;

[0072] The data acquisition module: is used to obtain the appearance detection image of the lens module collected by the image detection device; the appearance detection image is the image of the entire lens module collected by the image acquisition device of the lens module detection device when the lens module is placed at the detection position of the lens module detection device, including the lenses and other components in the lens module, such as various sensors; preprocess the appearance detection image; the preprocessing includes image enhancement and image denoising;

[0073] The foreign object detection module: obtains the preprocessed appearance detection image; generates component images, as well as their corresponding component labels and detection labels according to the appearance detection image; the component label is the name of the component corresponding to each component image obtained by segmenting the appearance detection image, such as the component label corresponding to the component image of the lens is lens; the detection label is the label indicating whether there are defects on the surface of the corresponding component obtained by targeted defect recognition of the component image; if there are defects, the corresponding detection label is the corresponding defect, such as scratches, cracks, foreign objects, and dust; if there are no defects, the corresponding detection label is normal; generates a component alarm signal according to the detection label;

[0074] The lens detection module: obtains a number of component images with detection labels being normal and component labels being lenses through the connected database; generates a corresponding pixel value change curve group according to the component images; the pixel curve change group represents the image features of each lens component image; and, obtains the component image with the component label being lens, when its corresponding detection label is normal; generates an anomaly coefficient according to the pixel value change curve group and the component image; the anomaly coefficient represents the difference between the current lens component image and the normal component image recorded in the library; the greater the difference, the greater the possibility that there are problems with the detected lens; generates a deviation alarm signal according to the anomaly coefficient; reminds relevant personnel to conduct further detection on the lens module through the deviation alarm signal; if the result of the further detection is that the lens is normal, add the relevant data of the corresponding lens to the database;

[0075] In this embodiment, the normal lens image of the corresponding model lens module itself is used as a reference to generate its corresponding image features, which are used to compare whether the lenses of the currently detected lens module are qualified, so as to improve the accuracy of lens detection.

[0076] The defect warning module: obtains the component anomaly alarm signal and the deviation alarm signal, and issues an alarm.

[0077] Since the optical environment during lens detection is almost unchanged, the corresponding detection positions of the lens models are also fixed at the corresponding positions of the detection equipment. Therefore, when lenses of the same specification are detected, the light reflection conditions on the lenses are consistent, and the corresponding detection images are also almost identical. Lenses of different thicknesses and different properties have different reflection conditions. Therefore, in this embodiment, the overall reflection condition of the lens is detected based on the characteristics of the component images corresponding to the lens, to detect whether there are errors in the lens during manufacturing, and whether there are any minor defects in the overall lens caused by factors such as lens oxidation due to environmental influence during production or use. It can be understood that during detection by this detection equipment, there is no ambient stray light, and the light source used for detection should be directly opposite the center of the lens.

[0078] In this embodiment, an appearance detection image of the lens module collected by an image detection device is obtained; the appearance detection image is preprocessed; component images, as well as their corresponding component labels and detection labels, are generated based on the preprocessed appearance detection image; a component alarm signal is generated based on the detection label; several component images with normal detection labels and component labels of lenses are obtained through the connected database; a corresponding pixel value change curve group is generated based on the component images; when the detection label of a component with a component label of lens is normal, an anomaly coefficient is generated based on the pixel value change curve group and the component image; a deviation alarm signal is generated based on the anomaly coefficient; a corresponding pixel value change curve group is generated based on the normal lens image of the lens module of the corresponding model as a reference, to compare whether the lens of the currently detected lens module is qualified, making the accuracy of lens detection higher; and enhancing the detection effect of the lens module.

[0079] Generating component images, as well as their corresponding component labels and detection labels based on the appearance detection image includes: obtaining the preprocessed appearance detection image; inputting the appearance detection image into a component segmentation model to obtain several component images and their corresponding component labels; inputting each component image and component label into an anomaly detection model to obtain a detection label; the component segmentation model is trained through an artificial intelligence model; the anomaly detection model is trained through an artificial intelligence model.

[0080] The component segmentation model is trained through an artificial intelligence model, including: obtaining several clear appearance detection images of the lens module, as well as several component images and corresponding component labels from the database; integrating the appearance detection images, component images, and component labels into several groups of training data and test data;

[0081] Train an artificial intelligence model using training data, and test the trained artificial intelligence model using test data, finally obtaining an appearance detection image as the input and corresponding component images and component labels as the output; the artificial intelligence model includes a BP neural network model and an RBF neural network model.

[0082] The component images used to train the artificial intelligence model are images obtained by relevant experts by cropping the corresponding parts of each component from normal appearance images, and at the same time, the name of the component is used as the component label of the component image. It can be understood that when replacing a new and different model of lens module for detection, since the components used in the lens module are different and the sizes of the components are different, the model needs to be retrained.

[0083] The abnormal object detection model is obtained by training the artificial intelligence model, including: obtaining a number of component images through a database, as well as their corresponding component labels and detection labels; the detection labels include normal and abnormal; the abnormal includes scratches, cracks, foreign objects, dust, etc.; integrating the component images, component labels and detection labels into a number of groups of training data and test data;

[0084] Train the artificial intelligence model using the training data, and test the trained artificial intelligence model using the test data, finally obtaining an abnormal object detection model with component labels and component images as the input and their corresponding detection labels as the output; the artificial intelligence model includes a BP neural network model and an RBF neural network model.

[0085] It can be understood that the abnormal object detection model is the same as the component segmentation model, both of which are trained for the same model of lens module. When replacing a new and different model of lens module for detection, since the components used in the lens module are different and the sizes of the components are different, the model needs to be retrained.

[0086] Generate a component alarm signal according to the detection label, including: obtaining the detection label corresponding to each component image; sequentially determining whether each detection label is abnormal, if so, marking the component corresponding to the component image as an abnormal component; if not, marking the component corresponding to the component image as a normal component; integrating each abnormal component and its corresponding component image into an abnormal component table; and generating a component alarm signal; the abnormal component table includes component labels, component images and abnormalities, such as lens, lens component image and dust, etc.

[0087] Generate the pixel value change curve group according to the component image, including the following steps:

[0088] Obtain a number of component images with detection labels as normal and component labels as lenses through the connected database. The component images corresponding to the lenses are circular images. It can be understood that the obtained lens component images here are circular images including the entire lens.

[0089] Perform grayscale processing on the component images to obtain grayscale lens images; convert the component images to the RGB color space to obtain channel lens images under their respective channels. The channel lens images include red-channel lens images, green-channel lens images, and blue-channel lens images.

[0090] Generate a pixel value change curve group corresponding to each component image based on the grayscale lens images and channel lens images.

[0091] Generate a pixel value change curve group corresponding to each component image based on the grayscale lens images and channel lens images, including: obtaining the grayscale lens images and channel lens images corresponding to each component image.

[0092] Take the grayscale lens image as the image to be processed, generate a change curve based on the image to be processed, and mark the change curve as the grayscale change curve.

[0093] Take the red-channel lens image as the image to be processed, generate a change curve based on the image to be processed, and mark the change curve as the red-channel change curve.

[0094] Take the green-channel lens image as the image to be processed, generate a change curve based on the image to be processed, and mark the change curve as the green-channel change curve.

[0095] Take the blue-channel lens image as the image to be processed, generate a change curve based on the image to be processed, and mark the change curve as the blue-channel change curve.

[0096] Integrate the grayscale change curve, red-channel change curve, green-channel change curve, and blue-channel change curve corresponding to each component image into its corresponding pixel value change curve group.

[0097] Generate a change curve based on the image to be processed, including the following steps:

[0098] Step 1: Obtain the image to be processed; the image to be processed is a circular image.

[0099] Step 2: Establish a plane rectangular coordinate system with the center point of the image to be processed as the coordinate origin; obtain a number of calibration radii. The calibration radii can be equally spaced radii set according to experience, such as setting a calibration radius every 5 pixel points; or setting a calibration radius every 0.01 m. The specific interval situation is set by experts according to the size of the lens. The smaller the lens radius, the smaller the interval of the corresponding calibration radius. With the coordinate origin as the center, draw circles according to the calibration radii and record them as calibration circles.

[0100] Step 3: Obtain the pixel values of each pixel point on the circumference of each calibration circle; take the mode of the pixel values on each circumference as the calibration pixel value of the calibration circle; take the mode of the pixel values of each pixel point as the calibration pixel value of the calibration circle, so that the corresponding calibration pixel value can better represent the characteristics of the pixel values on the calibration circumference.

[0101] Step 4: Use the calibration radius of the calibration circle as the abscissa and the calibration pixel value of the calibration circle as the ordinate to fit the calibration pixel values corresponding to each calibration circle into a variation curve. Interpolation or other methods can be used for curve fitting.

[0102] Generating the anomaly coefficient according to the pixel value variation curve group and the component image includes: obtaining the component image, performing grayscale processing on the component image to obtain a grayscale lens image; converting the component image to the RGB color space to obtain the channel lens images corresponding to each channel.

[0103] Respectively use the grayscale lens image and each channel lens image as the image to be processed to generate a grayscale variation curve, a red channel variation curve, a green channel variation curve, and a blue channel variation curve; and mark them as Fh(r), Fr(r), Fg(r), and Fb(r) respectively.

[0104] Obtain a number of pixel value variation curve groups, extract the grayscale variation curve, red channel variation curve, green channel variation curve, and blue channel variation curve within each pixel value variation curve group; mark them as Bhi(r), Bri(r), Bgi(r), and Bbi(r) respectively; i is the number of the pixel value variation curve group.

[0105] Calculate the grayscale value deviation Phi corresponding to the pixel curve group numbered i through the formula Phi = ∫(|Fh(r) - Bhi(r)|); obtain the grayscale value deviation by statistically analyzing the gap between the two grayscale variation curves. The greater the grayscale deviation, the greater the difference between the lens to be measured and the normal lens.

[0106] The red-channel pixel value deviation Pri corresponding to the pixel curve group numbered i is calculated by the formula Pri = ∫(|Fr(r) - Bri(r)|); the red-channel pixel value deviation is obtained by statistically analyzing the difference between two red-channel change curves. The larger the red-channel pixel deviation value, the greater the difference between the lens to be measured and the normal lens;

[0107] The green-channel pixel value deviation Pgi corresponding to the pixel curve group numbered i is calculated by the formula Pgi = ∫(|Fg(r) - Bgi(r)|); the green-channel pixel value deviation is obtained by statistically analyzing the difference between two green-channel change curves. The larger the green-channel pixel value deviation, the greater the difference between the lens to be measured and the normal lens;

[0108] The blue-channel pixel value deviation Pbi corresponding to the pixel curve group numbered i is calculated by the formula Pbi = ∫(|Fb(r) - Bbi(r)|); where r is the calibration radius, and r ∈ (0, R), and R is the radius corresponding to the component image; the blue-channel pixel value deviation is obtained by statistically analyzing the difference between two blue-channel change curves. The larger the blue-channel pixel value deviation, the greater the difference between the lens to be measured and the normal lens;

[0109] The anomaly coefficient YCi corresponding to the pixel curve group numbered i is calculated by the formula YCi = α1 × Phi + α2 × (Pri + Pgi + Pbi); where α1 and α2 are weight coefficients.

[0110] In this embodiment, by the above formula, the gray value deviation is comprehensively considered, and the red-channel pixel value deviation, green-channel pixel value deviation, and blue-channel pixel value deviation are taken into account, which is convenient for increasing the accuracy of lens anomaly detection.

[0111] Generating a deviation alarm signal according to the anomaly coefficient, including: obtaining the anomaly coefficient corresponding to each pixel curve group, and judging whether the minimum value of the anomaly coefficient is greater than the set anomaly coefficient threshold;

[0112] Yes, generating an overall deviation alarm signal;

[0113] No, then when the minimum value of the gray value deviation is greater than the set gray value deviation threshold, generating a gray value deviation alarm signal; otherwise, when any one of the red-channel pixel value deviation, green-channel pixel value deviation, and blue-channel pixel value deviation is greater than the set pixel value deviation threshold, generating a channel pixel value deviation alarm signal; the deviation alarm signal includes an overall deviation alarm signal, a gray value deviation alarm signal, and a channel pixel value deviation alarm signal; the anomaly coefficient threshold, gray value deviation threshold, and pixel value deviation threshold are all set according to experience.

[0114] Please refer to Figure 2, another aspect of the present application provides a method for detecting lens module defects, including the following steps:

[0115] Step 1: Obtain the appearance detection image of the lens module collected by the image detection device; preprocess the appearance detection image;

[0116] Step 2: Obtain the preprocessed appearance detection image; generate an element image based on the appearance detection image, as well as its corresponding element label and detection label;

[0117] Step 3: Generate an element alarm signal according to the detection label;

[0118] Step 4: Determine whether the detection label of the element image with the element label of lens is normal; if yes, obtain a plurality of pixel value change curve groups; the pixel value change curve groups are generated according to a plurality of element images in the database with detection labels being normal and element labels being lens; enter Step 5; if no, enter Step 6;

[0119] Step 5: Generate an abnormal coefficient according to the pixel value change curve groups and the element image; generate a deviation alarm signal according to the abnormal coefficient;

[0120] Step 6: Obtain the element abnormal alarm signal and the deviation alarm signal, and give an alarm.

[0121] Embodiment 2

[0122] Please refer to Figure 3 , different from Embodiment 1, the calibration radius in this embodiment is set in the following manner:

[0123] Step 1: Obtain the coordinates of a plurality of pixel points on any radius of the image to be processed, and their corresponding pixel values; number the pixel points on the radius in the order from the center of the circle to the circumference; and the pixel point at the center of the circle is numbered "0";

[0124] Step 2: Mark the pixel point corresponding to the center of the circle as the first calibration point, and obtain the number corresponding to the pixel point of the first calibration point; mark the number as the number to be confirmed;

[0125] Step 3: Obtain the Euclidean distance between the pixel point with the number one more than the number to be confirmed and the first calibration point; determine whether the Euclidean distance is equal to the value of the radius; if yes, use the pixel point as the calibration point, and use the Euclidean distance between the first calibration point and the calibration point as the calibration radius of the calibration point; jump to Step 5; if no, obtain the pixel value of the pixel point; enter Step 4;

[0126] Step 4: Determine whether the difference between the pixel value and the pixel value of the previous calibration point exceeds the set pixel value difference threshold; if yes, mark the pixel point as a calibration point, take the Euclidean distance between the first calibration point and the calibration point as the calibration radius of the calibration point; and mark its corresponding number as the number to be confirmed; then jump to Step 3; if no, mark its corresponding number as the number to be confirmed; jump to Step 3;

[0127] Step 5: Obtain the calibration radii of all calibration points.

[0128] Through the above method, this embodiment enables appropriate calibration points and calibration radii to be set according to the changes of different lenses. More calibration points are set in areas where the pixel value changes greatly; fewer calibration points are set in areas where the pixel value changes little, enabling the calibration radius to be reasonably set according to different lenses, which helps to reduce the subsequent calculation amount.

[0129] Some data in the above formula are calculated by removing the dimension and taking their numerical values. The formula is obtained by software simulation of a large amount of collected data to get a formula closest to the actual situation; the preset parameters and preset thresholds in the formula are set by those skilled in the art according to the actual situation or obtained through simulation of a large amount of data.

[0130] The working principle of this application:

[0131] This application obtains the appearance detection image of the lens module collected by the image detection device; preprocesses the appearance detection image; generates an element image, as well as its corresponding element label and detection label according to the preprocessed appearance detection image; generates an element alarm signal according to the detection label; obtains a number of element images with detection labels being normal and element labels being lenses through the connected database; generates its corresponding pixel value change curve group according to the element image; when the detection label of the element label being a lens is normal, generates an abnormal coefficient according to the pixel value change curve group and the element image; generates a deviation alarm signal according to the abnormal coefficient; generates its corresponding pixel value change curve group with the normal lens image of the corresponding model lens module itself as a reference to compare whether the lens of the currently detected lens module is qualified, making the accuracy of lens detection higher; enhancing the detection effect of the lens module.

[0132] The above embodiments are only used to illustrate the technical method of this application and not to limit it. Although this application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical method of this application can be modified or equivalently replaced without departing from the spirit and scope of the technical method of this application.

Claims

1. A lens module defect detection system, comprising: Data acquisition module, foreign body detection module, lens detection module, defect warning module and database; characterized in that, The data acquisition module is used to obtain the appearance detection image of the lens module collected by the image detection device; and pre-process the appearance detection image; The foreign body detection module: obtains a pre-processed appearance detection image; generates a component image, a component label and a detection label corresponding thereto according to the appearance detection image; and generates a component alarm signal according to the detection label; The lens detection module: obtains a number of component images whose detection labels are normal and whose component labels are lenses through a database connected thereto; generates a corresponding pixel value change curve group according to the component images, The pixel value change curve group is composed of a plurality of change curves; the change curves are generated by the image to be processed, and include the following steps: Step 1: Acquire an image to be processed; the image to be processed is a processed component image, and the image to be processed is a circular image; Step 2: Using the center point of the image to be processed as the coordinate origin to establish a plane rectangular coordinate system; obtaining a number of calibration radii, taking the coordinate origin as the center, making a circle according to the calibration radius, and recording it as the calibration circle; Step 3: Obtain the pixel value of each pixel point on the circumference of each calibration circle; take the mode of the pixel values ​​on each circumference as the calibration pixel value of the calibration circle; Step 4: With the calibration radius of the calibration circle as the horizontal coordinate and the calibration pixel value of the calibration circle as the vertical coordinate, the calibration pixel values ​​corresponding to each calibration circle are fitted into a change curve; Acquire a component image whose component label is a lens, when its corresponding detection label is normal; generate an abnormality coefficient according to a pixel value change curve group and the component image; generate a deviation alarm signal according to the abnormality coefficient; The defect warning module is used to obtain component abnormality alarm signals and deviation alarm signals, and to generate alarms.

2. A lens module defect detection system according to claim 1, characterized in that: The generating of the component image, and the corresponding component label and detection label according to the appearance detection image includes: Acquire a preprocessed appearance inspection image; input the appearance inspection image into a component segmentation model to obtain a number of component images and their corresponding component labels; input each component image and component label into an abnormal object detection model to obtain a detection label; the component segmentation model is obtained by training an artificial intelligence model; the abnormal object detection model is obtained by training an artificial intelligence model.

3. A lens module defect detection system according to claim 2, characterized in that: The component segmentation model is obtained by training an artificial intelligence model, including: Acquire a number of clear appearance inspection images of the lens module, as well as a number of component images and corresponding component labels from a database; integrate the appearance inspection images, component images and component labels into a number of sets of training data and inspection data; The artificial intelligence model is trained using training data, and the trained artificial intelligence model is tested using test data, and finally the input is the appearance detection image, and the output is the corresponding component images and component labels; the artificial intelligence model includes a BP neural network model and a RBF neural network model.

4. The lens module defect detection system according to claim 1, characterized in that: The generating of the component alarm signal according to the detection tag comprises: Obtain the detection label corresponding to each component image; determine in turn whether each detection label is abnormal, if yes, mark the component corresponding to the component image as an abnormal component; if no, mark the component corresponding to the component image as a normal component; Integrate each abnormal component and its corresponding component image into an abnormal component table; and generate a component alarm signal.

5. The lens module defect detection system according to claim 1, characterized in that: Generating the pixel value variation curve group according to the component image includes the following steps: Acquire, through a database connected thereto, a number of component images whose detection labels are normal and whose component labels are lenses, wherein the component images corresponding to the lenses are circular images; The component image is gray-processed to obtain a gray-scale lens image; the component image is converted into an RGB color space to obtain channel lens images corresponding to each channel, wherein the channel lens images include a red channel lens image, a green channel lens image and a blue channel lens image; A pixel value variation curve group corresponding to each component image is generated according to the grayscale lens image and the channel lens image.

6. A lens module defect detection system according to claim 5, characterized in that: The step of generating a pixel value variation curve group corresponding to each component image according to the grayscale lens image and the channel lens image includes: Obtaining grayscale lens images and channel lens images corresponding to each component image; Taking the grayscale lens image as the image to be processed, generating a change curve according to the image to be processed, and marking the change curve as a grayscale change curve; Using the red channel lens image as the image to be processed, generating a change curve according to the image to be processed, and marking the change curve as the red channel change curve; Taking the green channel lens image as the image to be processed, generating a change curve according to the image to be processed, and marking the change curve as the green channel change curve; Using the blue channel lens image as the image to be processed, generating a change curve according to the image to be processed, and marking the change curve as the blue channel change curve; The grayscale change curve, red channel change curve, green channel change curve and blue channel change curve corresponding to each component image are integrated into the corresponding pixel value change curve group.

7. A lens module defect detection system according to claim 6, characterized in that: The generating of the abnormal coefficient according to the pixel value variation curve group and the component image comprises: Acquire a component image, perform grayscale processing on the component image to obtain a grayscale lens image; convert the component image into an RGB color space to obtain a channel lens image corresponding to each channel; The grayscale lens image and each channel lens image are respectively used as the images to be processed to generate a grayscale change curve, a red channel change curve, a green channel change curve and a blue channel change curve; and they are marked as Fh(r), Fr(r), Fg(r) and Fb(r) respectively; Obtain several pixel value change curve groups, extract the grayscale change curve, red channel change curve, green channel change curve and blue channel change curve in each pixel value change curve group; mark them as Bhi(r), Bri(r), Bgi(r) and Bbi(r) respectively; i is the number of the pixel value change curve group; The gray value deviation Phi corresponding to the pixel curve group numbered i is calculated by the formula Phi=∫(|Fh(r)-Bhi(r)|); The red channel pixel value deviation Pri corresponding to the pixel curve group numbered i is calculated by the formula Pri=∫(|Fr(r)-Bri(r)|); The green channel pixel value deviation Pgi corresponding to the pixel curve group numbered i is calculated by the formula Pgi=∫(|Fg(r)-Bgi(r)|); The blue channel pixel value deviation Pbi corresponding to the pixel curve group numbered i is calculated by the formula Pbi=∫(|Fb(r)-Bbi(r)|); wherein r is the calibration radius, and r∈(0, R), and R is the radius corresponding to the component image; The abnormal coefficient YCi corresponding to the pixel curve group numbered i is calculated by the formula YCi=α1×Phi+α2×(Pri+Pgi+Pbi); wherein α1 and α2 are weight coefficients.

8. The lens module defect detection system according to claim 1, characterized in that: The step of generating a deviation alarm signal according to the abnormal coefficient comprises: Obtain the abnormal coefficient corresponding to each pixel curve group, and determine whether the minimum value of the abnormal coefficient is greater than the set abnormal coefficient threshold; Yes, an overall deviation alarm signal is generated; No, when the minimum value of the grayscale value deviation is greater than the set grayscale value deviation threshold, a grayscale value deviation alarm signal is generated; otherwise, when any one of the red channel pixel value deviation, the green channel pixel value deviation and the blue channel pixel value deviation is greater than the set pixel value deviation threshold, a channel pixel value deviation alarm signal is generated; the deviation alarm signal includes an overall deviation alarm signal, a grayscale value deviation alarm signal and a channel pixel value deviation alarm signal.

9. A lens module defect detection method, based on the operation of a lens module defect detection system according to any one of claims 1 to 8; characterized in that: The following steps are involved: Step 1: Obtain an appearance detection image of the lens module collected by an image detection device; Preprocess the appearance inspection image; Step 2: Obtain the preprocessed appearance inspection image; Generate a component image, a component label and a detection label corresponding thereto according to the appearance detection image; Step 3: Generate a component alarm signal according to the detection tag; Step 4: Determine whether the detection label of the component image whose component label is a lens is normal; if yes, obtain a plurality of pixel value change curve groups; the pixel value change curve groups are generated according to a plurality of normal detection labels in the database and component images whose component label is a lens; proceed to step 5; No, go to step 6; Step 5: generating an abnormality coefficient according to the pixel value variation curve group and the component image; generating a deviation alarm signal according to the abnormality coefficient; Step 6: Obtain component abnormality alarm signal and deviation alarm signal, and issue an alarm.

Citation Information

Patent Citations

  • A system and method for detecting fine appearance defects in the lens of a miniature camera module

    CN109406527B

  • Optical element surface defect detection method based on deep learning

    CN109934811A

  • Circuit board electronic component detection method and device and computer equipment

    CN116245882A

  • Camera lens dirt detection method and system

    CN117576084A