A camera module defect detection method, device, equipment and storage medium

By combining LBP and SIFT features with a single-class SVM algorithm, the problem of detecting appearance defects in camera modules under defect-free negative samples was solved, achieving efficient defect detection and improving quality inspection efficiency.

CN116823798BActive Publication Date: 2026-02-24NANTONG JIAJUN INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310871185.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-14
Publication Date
2026-02-24
Estimated Expiration
2043-07-14

AI Technical Summary

Technical Problem

In the absence of defective negative samples, existing technologies make it difficult to effectively detect appearance defects in camera modules, resulting in time-consuming and labor-intensive manual inspections that are prone to oversight.

Method used

By combining LBP features and SIFT features with a single-class SVM algorithm, a defect classification model is trained by collecting normal module samples, calculating the coordinates of the component to be detected and identifying defects, thus achieving defect detection without the need for defect samples.

Benefits of technology

It improves product quality inspection efficiency, reduces the difficulty and time of sample collection, and only requires a small number of positive samples to train a reliable model, which can quickly detect module appearance defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116823798B_ABST
    Figure CN116823798B_ABST
Patent Text Reader

Abstract

The application discloses a camera module defect detection method, device and equipment and a storage medium, and belongs to the technical field of camera module production. The method comprises the following steps: collecting a normal module appearance picture, and marking the coordinates of a component to be detected; obtaining a component defect classification model and detection parameters; calculating the SIFT features of a sample picture and the SIFT features of a picture to be detected, and obtaining a matching coordinate pair; calculating the coordinates of the component to be detected in the picture to be detected; then obtaining each component picture, combining the defect classification model, obtaining a classification result, and judging whether each component of the picture to be detected has a defect. Compared with the prior art, the method has the advantages that: the method does not need to collect defect sample pictures and a large amount of positive and negative sample data, and only a small amount of positive samples are needed to train a reliable model; and in the case that only normal module samples and defect-free negative samples are available, only one marked image is needed to complete component positioning, detect defects existing in the module appearance, and improve product quality inspection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of camera module manufacturing technology, and more specifically, to a method, apparatus, equipment, and storage medium for detecting defects in camera modules. Background Technology

[0002] Cameras, as image input devices, are widely used in fields such as camera shooting, mobile phone video, and security monitoring. The quality of a camera is closely related to its camera module, and with continuous technological advancements, the manufacturing process of camera modules is constantly improving.

[0003] In related technologies, during the production of camera modules, due to issues such as processes and production lines, the module's appearance may exhibit defects such as missing screws or incorrect wiring sequences. Manually inspecting the appearance of camera modules is time-consuming, labor-intensive, and prone to omissions. For example, Chinese patent document CN110415214A discloses a method, device, electronic device, and storage medium for inspecting the appearance of camera modules. This method uses a deep learning-based defect segmentation model to segment defects in component images, achieving automatic inspection of the camera module's appearance.

[0004] In summary, no effective solution has yet been proposed for the problem of detecting appearance defects in camera modules without defective negative samples in related technologies. Summary of the Invention

[0005] 1. Technical problems to be solved

[0006] To address the problem of detecting appearance defects in camera modules when there are no defective negative samples in the existing technology, this invention provides a method, apparatus, device, and storage medium for detecting camera module defects. It can detect defects in the appearance of modules when there are only normal module samples and no defective negative samples, thereby improving product quality inspection efficiency.

[0007] 2. Technical Solution

[0008] The objective of this invention is achieved through the following technical solutions.

[0009] A method for detecting defects in a camera module includes the following steps:

[0010] Collect normal module samples: Collect images of the appearance of normal modules and mark the coordinates of the component to be tested;

[0011] Training parameters and model: Extract LBP features from the local area where the component to be tested is located in the image and train the model to obtain the defect classification model of the component; select module appearance sample images from normal module samples, mark the module coordinates, and obtain its coordinates and the coordinate parameters of each component;

[0012] Calculate SIFT features: Calculate the SIFT features of the selected module appearance sample image and the SIFT features of the image to be detected, match them to obtain matching coordinate pairs, and calculate the coordinates of each component to be tested.

[0013] Calculate the coordinates of the component to be detected: Calculate the coordinates of the component to be detected in the image by using the training parameters and the sample component coordinate parameters in the model steps;

