Lens module defect detection system and detection method
The lens module defect detection system employs AI-driven image processing and pixel value analysis to address detection inaccuracies, improving the identification of defects in lens modules by using trained neural networks and abnormality coefficients.
Patent Information
- Application Number
- CN202411279921.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-12
AI Technical Summary
Existing lens module detection systems face challenges in accurately detecting defects such as scratches, cracks, foreign matter, and dust due to errors in manufacturing, environmental changes, and oxidation, leading to low detection accuracy.
A lens module defect detection system utilizing a data acquisition module, foreign matter detection module, lens detection module, and defect warning module, combined with artificial intelligence models like BP and RBF neural networks, to preprocess images, generate component images and labels, and calculate pixel value change curves for enhanced defect detection.
The system improves detection accuracy by using trained AI models to identify defects, generating alarm signals based on abnormality coefficients, thereby enhancing the overall detection efficiency and precision of lens module quality.
Smart Images

Figure CN119125155A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of defect detection technology, and relates to defect detection technology, specifically a lens module defect detection system and detection method. Background Art
[0002] Compact Camera Module (CCM) is widely used in smart phones, portable computers and other products, as well as security, medical, automotive and IoT fields due to its precision and compactness. The main components of CCM are: lens, base, image sensor, digital signal processing (DSP) and flexible circuit board (FPC). Its working principle is: the scene passes through the lens, and the generated optical image is projected onto the sensor, and then the optical image is converted into an electrical signal, which is then converted into a digital signal through analog-to-digital conversion, and finally converted into a digital image through DSP processing.
[0003] The prior art (invention patent with announcement number CN109406527B) discloses a system and method for detecting fine appearance defects of micro camera module lenses. The system includes a metallographic microscope imaging platform, a stage, and an industrial computer; the metallographic microscope imaging platform is composed of a microscopic magnification device, a coaxial light source, and an industrial camera; the stage includes an X-axis and Y-axis encoder, a grating ruler, and a motor box; the industrial computer is used to control the displacement of the electric stage and implement a precise defect detection algorithm. The method includes: (1) calibrating the metallographic microscope platform camera; (2) locating the first camera module in the mold; (3) using a "Z"-shaped method to sequentially collect images of the micro camera modules; (4) using an image processing algorithm to detect fine appearance defects of the micro module lens; (5) feedback on the camera module with defects in the lens and the defect type. The present invention can realize the precise detection of micron-level defects in 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 collects the appearance image of the lens module, segments the camera mirror image, detects the circle with the largest area in the camera module image, and segments the area within the circle; extracts defect features through edge extraction, threshold segmentation, and curve fitting technology, and identifies fine defects such as scratches, cracks, foreign matter and dust on the appearance of the camera module; and the defects of the lens are not limited to scratches, cracks, foreign matter and dust on the lens; errors in lens manufacturing, changes in the lens due to environmental influences during production or use, lens oxidation, and other reasons may also cause the lens module to be unqualified; these reasons are difficult to show clearly in the lens; making it difficult to detect these defects through defect recognition; resulting in low detection accuracy of the lens module detection system; affecting the need for a lens module defect detection system. Summary of the invention
[0005] The present application aims to solve at least one of the technical problems existing in the prior art; to this end, the present 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 effect of lens defects due to errors in lens manufacturing, changes in lenses due to environmental influences during production or use, lens oxidation, etc.
[0006] To achieve the above-mentioned purpose, the first aspect of the present application provides a lens module defect detection system, including: a data acquisition module, a foreign matter 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 pre-process the appearance detection image;
[0008] 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;
[0009] 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; and,
[0010] 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;
[0011] The defect warning module is used to obtain component abnormality alarm signals and deviation alarm signals, and to generate alarms.
[0012] The present application obtains an appearance detection image of a lens module collected by an image detection device; pre-processes the appearance detection image; generates a component image, and a component label and a detection label corresponding to the component image according to the pre-processed appearance detection image; generates a component alarm signal according to the detection label; 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 image; when the detection label whose component label is the lens is normal, generates an abnormality coefficient according to the pixel value change curve group and the component image; generates a deviation alarm signal according to the abnormality coefficient; and generates a corresponding pixel value change curve group according to the normal lens image of the lens module of the corresponding model itself as a reference, so as to compare whether the lens of the lens module currently being detected is qualified, thereby making the lens detection more accurate; and enhancing the detection effect of the lens module.
[0013] Preferably, the preprocessing includes image enhancement and image denoising.
[0014] Preferably, the generating of the component image, and the corresponding component label and detection label according to the appearance detection image includes:
[0015] 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.
[0016] Preferably, the component segmentation model is obtained by training an artificial intelligence model, including:
[0017] 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;
[0018] 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.
[0019] Preferably, the abnormal object detection model is obtained by training an artificial intelligence model, including:
[0020] Acquire a number of component images, and corresponding component labels and detection labels from a database; the detection labels include normal and abnormal; integrate the component images, component labels and detection labels into a number of sets of training data and inspection data;
[0021] The artificial intelligence model is trained using the training data, and the trained artificial intelligence model is tested using the test data, and finally a foreign body detection model is obtained whose input is a component label and a component image, and whose output is a corresponding detection label; the artificial intelligence model includes a BP neural network model and a RBF neural network model.
[0022] This application improves the efficiency of defect detection by using a trained artificial intelligence model.
[0023] Preferably, generating a component alarm signal according to the detection tag comprises:
[0024] 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;
[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 variation curve group according to the component image comprises the steps of:
[0027] 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;
[0028] 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 red channel lens image;
[0029] A pixel value variation curve group corresponding to each component image is generated according to the grayscale lens image and the channel lens image.
[0030] Preferably, 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:
[0031] Obtaining grayscale lens images and channel lens images corresponding to each component image;
[0032] 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;
[0033] 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;
[0034] 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;
[0035] 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;
[0036] 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.
[0037] Preferably, generating a change curve according to the image to be processed comprises the following steps:
[0038] Step 1: Obtain an image to be processed; the image to be processed is a circular image;
[0039] 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;
[0040] 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;
[0041] 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 variation curve.
[0042] Preferably, generating the abnormal coefficient according to the pixel value variation curve group and the component image includes:
[0043] 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;
[0044] 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;
[0045] 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;
[0046] The gray value deviation Phi corresponding to the pixel curve group numbered i is calculated by the formula Phi=∫(|Fh(r)-Bhi(r)|);
[0047] 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)|);
[0048] 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)|);
[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)|); wherein r is the calibration radius, and r∈(0, R), and R is the radius corresponding to the component image;
[0050] 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.
[0051] Preferably, generating a deviation alarm signal according to the abnormal coefficient includes:
[0052] 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;
[0053] Yes, an overall deviation alarm signal is generated;
[0054] 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.
[0055] Another aspect of the present application provides a lens module defect detection method, comprising the following steps:
[0056] Step 1: Obtain an appearance detection image of the lens module collected by an image detection device; pre-process the appearance detection image;
[0057] Step 2: Obtain a preprocessed appearance inspection image; generate a component image, and a component label and an inspection label corresponding thereto according to the appearance inspection image;
[0058] Step 3: Generate a component alarm signal according to the detection tag;
[0059] 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 the component image whose component label is a lens; proceed to step 5; if no, proceed to step 6;
[0060] 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;
[0061] Step 6: Obtain component abnormality alarm signal and deviation alarm signal, and issue an alarm.
[0062] Compared with the prior art, the beneficial effects of this application are:
[0063] 1. The present application obtains an appearance detection image of a lens module collected by an image detection device; pre-processes the appearance detection image; generates a component image, a component label and a detection label corresponding thereto according to the pre-processed appearance detection image; generates a component alarm signal according to the detection label; 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 image; when the detection label whose component label is the lens is normal, generates an abnormality coefficient according to the pixel value change curve group and the component image; generates a deviation alarm signal according to the abnormality coefficient; generates a corresponding pixel value change curve group according to the abnormality coefficient; and uses the normal lens image of the lens module of the corresponding model itself as a reference to generate the corresponding pixel value change curve group for comparing whether the lens of the lens module currently being detected is qualified, thereby making the lens detection more accurate; and enhancing the detection effect of the lens module.
[0064] 2. This application improves the efficiency of defect detection by using a trained artificial intelligence model. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0066] Figure 1 This is a schematic diagram of the principle of the lens module defect detection system in this application;
[0067] Figure 2 A schematic diagram of the method steps in this application;
[0068] Figure 3 A flow chart is generated for calibrating the radius in this application. DETAILED DESCRIPTION
[0069] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0070] Example 1
[0071] See also Figure 1 , a first aspect of the present application provides a lens module defect detection system, comprising: a data acquisition module, a foreign matter detection module, a lens detection module, a defect warning module and a database;
[0072] Data acquisition module: 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 in the detection position of the lens module detection device, including the lens and other components in the lens module, such as various sensors; pre-processing the appearance detection image; the pre-processing includes image enhancement and image denoising;
[0073] Foreign body detection module: obtain the pre-processed appearance inspection image; generate component images, component labels and inspection labels corresponding to them according to the appearance inspection image; component labels are the names of components corresponding to each component image obtained after segmenting the appearance inspection image, such as the component label corresponding to the component image of the lens is the lens; the inspection label is a 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 inspection label is the corresponding defect, such as scratches, cracks, foreign matter and dust; if there are no defects, the corresponding inspection label is normal; generate component alarm signals according to the inspection labels;
[0074] Lens detection module: obtain several component images whose detection labels are normal and whose component labels are lenses through a database connected thereto; generate corresponding pixel value change curve groups according to the component images; the pixel curve change groups represent image features of each lens component image; and obtain component images whose component labels are lenses, when their corresponding detection labels are normal; generate an abnormality coefficient according to the pixel value change curve groups and the component images; the abnormality 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 the detected lens has a problem; generate a deviation alarm signal according to the abnormality coefficient; remind relevant personnel to conduct further detection of the lens module through the deviation alarm signal; if the result of the further detection is that the lens is normal, the relevant data of the corresponding lens is added to the database;
[0075] In this embodiment, a normal lens image of a lens module of a corresponding model is used as a reference to generate corresponding image features for comparing whether the lens of the lens module currently being inspected is qualified, thereby making the lens inspection more accurate.
[0076] The defect warning module is used to obtain component abnormality alarm signals and deviation alarm signals, and to generate alarms.
[0077] Since the light environment of the lens remains almost unchanged during detection, the detection position of the corresponding lens model is also fixed at the corresponding position of the detection equipment. Therefore, when lenses of the same specifications are detected, the reflection of light on the lenses is consistent, and the corresponding detection images are almost the same; lenses of different thicknesses and lenses of different properties have different reflection conditions; therefore, this embodiment detects the overall reflection condition of the lens through the characteristics of the component image corresponding to the lens, and detects whether the lens has errors caused by lens manufacturing, changes in the lens due to environmental influences during production or use, and other minor defects of the lens as a whole. It can be understood that when the detection equipment is used for detection, there is no ambient stray light, and the light source used for detection should be facing the center of the lens.
[0078] This embodiment obtains an appearance detection image of the lens module collected by an image detection device; pre-processes the appearance detection image; generates a component image, a component label and a detection label corresponding to it according to the pre-processed appearance detection image; generates a component alarm signal according to the detection label; 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 image; when the detection label whose component label is the lens is normal, generates an abnormality coefficient according to the pixel value change curve group and the component image; generates a deviation alarm signal according to the abnormality coefficient; uses the normal lens image of the lens module of the corresponding model itself as a reference, generates its corresponding pixel value change curve group, which is used to compare whether the lens of the lens module currently being detected is qualified, so as to make the lens detection more accurate; and enhances the detection effect of the lens module.
[0079] Generate a component image, a component label and a detection label corresponding to the component image according to an appearance inspection image, including: obtaining a preprocessed appearance inspection image; inputting the appearance inspection image into a component segmentation model to obtain a plurality of component images and their corresponding component labels; inputting 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.
[0080] The component segmentation model is obtained through artificial intelligence model training, including: obtaining 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; integrating the appearance inspection images, component images and component labels into a number of sets of training data and inspection data;
[0081] 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.
[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 the normal appearance image, and the component names are used as component labels of the component images. It is understandable that when replacing a new lens module of a different model for testing, the model needs to be retrained because the components used in the lens module are different and the sizes of the components are different.
[0083] The abnormal object detection model is obtained through artificial intelligence model training, including: obtaining a number of component images, and the corresponding component labels and detection labels through a database; the detection labels include normal and abnormal; the abnormalities include scratches, cracks, foreign matter and dust, etc.; integrating the component images, component labels and detection labels into several groups of training data and inspection data;
[0084] The artificial intelligence model is trained using the training data, and the trained artificial intelligence model is tested using the test data, and finally a foreign body detection model is obtained whose input is a component label and a component image, and whose output is a corresponding detection label; the artificial intelligence model includes a BP neural network model and a RBF neural network model.
[0085] It is understandable that the anomaly detection model is the same as the component segmentation model, and both are trained for the same model of lens module. When replacing a new lens module of a different model for detection, the model needs to be retrained because the components used in the lens module are different and the sizes of the components are different.
[0086] Generate component alarm signals according to detection labels, including: obtaining detection labels corresponding to each component image; judging in turn 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 component alarm signals; the abnormal component table includes component labels, component images and abnormalities, such as lenses, lens component images and dust.
[0087] Generating the pixel value variation curve group according to the component image includes the following steps:
[0088] A plurality of component images whose detection labels are normal and whose component labels are lenses are obtained through a database connected thereto, wherein the component image corresponding to the lens is a circular image; it can be understood that the lens component image obtained here is a circular image including the entire lens;
[0089] 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 red channel lens image;
[0090] A pixel value variation curve group corresponding to each component image is generated according to the grayscale lens image and the channel lens image.
[0091] Generating a pixel value variation curve group corresponding to each component image according to the grayscale lens image and the channel lens image, including: acquiring the grayscale lens image and the channel lens image corresponding to each component image;
[0092] 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;
[0093] 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;
[0094] 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;
[0095] 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;
[0096] 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.
[0097] Generating a change curve according to the image to be processed includes the following steps:
[0098] Step 1: Obtain an 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 origin of the coordinates; obtain a number of calibration radii, which can be equally spaced radii set according to experience, such as setting a calibration radius every 5 pixels; or setting a calibration radius every 0.01m; the specific interval is set by an expert according to the size of the lens; the smaller the radius of the lens, the smaller the interval of the corresponding calibration radius; make a circle with the origin of the coordinates as the center according to the calibration radius, and record it as the calibration circle;
[0100] 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; 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 value on the circumference of the calibration circle;
[0101] 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 variation curve; interpolation fitting or other methods can be used for curve fitting.
[0102] The abnormal coefficient is generated according to the pixel value change curve group and the component image, including: acquiring the component image, gray-processing the component image to obtain a gray-scale lens image; converting the component image to an RGB color space to obtain a channel lens image corresponding to each channel;
[0103] 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;
[0104] 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;
[0105] The gray value deviation Phi corresponding to the pixel curve group numbered i is calculated by the formula Phi=∫(|Fh(r)-Bhi(r)|); the gray value deviation is obtained by counting the difference between the two gray value change curves. The larger the gray value deviation, the greater the difference between the lens to be tested 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 counting the difference between the two red channel change curves. The larger the red channel pixel deviation difference is, the larger the difference between the lens to be tested and the normal lens is.
[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 counting the difference between the two green channel change curves. The larger the green channel pixel value deviation is, the larger the difference between the lens to be tested and the normal lens is.
[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)|); wherein 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 counting the difference between the two blue channel change curves. The larger the blue channel pixel value deviation is, the greater the difference between the lens to be tested and the normal lens is.
[0109] 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.
[0110] This embodiment uses the above formula to integrate the grayscale value deviation, consider the red channel pixel value deviation, the green channel pixel value deviation and the blue channel pixel value deviation, so as to increase the accuracy of lens abnormality detection.
[0111] Generating a deviation alarm signal according to the abnormal coefficient includes: obtaining the abnormal coefficient corresponding to each pixel curve group, and determining whether the minimum value of the abnormal coefficient is greater than a set abnormal coefficient threshold;
[0112] Yes, an overall deviation alarm signal is generated;
[0113] 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; the abnormal coefficient threshold, the grayscale value deviation threshold and the pixel value deviation threshold are all set according to experience.
[0114] See also Figure 2Another aspect of the present application provides a lens module defect detection method, comprising the following steps:
[0115] Step 1: Obtain an appearance detection image of the lens module collected by an image detection device; pre-process the appearance detection image;
[0116] Step 2: Obtain a preprocessed appearance inspection image; generate a component image, and a component label and an inspection label corresponding thereto according to the appearance inspection image;
[0117] Step 3: Generate a component alarm signal according to the detection tag;
[0118] 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 the component image whose component label is a lens; proceed to step 5; if no, proceed to step 6;
[0119] 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;
[0120] Step 6: Obtain component abnormality alarm signal and deviation alarm signal, and issue an alarm.
[0121] Example 2
[0122] See also Figure 3 , which is different from Example 1, the calibration radius in this embodiment is set according to the following method:
[0123] Step 1: Obtain the coordinates of several pixel points on any radius of the image to be processed and their corresponding pixel values; number each pixel point on the radius in the order from the center 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, obtain the number of the pixel point corresponding to the first calibration point; and mark the number as the number to be confirmed;
[0125] Step 3: Obtain the Euclidean distance between the pixel point with the number corresponding to the number to be confirmed plus one and the first calibration point; determine whether the Euclidean distance is equal to the radius value; 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; and proceed to 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, and use the Euclidean distance between the first calibration point and the calibration point as the calibration radius of the calibration point; and mark the corresponding number as a number to be confirmed; then jump to step 3; if no, mark the corresponding number as a number to be confirmed; then jump to step 3;
[0127] Step 5: Get the calibration radius of all calibration points.
[0128] This embodiment uses the above method to set appropriate calibration points and calibration radius 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 less, so that the calibration radius can be reasonably set according to different lenses, which is convenient for reducing the subsequent calculation amount.
[0129] Part of the data in the above formula is calculated by removing the dimension and taking its numerical value. The formula is a formula closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.
[0130] How this application works:
[0131] The present application obtains an appearance detection image of a lens module collected by an image detection device; pre-processes the appearance detection image; generates a component image, and a component label and a detection label corresponding to the component image according to the pre-processed appearance detection image; generates a component alarm signal according to the detection label; 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 image; when the detection label whose component label is the lens is normal, generates an abnormality coefficient according to the pixel value change curve group and the component image; generates a deviation alarm signal according to the abnormality coefficient; and generates a corresponding pixel value change curve group according to the normal lens image of the lens module of the corresponding model itself as a reference, so as to compare whether the lens of the lens module currently being detected is qualified, thereby making the lens detection more accurate; and enhancing the detection effect of the lens module.
[0132] The above embodiments are only used to illustrate the technical method of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical method of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present application.
Claims
1. A lens module defect detection system, include: 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; and, 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, It is 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, It is 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, It is 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, It is 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 red 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, It is 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, It is characterized in that The step of generating a change curve according to the image to be processed comprises the following steps: Step 1: Obtain an image to be processed; 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 variation curve.
8. A lens module defect detection system according to claim 7, It is 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.
9. The lens module defect detection system according to claim 1, It is 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.
10. 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 9; It is 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
Substrate inspection device, substrate processing device, substrate inspection method, and substrate processing method
WO2019058772A1
