PCB component defect detection method, system, equipment and medium
Through the combination of deep learning models and classic image processing methods, the PCB board component detection is used using convolutional neural network and visual Transformer, which solves the problems of high error judgment rate and slow detection speed in the existing technology, and achieves efficient and accurate Defect detection of various components.
Patent Information
- Application Number
- CN202411228537.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-09-03
AI Technical Summary
The existing PCB board component detection methods have high error rate, slow detection speed, high equipment cost, complex maintenance and only detect defects under specific conditions, which limit the wide application of AOI detection technology.
Using a combination of deep learning models and classic image processing methods, image data is collected through CCD cameras, image preprocessing and feature extraction is performed using convolutional neural networks and visual Transformer, combining self-attention mechanisms and depth separation convolutions to achieve multi-features Fusion and efficient detection.
It improves the detection accuracy and speed, reduces the calculation amount, and realizes efficient and real-time detection under contactless conditions. The detection results are consistent and reliable, and are suitable for defect detection of various components.
Smart Images

Figure CN119048837A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a PCB component defect detection method, system, equipment and medium based on machine vision. Background Art
[0002] In recent years, with the rapid development of my country's 3C manufacturing industry, the application of microelectronics technology has also developed towards high density, high integration and smaller devices. Almost all electronic devices realize various functions and complex controls through the electrical interconnection of various components on the PCB board. Therefore, the mounting quality of various components on the PCB board has a direct impact on the quality of the final 3C product.
[0003] Traditional PCB component mounting quality inspection methods are mainly manual inspection and flying probe inspection. Traditional manual inspection methods cause great damage to workers' eyesight, and there are problems with poor consistency and low reliability of inspection results. The advantage of flying probe inspection is fast inspection speed, but the supporting equipment is expensive and has many maintenance and use problems. With the continuous development of deep learning and computer vision technology, many companies have begun to use automatic optical inspection AOI technology to detect the mounting quality of PCB components, and have achieved good results. AOI equipment generally uses charge-coupled devices (CCDs) to collect image data of PCB components after mounting. The built-in intelligent algorithm of the equipment will recognize the images collected by the CCD and give recognition results.
[0004] Compared with traditional methods, the AOI method has fast detection speed, good reusability and low cost, so it has good application prospects. For example, the invention with patent application number CN201510570537.6 discloses an image stitching method for AOI detection of printed circuit boards. The AOI device has at least two cameras located at the same height and arranged at intervals. Each camera shoots the circuit board part that needs to be detected in its corresponding area, and stores the image shot by each camera in the internal storage of the AOI device. The internal processing unit of the AOI device runs an image processing unit, which extracts the image in the internal storage and uses the image stitching method to stitch all the images shot by the cameras into a complete image according to the positional relationship of the shooting area. The AOI detection problem of large PCBs is solved by scanning and stitching multiple cameras in different areas. It is suitable for AOI detection of large work pieces, and can collect multiple pictures at a time, process each picture in parallel, and improve the efficiency of AOI detection image acquisition. However, this AOI detection method is prone to misjudgment for components with gray or unclear light and shadow areas in the image. In addition, since optical inspection is affected by light intensity, angle, resolution and other factors, some defects can only be detected under specific conditions. Therefore, the existing methods can only detect one or several types of components at a time, limiting the widespread application of AOI detection technology. Summary of the invention
[0005] In order to overcome the defects of the above-mentioned prior art, the purpose of the present invention is to provide a PCB board component defect detection method, system, device and medium based on machine vision, which uses a deep learning model and a classic image processing method based on OpenCV to process image data in stages to achieve PCB board component defect detection. The present invention also includes the system, device and medium under this method.
[0006] In order to achieve the above object, the technical solution of the present invention is:
[0007] A method for detecting defects in components of a PCB board, comprising the steps of:
[0008] Step S1: Original image acquisition
[0009] Use a CCD camera to collect PCB component image data in a non-overlapping shooting mode to obtain a data set sample, take the mode value of the image resolution in the data set sample as the preset resolution, and uniformly convert all samples in the data set into the preset resolution size;
[0010] Step S2: Image preprocessing
[0011] The data set samples are divided into training set and test set according to the proportion, and the sample distribution in the training set and the test set is guaranteed to be consistent. All types of components are included. Based on the Transforms module of PyTorch, random center cropping, flipping, and rotation of sample images in the training set are performed as data augmentation operations.
[0012] Step S3: Establish a deep learning model CVM
[0013] The deep learning model CVM is divided into three parts: shallow network, deep network and classifier. The shallow network includes three downsampling modules, each of which is composed of a 1x1 convolution layer, a BN layer, a ReLU activation function, a 3x3 convolution layer and a maximum pooling layer; the deep network is divided into two branches, one is the convolution branch, and the other is the Transformer branch. The convolution branch is composed of three 3x3 convolution layers connected in sequence, and the Transformer branch is composed of three sparse visual encoders connected in sequence. Each sparse visual encoder includes a local feature extraction module, a global feature extraction module and a feature mixing module; the classifier consists of a fully connected layer and a softmax function, and the number of output channels of the fully connected layer is equal to the number of target categories;
[0014] By performing downsampling operations in the shallow network, two different branches, convolution and visual encoder, are used in the deep network to complete local information and global information learning respectively, and a connection is established between the two branches to strengthen information interaction, so as to realize low-level-high-level feature joint learning. The three sparse visual encoders divide the images into different groups of patch blocks and only calculate self-attention between patch blocks;
[0015] Step S4: Model training
[0016] First, batchsize, epoch, optimizer and loss function hyperparameters are set, and the Adam optimizer and cosine annealing strategy are used to guide the network parameters to approach the theoretical optimal value; then, the training set sample data is input into the deep learning model CVM in step S3 to learn the characteristics of the samples, and the loss function is the cross entropy loss function, the goal is to minimize the loss function value, and the evaluation indicator is the test set accuracy; finally, the deep learning model CVM is continuously iterated and trained, and the network parameters are continuously updated until the model converges or the number of iterations reaches the set termination value, and the final network model Ours is obtained;
[0017] Step S5: Component image classification
[0018] The image to be detected is input into the network model Ours, and the network model Ours gives the recognition result and credibility α. If α≥α 0The model recognition result is considered to be credible, and the detection result is directly output, where α 0 is an artificially set empirical value. On the contrary, if α<α 0 If the network recognition is wrong, it is considered that the next stage needs to be entered to complete the detection based on the classic image processing method to re-detect;
[0019] Step S6: Classical image processing
[0020] The median filter is used to smooth the image; the histogram equalization method is then used to adjust the distribution of the original image pixels so that they are more evenly distributed within the range of (0,255), thereby enhancing the image contrast;
[0021] Step S7: Image Binarization
[0022] The image processed in step S6 is converted into a grayscale image, and then the grayscale image is binarized by an adaptive threshold method, and the image is divided into a foreground and a background according to the grayscale characteristics of the image, and the uninteresting areas in the image are masked;
[0023] Step S8: Edge extraction
[0024] Perform morphological opening and closing operations on the binary image in step S7 to segment independent image elements. Then, adopt an edge detection method based on the Canny operator to preliminarily obtain the edge of the target according to the pixel gradient. Then, adopt a non-maximum pixel gradient suppression method to eliminate the stray response caused by edge detection and remove most non-edge points. By setting high and low thresholds, define pixels with gradient intensity higher than the high threshold as strong edges, and pixels with gradient intensity lower than the low threshold as not edge points. Pixels between the two are judged by an isolated weak edge suppression method. If there are strong edge pixels in the domain pixels of the pixel, the pixel is judged as a strong pixel until the edge of the object is obtained.
[0025] Step S9: Mark point recognition
[0026] First, the object contour is extracted according to the edge of the object obtained in step S8, all contours are retrieved and the entire level of nested contours is reconstructed, and then the circumscribed rectangle of the object is obtained according to the coordinates of the object contour. Whether the contour is a circle is determined by the aspect ratio of the circumscribed rectangle of the contour. After all the circles are obtained, they are screened according to the area of the circle to obtain the final Mark point. If the Mark point is detected, the center coordinates of the circle are directly output and matched with the Mark point information of the normal component, and the detection result is output; if the Mark point is not identified, it is necessary to proceed to the next step of text area extraction.
[0027] Step S10: Text area extraction
[0028] First, the outline of the text line is extracted, the minimum circumscribed rectangle of the text line outline is obtained, and the detection rectangular frame is marked in the original image. The rectangular frame area is the ROI part, and the ROI part is segmented as the foreground and background; then the pixel inversion operation is performed on the ROI part to turn it into black text on a white background; the processed feature image is then subjected to morphological transformation and maximum connected area operation to enhance the contrast of the character foreground relative to the noise background and highlight the edge contour of the character; the rotation angle of the minimum border of the non-horizontal character after the operation is calculated, and then the image is rotated and cropped to ensure that the text part is horizontal and located in the image; finally, the Image_to_String module in Tesseract-OCR is used to recognize the character information of PCB image components and give the recognition result.
[0029] Step S11: character matching
[0030] After step S9 and step S10, character information and coordinate information on the component to be identified are obtained, and by comparing the classification, character and coordinate information of the component to be identified with that of the standard component, it is determined whether the component has defects.
[0031] The present invention also includes a defect detection system, equipment and medium for a PCB component defect detection method based on the above-mentioned machine vision, specifically:
[0032] A PCB component defect detection system is used in PCB component quality inspection to implement the above-mentioned PCB component defect detection method based on machine vision, including a processing instruction module for executing each step in the method.
[0033] A PCB component defect detection device, comprising:
[0034] Memory: a computer program for storing the PCB component defect detection method based on machine vision, which is a computer-readable device;
[0035] Processor: used to implement the machine vision-based PCB component defect detection method when executing the computer program.
[0036] A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, can implement the machine vision-based PCB component defect detection method.
[0037] Compared with the prior art, the technical advantages of the present invention are:
[0038] 1. The deep learning model of step S3 of the present invention is an efficient combination of convolutional neural network and visual Transformer, which realizes the learning of global information and local information. A convolution module is designed to extract local features such as texture, edge, shape, etc., and a visual autoencoder module is designed to extract the global features of the image, so that the model focuses on the key areas in the image, and completes the information interaction between the two branches through the sequence and image conversion method, realizes multi-feature fusion, and improves the expression ability of the model.
[0039] 2. The deep learning model proposed in the present invention uses a large number of depthwise separable convolutions to replace standard convolutions. Compared with standard convolutions, depthwise separable convolutions do not have point multiplication operations in the channel direction, which reduces the number of model parameters. It uses a sparse attention mechanism to divide images into different groups and complete self-attention calculations between groups, which greatly reduces the amount of calculations and improves the model reasoning speed. It has the characteristics of fewer model parameters and faster model reasoning speed.
[0040] 3. This method combines deep learning methods and classical image processing methods to detect defects of components in PCB images in stages, achieving more intelligent and flexible defect detection and achieving a higher detection accuracy. Compared with traditional discrimination methods and other detection algorithms, this method obtains detection results the fastest and takes the least time.
[0041] 4. In steps S5-S10 of the present invention, the mechanism of the welding process of PCB components is analyzed, and the image characteristics of different types of components and different types of defects are obtained. Different discrimination indicators are set according to these characteristics. Accurate discrimination is achieved by establishing a strict indicator range, and the inspection results have good consistency and high reliability.
[0042] In summary, the present invention utilizes a deep learning model and a classic image processing method based on OpenCV to process image data in stages, realizes defect detection of PCB components, solves the problems of low detection efficiency and poor detection accuracy caused by manual detection, and can complete high-efficiency and high-speed real-time detection under the condition of non-contact detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a flow chart of a PCB component defect detection method proposed by the present invention.
[0044] Figure 2 This is a model diagram of the PCB component image classification algorithm based on convolution-visual Transformer joint feature learning.
[0045] Figure 3 This is the result of obtaining the coordinates of the rectangular Mark points using the classical image processing method in the present invention.
[0046] Figure 4 This is a result diagram of the circular Mark point position obtained using the classical image processing method in the present invention.
[0047] Figure 5 This is a result diagram of component character information obtained by the text area extraction and recognition method of the present invention. DETAILED DESCRIPTION
[0048] A certain implementation mode of the present invention is described in detail below with reference to the accompanying drawings.
[0049] Reference Figure 1 , a PCB component defect detection method, the steps comprising:
[0050] Step S1: Original image acquisition
[0051] Use a CCD camera to collect PCB component image data in a non-overlapping shooting mode to obtain a data set sample, take the mode value of the image resolution in the data set sample as the preset resolution, and uniformly convert all samples in the data set into the preset resolution size;
[0052] Step S2: Image preprocessing
[0053] The data set samples are divided into training set and test set in a ratio of 8:2, and the sample distribution in the training set and the test set is guaranteed to be consistent. All types of components are included. Based on the Transforms module of PyTorch, random center cropping, flipping, and rotation data enhancement operations are performed on the sample images of the training set.
[0054] The initial dataset is divided into training and test sets in a ratio of 8:2. First, the resolution of the original images is uniformly resized to 224, and then the original input of size (H, W, C) is converted into a tensor of shape (224, 224, 3) through random center cropping, random horizontal flipping and tensor conversion.
[0055] Step S3: Establish a deep learning model CVM
[0056] like Figure 2As shown, the deep learning model CVM is divided into three parts, namely: a shallow network, a deep network and a classifier. The shallow network includes three downsampling modules, each of which is composed of a 1x1 convolutional layer, a BN layer, a ReLU activation function, a 3x3 convolutional layer and a maximum pooling layer; the deep network is divided into two branches, one is a convolutional branch, and the other is a Transformer branch. The convolutional branch is composed of three 3x3 convolutional layers connected in sequence, and the Transformer branch is composed of three sparse visual encoders connected in sequence. Each sparse visual encoder includes a local feature extraction module (two convolutional layers), a global feature extraction module (Transformer Encoder) and a feature mixing module (splicing operation + convolutional layer); the classifier is composed of a fully connected layer and a softmax function, and the number of output channels of the fully connected layer is equal to the number of target categories.
[0057] To address the problems of convolutional neural networks lacking global information learning and visual Transformers lacking local feature extraction, downsampling operations are performed in the shallow network, and two different branches, convolution and visual encoder, are used in the deep network to complete local information learning and global information learning respectively, and a connection is established between the two branches to strengthen information interaction, realize low-level and high-level feature joint learning, and improve model performance; to address the problems of large computational complexity and large number of parameters of the visual Transformer attention mechanism, a sparse attention mechanism is proposed, that is, the three sparse visual encoders divide the image into different groups of patch blocks, and only calculate self-attention between patch blocks to avoid too many redundant pixels participating in the self-attention calculation, and use deep separable convolution instead of ordinary convolution to reduce the number of model parameters and improve the model inference speed.
[0058] Step S4: Model training
[0059] First, batchsize, epoch, optimizer and loss function hyperparameters are set. The batchsize is set to 30 and the number of epoch iterations is set to 100. The Adam optimizer and cosine annealing strategy are used to guide the network parameters to approach the theoretical optimal values. Then, the training set sample data is input into the deep learning model CVM in step S3 to learn the characteristics of the samples. The cross entropy loss function is selected as the loss function. The goal is to minimize the loss function value. The test set accuracy is selected as the evaluation indicator. Finally, the deep learning model CVM continuously iterates the training and continuously updates the network parameters until the model converges or the number of iterations reaches the set termination value to obtain the final network model Ours.
[0060] Step S5: Component image classification
[0061] Specifically, the process of component image classification is as follows: the image to be detected is input into the network model Ours, and the network model Ours gives the recognition result and the credibility α. If α≥α 0 The model recognition result is considered to be credible and the detection result is directly output, where α 0 is an artificially set empirical value. On the contrary, if α<α 0 If the network recognition is wrong, it is necessary to enter the next stage to complete the detection based on the classic image processing method for re-detection.
[0062] Step S6: Classical image processing
[0063] Classical image processing includes image smoothing and image enhancement. Because the images collected at industrial sites are usually salt and pepper noise, median filtering is used to smooth the image and reduce the impact of noise. The histogram equalization method is used to adjust the distribution of the original image pixels so that they are more evenly distributed in the (0,255) range, thereby enhancing the image contrast.
[0064] Step S7: Image Binarization
[0065] The image processed in step S6 is converted into a grayscale image, and then the grayscale image is binarized by an adaptive threshold method. The image is divided into a foreground and a background according to the grayscale characteristics of the image, and the uninteresting areas in the image are masked to facilitate better analysis of the shape and contour of the object.
[0066] Step S8: Edge extraction
[0067] Perform morphological opening and closing operations on the binary image in step S7 to segment independent image elements. Then, adopt an edge detection method based on the Canny operator to preliminarily obtain the edge of the target according to the pixel gradient. Then, adopt a non-maximum pixel gradient suppression method to eliminate the stray response caused by edge detection and remove most non-edge points. By setting high and low thresholds, define pixels with gradient intensity higher than the high threshold as strong edges, and pixels with gradient intensity lower than the low threshold as not edge points. Pixels between the two are judged by an isolated weak edge suppression method. If there are strong edge pixels in the domain pixels of the pixel, the pixel is judged as a strong pixel until the edge of the object is obtained.
[0068] Step S9: Mark point recognition
[0069] The mark point is a reference point on the image used to determine defects. It is usually a circle. For polar opposite defects, the mark point information can be used to determine the polarity of the component. The circle detection is performed using the contour search method. First, the object contour is extracted based on the edge of the object obtained in step S8. All contours are retrieved and the entire level of nested contours is reconstructed. Then, the circumscribed rectangle of the object is obtained based on the coordinates of the object contour. The aspect ratio of the circumscribed rectangle of the contour is used to determine whether the contour is a circle. Normally, the circumscribed rectangle of a circle is approximately the same as a square, so its aspect ratio is close to 1.0. After all the circles are obtained, they are screened based on the area of the circle to obtain the final mark point. If the mark point is detected, the coordinates of the center of the circle are directly output and matched with the mark point information of the normal component, and the detection result is output, such as Figure 3 , Figure 4 As shown; if the Mark point is not recognized, you need to proceed to the next step of text area extraction.
[0070] Step S10: Text area extraction
[0071] First, the outline of the text line is extracted, the minimum circumscribed rectangle of the text line outline is obtained, and the detection rectangular frame is marked in the original image. The rectangular frame area is the ROI part, and the ROI part is divided as the foreground and background; then the pixel inversion operation is performed on the ROI part to turn it into a black text on a white background; then the processed feature image is subjected to morphological transformation and maximum connected area operation to enhance the contrast of the character foreground relative to the noise background and highlight the edge contour of the character; the rotation angle of the minimum border of the non-horizontal character after the operation is calculated, and then the image is rotated and cropped to ensure that the text part is horizontal and located in the image; finally, the Image_to_String module in Tesseract-OCR is used to recognize the character information of PCB image components, and the recognition results are given, such as Figure 5 shown.
[0072] Step S11: character matching
[0073] After step S9 and step S10, character information and coordinate information on the component to be identified are obtained, and by comparing the classification, character and coordinate information of the component to be identified with that of the standard component, it is determined whether the component has defects.
[0074] Specifically, the type of component can be determined based on the first few letters of the character, for example, R represents resistance, L represents inductance, and C represents capacitance; the position of the character can be used to determine whether defects such as polarity reversal and wrong parts have occurred. If the recognized character does not match the standard component character, it means that the component has a wrong pasting defect. If the rotation angle of the character is 180°, it means that the component has a polarity reversal defect. Finally, the test result is directly output.
[0075] Implementation effect:
[0076] like Figure 3 , Figure 4 , Figure 5 As shown, the classification accuracy of the method of the present invention reaches 99.5%, and both mark point recognition and text recognition have achieved good results, which proves the effectiveness and advancement of the method.
[0077] Table 1 shows the accuracy results of the component classification task completed by the convolution-visual Transformer joint feature learning network in the present invention.
[0078] Table 1
[0079]
[0080]
[0081]
[0082] The defect detection system, device and medium of the PCB component defect detection method based on machine vision provided by the present invention are specifically:
[0083] A PCB component defect detection system is used in PCB component quality inspection to implement the above-mentioned PCB component defect detection method based on machine vision, including a processing instruction module for executing each step in the method.
[0084] A PCB component defect detection device, comprising:
[0085] Memory: a computer program for storing the PCB component defect detection method based on machine vision, which is a computer-readable device;
[0086] Processor: used to implement the machine vision-based PCB component defect detection method when executing the computer program.
[0087] A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, can implement the machine vision-based PCB component defect detection method.
[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for detecting defects in PCB components, characterized in that the steps include: Step S1: Original image acquisition Use a CCD camera to collect PCB component image data in a non-overlapping shooting mode to obtain a data set sample, take the mode value of the image resolution in the data set sample as the preset resolution, and uniformly convert all samples in the data set into the preset resolution size; Step S2: Image preprocessing The data set samples are divided into training set and test set according to the proportion, and the sample distribution in the training set and the test set is guaranteed to be consistent. All types of components are included. Based on the Transforms module of PyTorch, random center cropping, flipping, and rotation of sample images in the training set are performed as data augmentation operations. Step S3: Establish a deep learning model CVM The deep learning model CVM is divided into three parts: shallow network, deep network and classifier. The shallow network includes three downsampling modules, each of which is composed of a 1x1 convolution layer, a BN layer, a ReLU activation function, a 3x3 convolution layer and a maximum pooling layer; the deep network is divided into two branches, one is the convolution branch, and the other is the Transformer branch. The convolution branch is composed of three 3x3 convolution layers connected in sequence, and the Transformer branch is composed of three sparse visual encoders connected in sequence. Each sparse visual encoder includes a local feature extraction module, a global feature extraction module and a feature mixing module. The classifier consists of a fully connected layer and a softmax function. The number of output channels of the fully connected layer is equal to the number of target categories. By performing downsampling operations in the shallow network, two different branches, convolution and visual encoder, are used in the deep network to complete local information and global information learning respectively, and a connection is established between the two branches to strengthen information interaction, so as to realize low-level-high-level feature joint learning. The three sparse visual encoders divide the images into different groups of patch blocks and only calculate self-attention between patch blocks; Step S4: Model training First, batchsize, epoch, optimizer and loss function hyperparameters are set, and the Adam optimizer and cosine annealing strategy are used to guide the network parameters to approach the theoretical optimal values; then, the training set sample data is input into the deep learning model CVM in step S3 to learn the characteristics of the samples. The cross entropy loss function is selected as the loss function, the goal is to minimize the loss function value, and the test set accuracy is selected as the evaluation indicator; finally, the deep learning model CVM continuously iterates the training and continuously updates the network parameters until the model converges or the number of iterations reaches the set termination value, and the final network model Ours is obtained. Step S5: Component image classification The process of component image classification is as follows: the image to be detected is input into the network model Ours, and the network model gives the recognition result and credibility α. If α≥α0, the model recognition result is considered to be credible and the detection result is directly output, where α0 is an manually set empirical value. On the contrary, if α<α0, it is considered that the network recognition is wrong and it is necessary to enter the next stage to complete the detection based on the classic image processing method for re-detection; Step S6: Classical image processing The median filter is used to smooth the image; the histogram equalization method is then used to adjust the distribution of the original image pixels so that they are more evenly distributed within the range of (0,255), thereby enhancing the image contrast; Step S7: Image Binarization The image processed in step S6 is converted into a grayscale image, and then the grayscale image is binarized by an adaptive threshold method, and the image is divided into a foreground and a background according to the grayscale characteristics of the image, and the uninteresting areas in the image are masked; Step S8: Edge extraction Perform morphological opening and closing operations on the binary image in step S7 to segment independent image elements, then adopt an edge detection method based on the Canny operator to preliminarily obtain the edge of the target according to the pixel gradient, then adopt a non-maximum pixel gradient suppression method to eliminate the stray response caused by edge detection, remove most of the non-edge points, and define the pixel points with a gradient intensity higher than the high threshold as a strong edge by setting high and low thresholds, and the pixel points with a gradient intensity lower than the low threshold are not regarded as edge points. The pixel points between the two are judged by the isolated weak edge suppression method. If there is a strong edge image point in the field pixel of the pixel point, the point is judged as a strong pixel point until the edge of the object is obtained; Step S9: Mark point recognition First, the object contour is extracted according to the edge of the object obtained in step S8, all contours are retrieved and the entire level of nested contours is reconstructed, and then the circumscribed rectangle of the object is obtained according to the coordinates of the object contour. Whether the contour is a circle is determined by the aspect ratio of the circumscribed rectangle of the contour. After all the circles are obtained, they are screened according to the area of the circle to obtain the final Mark point. If the Mark point is detected, the center coordinates of the circle are directly output and matched with the Mark point information of the normal component, and the detection result is output; if the Mark point is not identified, it is necessary to proceed to the next step of text area extraction.
2. A PCB component defect detection method according to claim 1, characterized in that the steps include: If the Mark point is not recognized, it is necessary to proceed to the next step, i.e., step S10: text area extraction: first, the outline of the text line is extracted, the minimum circumscribed rectangle of the text line outline is obtained, and a detection rectangular frame is marked in the original image. The rectangular frame area is the ROI part, and the ROI part is segmented as the foreground and background; then the pixel inversion operation is performed on the ROI part to convert it into a black text on a white background; The processed feature image is then subjected to morphological transformation and maximum connected area operations to enhance the contrast of the character foreground relative to the noise background and highlight the edge contour of the character; the rotation angle of the minimum border of the non-horizontal character after the operation is calculated, and then the image is rotated and cropped to ensure that the text part is horizontal and located in the image; finally, the Image_to_String module in Tesseract-OCR is used to recognize the character information of PCB image components and give the recognition results; Step S11: character matching After step S9 and step S10, character information and coordinate information on the component to be identified are obtained, and by comparing the classification, character and coordinate information of the component to be identified with that of the standard component, it is determined whether the component has defects.
3. A PCB component defect detection system, characterized in that: The invention is applied in the quality inspection of PCB board components to realize the PCB board component defect detection method described in claim 1 or 2, and comprises a processing instruction module for executing each step in the method.
4. A PCB component defect detection device, characterized in that: include: Memory: a computer program storing the PCB component defect detection method according to claim 1 or 2, which is a computer-readable device; Processor: used to implement the PCB board component defect detection method described in claim 1 or 2 when executing the computer program.
5. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it can implement the PCB board component defect detection method described in claim 1 or 2.
Citation Information
Patent Citations
Printed circuit board AOI detection image stitching method
CN105184739A
Full-automatic dairy cow cervical lesion physical examination method
CN114240863A
Improved chip multi-defect detection method and system based on fusion of SwinIR and RT-DETR
CN117934420A
Cited By
Electronic component product information processing method and system based on data dictionary tool
CN119862310A
Defect detection method and device, electronic equipment and storage medium
CN120088229A
Defect detection method and device, electronic device, and storage medium
CN120088229B
Automobile circuit board quality monitoring method based on OCR
CN120599635A