[0014] Determining defects in the detected components: Based on the step of calculating the coordinates of the components to be detected, images of each component are obtained, and then combined with the defect classification model M. i The classification results are calculated to determine whether there are defects in each component of the input image to be detected.

[0015] Furthermore, in the step of collecting normal module samples, the components to be tested include connectors, gold-plated screw holes on both sides, four corner screws, labels, and cut connection wires.

[0016] Furthermore, at least 20 images of the normal module's appearance should be collected.

[0017] Furthermore, the specific steps for training parameters and the model are as follows: a single-class SVM is used for model training to obtain the component defect classification model M. i i = 1, 2, 3, 4, 5.

[0018] Furthermore, the specific steps for calculating SIFT features are as follows: calculating the SIFT features of the module appearance sample images selected in the training parameters and model steps.

[0019] Furthermore, the SIFT features of the input image to be detected are calculated and matched with the SIFT features of the module appearance sample to obtain the matching coordinate pairs.

[0020] Represents the coordinates in the sample image; This represents the coordinates in the image to be detected; n is the total number of matching coordinate pairs, where n is a natural number; j takes values ​​of 1, 2, 3, ..., n.

[0021] Furthermore, the specific steps for SIFT feature extraction and coordinate point matching are as follows:

[0022] Scale-space extremum detection: A Gaussian filter is used to downsample the image to be detected at multiple scales. At each scale level, the difference of Gaussians operator is used to detect the extrema in the scale space.

[0023] Key point localization: Candidate regions are located based on scale space extrema detection. Key points in each candidate region are precisely located at sub-pixel level to obtain more accurate positions, and key points are then filtered.

[0024] Orientation assignment: Calculate the gradient orientation histogram of pixels surrounding each keypoint to determine the gradient orientation; assign one or more orientations to the keypoints based on the gradient orientation.

[0025] Keypoint description: Within the neighborhood of each keypoint, construct a descriptor based on the keypoint's scale and orientation;

[0026] Feature matching: Matching the set of key points of one image with the set of key points of another image;

[0027] Matching and filtering: Invalid matching points are removed from the SIFT feature matching results through continuous iteration.

[0028] Furthermore, in the feature matching step, the Euclidean distance between feature descriptors is used to measure the similarity between two key points, and the KNN nearest neighbor method is used for matching to eliminate inaccurate matches.

[0029] Furthermore, the specific steps for calculating the coordinates of the component to be detected are as follows:

[0030] For n matching coordinate pairs, the coefficients k and b are calculated using the least squares method to obtain the relationship between the matching coordinates: P2 = kP1 + b;

[0031] The training parameters and the coordinate parameters of the sample components in the model steps are used as... Substitute into the formula Received These are the coordinates of the component to be tested in the image to be tested.

[0032] Furthermore, the specific steps for determining defects in the detection components are as follows:

[0033] The component image is obtained based on the step of calculating the coordinates of the component to be detected, and the LBP features of the component image are extracted.

[0034] Based on the component category, the defect classification model M is invoked. i Input the calculated LBP features to obtain the classification results.

[0035] A camera module defect detection device, comprising,

[0036] The module for collecting module samples acquires images of the appearance of normal modules and marks the coordinates of the component to be tested;

[0037] The training parameters and model module extract LBP features from the local area where the component to be tested is located in the image and train the model to obtain the defect classification model of the component; select module appearance sample images from the normal module samples and mark the module coordinates to obtain its coordinates and the coordinate parameters of each component.

[0038] The calculation module calculates the SIFT features of the sample images of the module appearance selected by the training parameters and model module; it calculates the SIFT features of the image to be detected and matches them with the SIFT features of the sample images to obtain matching coordinate pairs; and it calculates the coordinates of each component to be tested using the least squares method.

[0039] The judgment module obtains images of each component from the calculation module and extracts LBP features from each component image; based on the component category, it calls the defect classification model M. i Input the calculated LBP features to obtain the classification results and determine whether the component to be detected has defects.

[0040] A camera module defect detection device includes one or more processors and a memory, wherein the memory stores a program and is configured to be executed by the one or more processors in the following steps:

[0041] Collect images of the normal module's appearance and mark the coordinates of the component to be tested;

[0042] LBP features of the local region where the component under test is located in the image are extracted and the model is trained to obtain the defect classification model of the component; the appearance sample images of the module are selected from the normal module samples and the module coordinates are marked to obtain its coordinates and the coordinate parameters of each component.

[0043] Calculate the SIFT features of the sample images of the module appearance selected by the training parameters and model modules; calculate the SIFT features of the image to be detected and match them with the SIFT features of the sample images to obtain matching coordinate pairs; combine the least squares method to calculate the coordinates of each component to be tested.

[0044] Based on the images of each component obtained from the calculation module, LBP features of each component image are extracted; based on the component category, the defect classification model M is invoked. i Input the calculated LBP features to obtain the classification results and determine whether the component to be detected has defects.

[0045] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described camera module defect detection method.

[0046] 3. Beneficial effects

[0047] Compared with existing technologies, the camera module defect detection method, apparatus, device and storage medium of the present invention do not require the collection of defect sample images or a large amount of positive and negative sample data. The one-class SVM algorithm used in the present invention only requires a small number of positive samples to train a reliable model. Moreover, in the case of only normal module samples and no defective negative samples, this solution only requires a single labeled image to complete component localization, detect defects in the appearance of the module, and improve product quality inspection efficiency. Attached Figure Description

[0048] Figure 1 This is a flowchart illustrating a camera module defect detection method according to an embodiment of the present invention;

[0049] Figure 2 This is a schematic diagram of the qualified product matching results of a camera module defect detection method in one embodiment of the present invention;

[0050] Figure 3 This is a schematic diagram of a defect detection method for camera modules according to an embodiment of the present invention, illustrating the detection of defective products. Detailed Implementation

[0051] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.

[0052] Example 1

[0053] Combination Figures 1 to 3 The present invention provides a method for detecting defects in a camera module, comprising the following steps:

[0054] Collect normal module samples:

[0055] Several images of the normal module's appearance were collected, and the coordinates of each component to be tested were marked. There were a total of 5 components to be tested, including the connector, gold-plated screw holes on both sides, four corner screws, a label, and a cut connector cable.

[0056] At least 20 images of the normal module appearance should be collected. The more images collected, the more accurate the classifier model will be. However, compared to deep learning methods, the number of samples is actually greatly reduced, and only positive samples need to be collected, without the need to collect abnormal samples, which greatly reduces the difficulty of application.

[0057] Training parameters and model:

[0058] LBP features of the local regions where each component under test is located in the image are extracted, and then a single-class SVM is used to train the model to obtain the defect classification model M for each component. i i = 1, 2, 3, 4, 5.

[0059] Because each component under test possesses rich texture features, extracting its LBP features yields better recognition results. Using a single-class SVM as the classifier eliminates the need to extract features from anomalous samples, thus reducing implementation complexity.

[0060] Among them, LBP (Local Binary Pattern) is an operator used to describe the local texture features of an image, and SVM is a single classification algorithm, which is a type of generalized linear classifier that performs binary classification of data in a supervised learning manner.

[0061] Take a sample image of the module appearance from the normal module sample, manually mark the module coordinates, and obtain its coordinates and the coordinate parameters of each component.

[0062] Coordinate parameters of each component and defect classification model M of each component i i = 1, 2, 3, 4, 5, which serve as detection parameters and models for detecting appearance defects in modules on the quality inspection production line.

[0063] Calculate SIFT features:

[0064] SIFT features of a module appearance sample image selected in the above steps of training parameters and model calculation;

[0065] Calculate the SIFT features of the input image to be detected and match them with the SIFT features of the module appearance sample image to obtain the matching coordinate pairs.

[0066] in, Represents the coordinates in the sample image; This represents the coordinates in the image to be detected; n is the total number of matching coordinate pairs, where n is a natural number; j takes values ​​of 1, 2, 3, ..., n.

[0067] The specific steps for SIFT feature extraction and coordinate point matching are as follows:

[0068] Step 1: Scale-space extremum detection:

[0069] A Gaussian filter is used to perform multi-scale downsampling of the image to be detected. At each scale level, the difference of Gaussians operator is used to detect extrema in the scale space to find candidate regions for key points.

[0070] Step 2: Key Point Location

[0071] For each candidate region, interpolation techniques are used to precisely locate keypoints at sub-pixel levels to obtain more accurate positions. Keypoints with low contrast and strong edge response are discarded to retain keypoints with good features.

[0072] Step 3, Direction Assignment:

[0073] For each keypoint, calculate the gradient direction histogram of its surrounding pixels to determine the dominant gradient direction. Assign one or more directions to the keypoint based on the dominant gradient direction.

[0074] Step 4, Key Point Description:

[0075] Within the neighborhood of each keypoint, a descriptor is constructed based on the keypoint's scale and orientation. The descriptor is typically based on image gradient information around the keypoint and possesses rotation and scale invariance.

[0076] Step 5: Feature Matching

[0077] Given a set of keypoints in one image, it is matched against a set of keypoints in another image. The Euclidean distance between feature descriptors is used to measure the similarity between the two keypoints. The KNN nearest neighbor algorithm is used for matching, with a ratio of 0.7, to eliminate inaccurate matches.

[0078] Step Six: Matching and Filtering

[0079] The Random Sample Consensus (RANSAC) algorithm is used to calculate the optimal matching point from the SIFT feature matching results through continuous iteration, and invalid matching points are removed.

[0080] Calculate the coordinates of the component to be detected:

[0081] For n matching coordinate pairs, based on the feature matching points obtained earlier for the entire module image and The coefficients k and b are calculated using the least squares method, and the relationship between the matching coordinates is obtained: P2 = kP1 + b;

[0082] The training parameters and the coordinate parameters of the sample components in the model steps are used as... Substitute into the formula get These are the coordinates of each component to be tested in the image to be tested.

[0083] After obtaining k and b, for a certain component, let's assume its coordinates in the template image are x. Then, according to y = kx + b, we can obtain the corresponding coordinates in the image to be detected.

[0084] Determine defects in the detection components:

[0085] Determine whether there are defects in each component of the input image to be inspected.

[0086] Based on the step of calculating the coordinates of the component to be detected, the images of each component are obtained, and the LBP features of the component images are extracted.

[0087] Based on the component category, the defect classification model M obtained from the training parameters and model steps is invoked. i Input the calculated LBP features to obtain the classification results.

[0088] like Figures 2 to 3 As shown, with Figure 2 and Figure 3 Taking the tag component in the example, Figure 2 The middle tag component was deemed qualified, while Figure 3 The middle tag component was deemed unqualified.

[0089] Among them, collecting normal module samples, generating defect classification models and training parameters and models for each component under test all belong to the parameter and model training stage; calculating SIFT features, calculating the coordinates of the component under test, and judging the defects of the component under test all belong to the application on the quality inspection production line.

[0090] This invention provides a camera module defect detection method that employs a single-class SVM classifier for defect classification, eliminating the need to collect defect sample images. This solution addresses the problem of the time-consuming and labor-intensive process of collecting large numbers of different types of defect samples in actual production, especially when some defects only occur once. Furthermore, this solution does not require a large amount of positive and negative sample data. Unlike neural network-based models that require a large number of samples for fitting, the SVM algorithm used in this solution only needs a small number of samples to train a reliable model; and compared to neural network models, SVM inference speed is faster.

[0091] For the specific description of the device, this embodiment can refer to the corresponding software and method content to carry out the corresponding hardware implementation; and construct the corresponding device and equipment.

[0092] For example, a device designed for detecting defects in camera modules, the camera module defect detection device includes,

[0093] The module sample acquisition module collects several images of the normal module's appearance and marks the coordinates of each component to be tested. There are a total of 5 components to be tested, including the connector, gold-plated screw holes on both sides, four corner screws, a label, and a cut connector cable.

[0094] The training parameters and model module obtains the detection parameters and models used for detecting appearance defects in modules on the quality inspection production line.

[0095] LBP features of the local regions where each component under test is located in the image are extracted, and then a single-class SVM is used to train the model to obtain the defect classification model M for each component. i i = 1, 2, 3, 4, 5;

[0096] Select a module appearance image from the normal module sample, manually mark the module coordinates, and obtain its coordinates and the coordinate parameters of each component;

[0097] The obtained coordinate parameters of each component and the defect classification model M of each component i i = 1, 2, 3, 4, 5, which are the detection parameters and the model.

[0098] The calculation module calculates the SIFT features of the sample images of the module's appearance selected by the training parameters and model module; it also calculates the SIFT features of the input image to be detected and matches them with the SIFT features of the sample images to obtain matching coordinate pairs.

[0099] For n matching coordinate pairs, the least squares method is used to calculate k and b, obtaining the relationship between the matching coordinates: P2 = kP1 + b; the training parameters and the coordinate parameters of the sample components of the model module are used as... Substitute into the formula get That is, the coordinates of each component to be tested in the image to be tested.

[0100] The judgment module determines whether there are defects in each component of the input image to be detected.

[0101] Based on the images of each component obtained from the calculation module, LBP features are extracted from the component photos; based on the component category, the defect classification model M is invoked. i Input the calculated LBP features to obtain the classification results and determine whether the component to be detected has defects.

[0102] The device designed for camera module defect detection can be a hardware device, including one or more processors and a memory, wherein the memory stores a program and is configured to be executed by the one or more processors in the following steps:

[0103] Collect several images of the normal module's appearance and mark the coordinates of each component to be tested.

[0104] LBP features of the local regions where each component under test is located in the image are extracted and a single-class SVM is used for model training to obtain the defect classification model M for each component. i Let i = 1, 2, 3, 4, 5; Take an image of the module's appearance from the normal module sample, manually mark the module's coordinates, and obtain its coordinates and the coordinate parameters of each component. Obtain the detection parameters and model for detecting module appearance defects on the quality inspection production line.

[0105] Calculate the SIFT features of the module appearance sample image, calculate the SIFT features of the input image to be detected, and match them with the SIFT features of the sample image to obtain the matching coordinate pairs. For n matching coordinate pairs, the least squares method is used to calculate k and b, obtaining the relationship between the matching coordinates: P2 = kP1 + b; the coordinate parameters of the sample components are used as... Substitute into the formula get That is, the coordinates of each component to be tested in the image to be tested.

[0106] The system determines whether each component of the input image to be detected has defects. Based on the obtained component images, it extracts LBP features from the component images. Then, based on the component category, it calls the defect classification model M. i Input the calculated LBP features to obtain the classification results.

[0107] The storage medium designed for camera module defect detection can be a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned camera module defect detection method.

[0108] The specific implementation of the device is feasible with existing technology, so I will not go into details again. The following text explains the possibility of implementation from the perspective of principles.

[0109] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many improvements to the methodology today can be considered direct improvements to the hardware circuit structure.

[0110] Designers almost always obtain the corresponding hardware circuit structure by programming improved methodologies into the hardware circuit. Therefore, it cannot be said that an improvement in a methodology cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program a digital system onto a PLD themselves, without having to ask chip manufacturers to design and manufacture dedicated integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software, similar to the software compiler used in program development. The original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There is not just one type of HDL, but many, such as Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using the aforementioned hardware description languages ​​and programming it into an integrated circuit, the hardware circuit that implements the logic method flow can be easily obtained.

[0111] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ATMEL AT89S52, Microchip PIC16C57. Memory controllers can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0112] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices. For ease of description, the above devices are described separately by function as various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware.

[0113] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, produce implementations of the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0114] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1The steps of the functions specified in one or more boxes. In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0115] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital character versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0116] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0117] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0118] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside on local and remote computer storage media, including storage devices.

Claims

1. A method for detecting defects in a camera module, comprising the following steps: Collect normal module samples: Collect at least 20 normal module appearance images and mark the coordinates of the component to be tested. The component to be tested includes connectors, gold-plated screw holes on both sides, four corner screws, labels and cut connection wires. Training parameters and model: LBP features of the local region where the component to be tested is located in the image are extracted, and a single-class SVM is used for model training to obtain the component defect classification model M. i i = 1, 2, 3, 4, 5; Select module appearance sample images from the normal module samples, mark the module coordinates, and obtain its coordinates and the coordinate parameters of each component; Calculate SIFT features: The SIFT features of the selected module appearance sample image are calculated, and the SIFT features of the input image to be detected are calculated. These are then matched with the SIFT features of the module appearance sample to obtain the matching coordinate pairs. In the formula, Represents the coordinates in the sample image; This represents the coordinates in the image to be detected; n is the total number of matching coordinate pairs, where n is a natural number; the value of j is 1, 2, 3, ..., n; Calculate the coordinates of the component to be detected: For n matching coordinate pairs, calculate the coefficients k and b using the least squares method to obtain the relationship between the matching coordinates: P2 = kP1 + b; use the training parameters and the sample component coordinate parameters from the model steps as... Substitute into the formula Received That is, the coordinates of the component to be tested in the image to be tested; Determine defects in the detected components: Based on the step of calculating the coordinates of the components to be detected, obtain images of each component and extract the LBP features from the component images; Based on the component category, the defect classification model M is invoked. i The LBP features are input, the classification results are obtained, and it is determined whether there are defects in each component of the input image to be detected.

2. The camera module defect detection method according to claim 1, characterized in that, The specific steps for calculating SIFT features are as follows: calculate the SIFT features of the module appearance sample images selected in the training parameters and model steps.

3. The camera module defect detection method according to claim 2, characterized in that, The specific steps for SIFT feature extraction and coordinate point matching are as follows: Scale-space extremum detection: A Gaussian filter is used to downsample the image to be detected at multiple scales. At each scale level, the difference of Gaussians operator is used to detect the extrema in the scale space. Key point localization: Candidate regions are located based on scale space extrema detection. Key points in each candidate region are precisely located at sub-pixel level to obtain more accurate positions, and key points are then filtered. Orientation assignment: Calculate the gradient orientation histogram of pixels surrounding each keypoint to determine the gradient orientation; assign one or more orientations to the keypoints based on the gradient orientation. Keypoint description: Within the neighborhood of each keypoint, construct a descriptor based on the keypoint's scale and orientation; Feature matching: Matching the set of key points of one image with the set of key points of another image; Matching and filtering: Invalid matching points are removed from the SIFT feature matching results through continuous iteration.

4. The camera module defect detection method according to claim 3, characterized in that, In the feature matching step, the Euclidean distance between feature descriptors is used to measure the similarity between two key points, and the KNN nearest neighbor method is used for matching to eliminate inaccurate matches.

5. The camera module defect detection method according to claim 2, characterized in that, The specific steps for determining defects in the detection components are as follows: Based on the step of calculating the coordinates of the component to be detected, the component image is obtained, and the LBP features of the component image are extracted. Based on the component category, the defect classification model M is invoked. i Input the calculated LBP features to obtain the classification results.

6. A camera module defect detection device, characterized in that, include, The module sample acquisition module acquires at least 20 normal module appearance images and marks the coordinates of the component to be tested. The component to be tested includes a connector, gold-plated screw holes on both sides, four corner screws, a label, and a cut connection wire. The training parameters and model module extract LBP features from the local region where the component to be tested is located in the image, and use a single-class SVM to train the model, thus obtaining the component defect classification model M. i i = 1, 2, 3, 4, 5; Select module appearance sample images from the normal module samples and mark the module coordinates to obtain its coordinates and the coordinate parameters of each component; The calculation module calculates the SIFT features of the module appearance sample images selected by the training parameters and model module. The SIFT features of the image to be detected are calculated and matched with the SIFT features of the sample image to obtain matching coordinate pairs; the coordinates of each component to be detected are calculated by combining the least squares method. The judgment module obtains images of each component from the calculation module and extracts LBP features from each component image; based on the component category, it calls the defect classification model M. i Input the calculated LBP features to obtain the classification results and determine whether the component to be detected has defects.

7. A camera module defect detection device, characterized in that, It includes one or more processors and a memory, the memory storing a program and configured to be executed by the one or more processors of the following steps: Collect at least 20 normal module appearance images and mark the coordinates of the component to be tested. The component to be tested includes a connector, gold-plated screw holes on both sides, four corner screws, a label, and a cut connection cable. LBP features are extracted from the local region where the component under test is located in the image, and a single-class SVM is used to train the model to obtain the component defect classification model M. i i = 1, 2, 3, 4, 5; Select module appearance sample images from the normal module samples and mark the module coordinates to obtain its coordinates and the coordinate parameters of each component; Calculate the SIFT features of the sample images of the module appearance selected by the training parameters and model modules; The SIFT features of the image to be detected are calculated and matched with the SIFT features of the sample image to obtain matching coordinate pairs; the coordinates of each component to be detected are calculated by combining the least squares method. Based on the images of each component obtained from the calculation module, LBP features are extracted from each component image; based on the component category, the defect classification model M is invoked. i Input the calculated LBP features to obtain the classification results and determine whether the component to be detected has defects.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the camera module defect detection method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Appearance detection method and device of camera module, electronic equipment and storage medium

    CN110415214A

  • Wind power generation device blade defect detection method based on unmanned aerial vehicle image analysis

    CN115187878A

  • Visual detection method and device for transparent object, computer equipment and medium

    CN115205223A