A PCB line sequence detection method and system based on image recognition

Automatically detecting PCB board line sequence through image recognition technology solves the problems of low efficiency and low accuracy in existing methods, realizes efficient and accurate line sequence detection, and reduces manual intervention.

CN115239690BActive Publication Date: 2025-09-19CHENGDU UNION BIG DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210961574.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-11
Publication Date
2025-09-19
Estimated Expiration
2042-08-11

AI Technical Summary

Technical Problem

Existing PCB line sequence detection methods are inefficient and inaccurate, prone to missed detections, and rely on manual re-inspection, which is greatly affected by personal and environmental factors.

Method used

An image recognition-based method is used to automatically detect the line sequence of PCB carriers through threshold segmentation, template matching, affine transformation and board line color recognition. The method includes steps such as image conversion to HSV image, threshold segmentation, template matching, image labeling and affine transformation, and board line color recognition.

Benefits of technology

It improves the efficiency and accuracy of PCB board line sequence detection, reduces the burden of manual detection, prevents missed detection, and ensures production quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115239690B_ABST
    Figure CN115239690B_ABST
Patent Text Reader

Abstract

The present invention provides a PCB line sequence detection method and system based on image recognition, relating to the technical field of PCB line sequence detection. The method comprises the following steps: obtaining a PCB carrier inspection image, the PCB carrier inspection image comprising a PCB carrier area image and a board line welding area image; performing threshold segmentation or template matching processing on the PCB carrier inspection image to obtain a PCB carrier area image; performing image labeling and affine transformation processing based on the PCB carrier area image to obtain a board line welding area image; performing board line color recognition on the board line welding area image, and determining whether the board line welding sequence is incorrect based on the board line color recognition result. The present invention performs simple and rapid line sequence detection on PCB carriers based on image recognition and a classifier model, thereby ensuring the production quality of PCB carriers, reducing the workload of manual inspection, improving the efficiency and accuracy of re-inspection, and preventing missed inspections.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of PCB line sequence detection, and in particular to a PCB line sequence detection method and system based on image recognition. Background Art

[0002] The production and manufacturing of PCB (Printed Circuit Board) substrates is complex and tedious. Various product defects are easily introduced during the manufacturing process. The types of product defects are diverse, and the manifestations vary in defect type, color depth, etc.

[0003] Especially during PCB soldering, the wiring sequence varies depending on the color of the wires on the PCB. However, controlling the wiring sequence depends entirely on the experience and proficiency of the on-site workers. Due to the heavy workload and long working hours, soldering errors are prone to occur, affecting product quality. Therefore, PCB wiring sequence inspection is necessary.

[0004] Existing PCB line sequence detection methods mostly use manual re-inspection. Since manual re-inspection is greatly affected by personal and environmental factors, the re-inspection efficiency and accuracy are low, and there is a possibility of missed detection. Summary of the Invention

[0005] To address the issues of low efficiency and low accuracy in existing PCB line sequence detection, embodiments of the present invention provide a PCB line sequence detection method and system based on image recognition. These methods can perform simple and rapid line sequence detection on PCB substrates, thereby ensuring the production quality of PCB substrates, reducing the workload of manual inspection, improving re-inspection efficiency and accuracy, and preventing missed inspections.

[0006] In a first aspect, an embodiment of the present invention provides a PCB line sequence detection method based on image recognition, the method comprising the following steps:

[0007] (1) obtaining a PCB carrier inspection image, wherein the PCB carrier inspection image includes an image of the PCB carrier area and an image of the board line welding area;

[0008] (2) performing threshold segmentation or template matching processing on the PCB substrate detection image to obtain a PCB substrate area image;

[0009] (3) Perform image marking and affine transformation based on the PCB carrier area image to obtain the board line welding area image;

[0010] (4) Performing plate line color recognition on the plate line welding area image, and determining whether the plate line welding sequence is wrong based on the plate line color recognition result.

[0011] In the above embodiment, to quickly and simply acquire a PCB carrier area image, threshold segmentation or template matching is performed on the PCB carrier inspection image. To quickly and accurately locate the line soldering area image at the root end of the PCB carrier area image, image marking and affine transformation are performed based on the PCB carrier area image. To accurately determine whether there are line sequence errors in the line soldering area image, line color recognition is performed on the line soldering area image to determine whether the line soldering sequence is incorrect. The entire process is simple and fast, ensuring the production quality of the PCB carrier, reducing the workload of manual inspection, improving the efficiency and accuracy of re-inspection, and preventing missed inspections.

[0012] As some optional implementations of the present application, in order to quickly and accurately perform threshold segmentation and template matching in the later stage, after obtaining the PCB substrate detection image, it is necessary to perform image conversion on the PCB substrate detection image, converting the PCB substrate detection image from an RGB image to an HSV image.

[0013] As some optional implementations of the present application, in order to simply and quickly obtain an image of the PCB substrate area, it is necessary to perform threshold segmentation on the PCB substrate detection image. The process of performing threshold segmentation on the PCB substrate detection image is as follows:

[0014] (2.11) Determine the segmentation threshold T and compare the grayscale value of the pixel point of the PCB substrate detection image with the segmentation threshold T;

[0015] (2.12) Pixels with grayscale values ​​greater than or equal to the segmentation threshold T are marked as 1, and pixels with grayscale values ​​less than the segmentation threshold T are marked as 0;

[0016] (2.13) Perform image extraction on the pixel points marked as 1 to obtain the PCB carrier area image.

[0017] As some optional implementations of the present application, the formula for threshold segmentation of the PCB substrate detection image is as follows:

[0018]

[0019] Where (i, j) is the coordinate of the pixel point of the PCB substrate inspection image, g(i, j) is the grayscale value marking result of the pixel point of the PCB substrate inspection image, and f(i, j) is the grayscale value of the pixel point of the PCB substrate inspection image.

[0020] As some optional implementations of the present application, in order to simply and quickly obtain an image of the PCB substrate area, it is necessary to perform template matching on the PCB substrate detection image. The process of performing template matching on the PCB substrate detection image is as follows:

[0021] (2.21) Determine the matching template M and the matching threshold T1, and perform similarity matching between the PCB substrate inspection image and the matching template M;

[0022] (2.22) The area with similarity greater than the matching threshold T1 is selected as the PCB substrate area image.

[0023] As some optional embodiments of the present application, in order to quickly and accurately locate the board line welding area sub-image M1 at the root end of the PCB carrier area image, the process of image marking the PCB carrier area image is as follows:

[0024] (3.11) The PCB carrier area image is segmented to obtain several PCB carrier area sub-images P1, P2, ..., P n ;

[0025] (3.12) Image marking is performed based on the PCB carrier area sub-image P1 to obtain the board line welding area sub-image M1.

[0026] As some optional implementations of the present application, in order to quickly and accurately locate the board line welding area image at the root end of the PCB carrier area image, the process of performing affine transformation on the PCB carrier area image is as follows:

[0027] (3.21) Perform affine transformation on the plate line welding area sub-image M1 to obtain the plate line welding area sub-image M2...M n ;

[0028] (3.22) The plate line welding area sub-images M1, M2...M n The images are stitched together in the order of arrangement to obtain the plate line welding area image.

[0029] As some optional implementations of the present application, the formula for performing affine transformation on the plate line welding area sub-image M1 is as follows:

[0030]

[0031] Among them, (x, y) is the sub-image M2...M of the plate line welding area n (v, w) are the coordinates of the boundary pixel points of the line-plate welding area sub-image M1, and a1, b1, c1, a2, b2, and c2 are variable constants.

[0032] As some optional embodiments of the present application, in order to accurately determine whether there is a line sequence error in the plate line welding area image, it is necessary to perform plate line color recognition on the plate line welding area image. The process of determining whether the plate line welding sequence is incorrect based on the plate line color recognition result is as follows:

[0033] (4.1) Use the classifier algorithm model to train the plate line color model;

[0034] (4.2) Inputting the plate line welding area image into the trained classifier algorithm model, and performing plate line color recognition on the plate line welding area image through the classifier algorithm model;

[0035] (4.3) Match the plate wire color recognition result with the color sequence template. If the match is successful, the plate wire welding sequence is correct. Otherwise, the plate wire welding sequence is wrong.

[0036] In a second aspect, the present invention provides a PCB line sequence detection system based on image recognition, the system comprising:

[0037] A PCB carrier board detection image acquisition unit, wherein the PCB carrier board detection image acquisition unit acquires a PCB carrier board detection image;

[0038] a PCB carrier area image acquisition unit, which performs threshold segmentation or template matching processing on the PCB carrier detection image to obtain a PCB carrier area image;

[0039] a board line welding area image acquisition unit, which performs image marking and affine transformation processing on the PCB carrier area image to obtain a board line welding area image;

[0040] The plate line welding sequence determination unit performs plate line color recognition on the plate line welding area image and determines whether the plate line welding sequence is wrong based on the plate line color recognition result.

[0041] In a third aspect, an embodiment of the present invention provides a PCB line sequence detection mechanism based on image recognition, the mechanism comprising a detection rack, a conveyor belt arranged on the detection rack, an image collector, and an industrial computer;

[0042] The conveyor belt is used to transmit the PCB carrier board, and the image collector is used to collect the PCB carrier board detection image; the industrial computer is used to perform PCB line sequence detection on the PCB carrier board detection image to determine whether the board line welding sequence is wrong.

[0043] As some optional embodiments of the present application, the mechanism also includes a photoelectric sensor and an audible and visual alarm arranged on the detection frame; the photoelectric sensor is used to detect the position of the PCB carrier on the conveyor belt. When the PCB carrier is transmitted to a preset position, the photoelectric sensor outputs a signal to the industrial computer, and the industrial computer controls the image collector to collect the PCB carrier detection image; the audible and visual alarm is used to issue an audible and visual alarm based on the PCB line sequence detection result output by the industrial computer.

[0044] In a fourth aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the image recognition-based PCB line sequence detection method when executing the computer program.

[0045] In a fifth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the PCB line sequence detection method based on image recognition are implemented.

[0046] The beneficial effects of the present invention are as follows: the present invention performs simple and rapid line sequence detection on PCB substrates based on image segmentation, image recognition, and a classifier model, thereby ensuring the production quality of PCB substrates, reducing the workload of manual inspection, improving re-inspection efficiency and accuracy, and preventing missed inspections.

[0047] The present invention combines the structural characteristics of the PCB carrier board for positioning, and selects the image of the board line welding area to be inspected by locating the upper border line. Due to the precise positioning and selection of the target to be inspected, the PCB carrier board line sequence determination result is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0049] Figure 1 1 is a step diagram of a PCB line sequence detection method according to some embodiments of the present invention.

[0050] Figure 2 is an RGB image of a PCB substrate detection image according to some embodiments of the present invention.

[0051] Figure 3 is an HSV graph of a PCB substrate inspection image according to some embodiments of the present invention.

[0052] Figure 4 1 is an example diagram of an image of a PCB carrier area according to some embodiments of the present invention.

[0053] Figure 5 1 is an example diagram of an image of a plate line welding area according to some embodiments of the present invention.

[0054] Figure 6is a system block diagram of a PCB line sequence detection system according to some embodiments of the present invention.

[0055] Figure 7 1 is a structural diagram of a PCB line sequence detection mechanism according to some embodiments of the present invention.

[0056] Markings in the figure: a-detection rack, b-transmission belt, c-image collector, d-industrial computer, e-photoelectric sensor, f-sound and light alarm. DETAILED DESCRIPTION

[0057] In order to better understand the above technical solution, the technical solution of the present invention is described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations on the technical solution of the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0058] It should also be understood that, in order to simplify the presentation of the present disclosure and thereby facilitate understanding of at least one embodiment of the invention, the foregoing description of the embodiments of the invention sometimes combines multiple features into a single embodiment, figure, or description thereof. However, this disclosure method does not imply that the subject matter of the invention requires more features than those recited in the claims. In fact, an embodiment may have fewer features than all of the features of a single disclosed embodiment.

[0059] Example 1

[0060] The present invention provides a PCB line sequence detection method based on image recognition, please refer to Figure 1 , the method comprises the following steps:

[0061] (1) Obtain the PCB substrate inspection image, perform image conversion on the PCB substrate inspection image, and convert the PCB substrate inspection image from RGB image to HSV image. Figure 2 、 Figure 3 , the PCB carrier inspection image includes a PCB carrier area image and a board line welding area image;

[0062] (2) Performing threshold segmentation processing on the PCB substrate detection image to obtain a PCB substrate area image;

[0063] (3) Perform image labeling and affine transformation on the PCB carrier area image to obtain the board line welding area image;

[0064] (4) Performing plate line color recognition on the plate line welding area image, and determining whether the plate line welding sequence is wrong based on the plate line color recognition result.

[0065] In the above embodiment, to quickly and simply acquire a PCB carrier area image, threshold segmentation or template matching is performed on the PCB carrier inspection image. To quickly and accurately locate the line soldering area image at the root end of the PCB carrier area image, image marking and affine transformation are performed based on the PCB carrier area image. To accurately determine whether there are line sequence errors in the line soldering area image, line color recognition is performed on the line soldering area image to determine whether the line soldering sequence is incorrect. The entire process is simple and fast, ensuring the production quality of the PCB carrier, reducing the workload of manual inspection, improving the efficiency and accuracy of re-inspection, and preventing missed inspections.

[0066] Specifically, in order to simply and quickly obtain the PCB carrier area image, this embodiment uses a threshold segmentation method to separate the PCB carrier area image from the PCB carrier detection image. The key to threshold segmentation is to determine the segmentation threshold T, where the segmentation threshold T can be a global threshold, an adaptive threshold, an optimal threshold, etc.

[0067] The global threshold refers to using the same threshold to process the entire image, which is suitable for images with obvious contrast between background and foreground;

[0068] The adaptive threshold refers to using multiple thresholds to process several sub-images of the entire image separately, which is suitable for images with inconsistent background and foreground.

[0069] The optimal threshold refers to determining the best threshold for a given image by analyzing the histogram. For example, when the histogram clearly shows a double peak, the midpoint of the two peaks is selected as the optimal threshold, and then the entire image is processed using the optimal threshold. This is suitable for segmenting images with a partial foreground and a clear contrast with the background.

[0070] Specifically, in order to simply and quickly obtain the PCB substrate area image, it is necessary to perform threshold segmentation on the PCB substrate detection image. The process of performing threshold segmentation on the PCB substrate detection image in step (2) is as follows:

[0071] (2.11) Determine the segmentation threshold T and compare the grayscale value of the pixel point of the PCB substrate detection image with the segmentation threshold T;

[0072] (2.12) Pixels with grayscale values ​​greater than or equal to the segmentation threshold T are marked as 1, and pixels with grayscale values ​​less than the segmentation threshold T are marked as 0;

[0073] The formula for threshold segmentation of PCB substrate inspection image is as follows:

[0074]

[0075] Wherein, (i, j) is the coordinate of the pixel point of the PCB substrate inspection image, g(i, j) is the grayscale value marking result of the pixel point of the PCB substrate inspection image, and f(i, j) is the grayscale value of the pixel point of the PCB substrate inspection image;

[0076] (2.13) Perform image extraction on the pixel points marked as 1 to obtain the PCB carrier area image.

[0077] In the above embodiment, in order to quickly and accurately locate the board line welding area sub-image M1 at the root end of the PCB carrier area image, the process of image marking the PCB carrier area image in step (3) is as follows:

[0078] (3.11) The PCB carrier area image is segmented to obtain several PCB carrier area sub-images P1, P2, ..., P n , see Figure 4 ,In this embodiment, the PCB carrier area sub-image includes P1, P2, P3, and P4;

[0079] (3.12) Image marking is performed based on the PCB carrier area sub-image P1 to obtain the board line welding area sub-image M1.

[0080] Specifically, the process of performing image marking based on the PCB carrier area sub-image P1 to obtain the board line welding area sub-image M1 is as follows:

[0081] ① Perform image recognition on the PCB carrier area image P1 to obtain the border line and two vias of the PCB carrier area image P1;

[0082] ② Obtain a positioning line using the centers of the two vias as reference points, and select the upper and lower border lines parallel to the positioning line based on the positioning line;

[0083] ③ Compare the distances between the upper and lower border lines and the positioning line respectively, select the border line with the smaller distance, and set a target frame based on this border line as the reference line. The image within this target frame is the wire welding area sub-image M1.

[0084] Existing PCB carriers are all provided with two vias, and the vias are relatively close to the upper border line. Therefore, this embodiment combines the structure of the PCB carrier board and determines the specific positions of the vias and the specific positions of the PCB board border lines based on image recognition. The upper border line is obtained with the centers of the two vias as reference points, and then a target frame is generated based on the specific position of the upper border line, thereby realizing the acquisition of the line welding area sub-image M1. This facilitates the subsequent acquisition of the entire board line welding area image in combination with affine transformation. The entire process is convenient and fast, and the area positioning is accurate, making the line sequence determination result more accurate.

[0085] In the above embodiment, in order to quickly and accurately locate the board line welding area image at the root end of the PCB carrier area image, the process of performing affine transformation on the PCB carrier area image in step (3) is as follows:

[0086] (3.21) Perform affine transformation on the plate line welding area sub-image M1 to obtain the plate line welding area sub-image M2...M n The affine transformation includes translation transformation, rotation transformation, scale transformation, vertical offset transformation, horizontal offset transformation, etc.; the affine transformation mainly involved in this embodiment is translation transformation. When the PCB carrier area sub-images P1, P2...P n When they are not on the same horizontal line, vertical offset transformation and horizontal offset transformation are also involved.

[0087] The formula for affine transformation of the plate line welding area sub-image M1 is as follows:

[0088]

[0089] Among them, (x, y) is the sub-image M2...M of the plate line welding area n (v, w) are the coordinates of the boundary pixel points of the line-plate welding area sub-image M1, and a1, b1, c1, a2, b2, and c2 are variable constants.

[0090] (3.22) The plate line welding area sub-images M1, M2...M n Combine the images in the order of arrangement to obtain the image of the plate line welding area. Figure 5 ,and Figure 4 Correspondingly, in this embodiment, the plate line welding area sub-images include M1, M2, M3, and M4.

[0091] In the above embodiment, the process of determining whether the plate wire welding sequence is incorrect based on the plate wire color recognition result is as follows:

[0092] (4.1) Use the classifier algorithm model to train the plate line color model;

[0093] (4.2) Inputting the plate line welding area image into the trained classifier algorithm model, and performing plate line color recognition on the plate line welding area image through the classifier algorithm model;

[0094] (4.3) Match the plate wire color recognition result with the color sequence template. If the match is successful, the plate wire welding sequence is correct. Otherwise, the plate wire welding sequence is wrong. The wrong plate wire will be marked to facilitate quick locating of the wrong welded plate wire later.

[0095] Specifically, the training steps of the classifier algorithm model are as follows:

[0096] (4.11) Capture sample images of various colors (e.g., red, yellow, blue, white, black, etc.) from the PCB substrate inspection image and label the sample images, i.e., label the sample images with corresponding colors to obtain a data set;

[0097] (4.12) Input the sample data in the dataset into the MLP (Multi-layer Perceptron) classifier for model training.

[0098] Among them, the MLP classifier is trained on the data set to learn a function, function f(·):R m →R o , m is the dimension of input data, o is the dimension of output data; given a eigenvalue X=X1,X2......X m The MLP classifier can learn an estimated value of a nonlinear function for each classification and regression, given a target value Y. Unlike logistic regression, in an MLP classifier, there can be one or more nonlinear layers, or hidden layers, between the input and output layers. Each neuron in the hidden layer transforms the input layer value using a weighted linear summation and then uses a nonlinear activation function. The output layer receives the corresponding value from the last hidden layer and transforms it into an output value.

[0099] Example 2

[0100] The present invention provides a PCB line sequence detection method based on image recognition, please refer to Figure 1 , the method comprises the following steps:

[0101] (1) Obtain the PCB substrate inspection image, perform image conversion on the PCB substrate inspection image, and convert the PCB substrate inspection image from RGB image to HSV image. Figure 2 、 Figure 3 , the PCB carrier board detection image includes a PCB carrier board area image;

[0102] (2) Performing template matching processing on the PCB carrier board detection image to obtain a PCB carrier board area image;

[0103] (3) Perform image labeling and affine transformation on the PCB carrier area image to obtain the board line welding area image;

[0104] (4) Performing plate line color recognition on the plate line welding area image, and determining whether the plate line welding sequence is wrong based on the plate line color recognition result.

[0105] In the above embodiment, in order to simply and quickly acquire an image of the PCB carrier area, this embodiment uses a template matching method to locate the PCB carrier area image and then extract the PCB carrier area image. Template matching mainly involves pixel-based template matching or feature-based template matching. Pixel-based template matching calculates the similarity between the template image and the sub-image in the image to be matched based on their grayscale value information. Feature-based template matching calculates the functional relationship between the feature points of the image to be matched and then calculates the similarity between the template image and the sub-image in the image to be matched based on the functional relationship between the feature points. This method is highly robust to factors such as target rotation, scale change, and illumination changes.

[0106] Specifically, in order to simply and quickly obtain the PCB substrate area image, it is necessary to perform image matching on the PCB substrate detection image. The process of performing template matching on the PCB substrate detection image in step (2) is as follows:

[0107] (2.21) Determine the matching template M and the matching threshold T1, and perform similarity matching between the PCB substrate inspection image and the matching template M;

[0108] (2.22) The area with similarity greater than the matching threshold T1 is selected as the PCB substrate area image.

[0109] In the above embodiment, in order to quickly and accurately locate the board line welding area sub-image M1 at the root end of the PCB carrier area image, the process of image marking the PCB carrier area image in step (3) is as follows:

[0110] (3.11) The PCB carrier area image is segmented to obtain several PCB carrier area sub-images P1, P2, ..., P n , see Figure 4 ,In this embodiment, the PCB carrier area sub-image includes P1, P2, P3, and P4;

[0111] (3.12) Image marking is performed based on the PCB carrier area sub-image P1 to obtain the board line welding area sub-image M1.

[0112] Specifically, the process of performing image marking based on the PCB carrier area sub-image P1 to obtain the board line welding area sub-image M1 is as follows. Figure 5 :

[0113] ① Perform image recognition on the PCB carrier area image P1 to obtain the border and two vias of the PCB carrier area image P1;

[0114] ② Obtain a positioning line according to the center of the two vias, and obtain an upper border line and a lower border line parallel to the positioning line based on the positioning line;

[0115] ③ Compare the lengths of the upper and lower border lines, select the longer border line, and set a target frame based on this border line as the reference line. The image within this target frame is the wire welding area sub-image M1.

[0116] Existing PCB carriers are all provided with two vias, and the distance between the vias and the upper border line is relatively long. Therefore, this embodiment combines the structure of the PCB carrier board and determines the specific positions of the vias and the specific positions of the PCB board border lines based on image recognition. The upper border line is obtained in parallel with the center points of the two vias as reference points, and then a target frame is generated based on the specific position of the upper border line, thereby realizing the acquisition of the line welding area sub-image M1. This facilitates the subsequent acquisition of the entire board line welding area image in combination with affine transformation. The whole process is convenient and fast, and the area positioning is accurate, making the line sequence determination result more accurate.

[0117] In the above embodiment, in order to quickly and accurately locate the board line welding area image at the root end of the PCB carrier area image, the process of performing affine transformation on the PCB carrier area image in step (3) is as follows:

[0118] (3.21) Perform affine transformation on the plate line welding area sub-image M1 to obtain the plate line welding area sub-image M2...M n The affine transformation includes translation transformation, rotation transformation, scale transformation, vertical offset transformation, horizontal offset transformation, etc.; the affine transformation mainly involved in this embodiment is translation transformation. When the PCB carrier area sub-images P1, P2...P n When they are not on the same horizontal line, vertical offset transformation and horizontal offset transformation are also involved.

[0119] The formula for affine transformation of the plate line welding area sub-image M1 is as follows:

[0120]

[0121] Where (xy) is the sub-image M2...M of the plate line welding area n The coordinates of the boundary pixel points of (vw) are the coordinates of the boundary pixel points of the line-plate welding area sub-image M1, and a1, b1, c1, a2, b2, and c2 are variable constants.

[0122] (3.22) The plate line welding area sub-images M1, M2...M n Combine the images in the order of arrangement to obtain the image of the plate line welding area. Figure 5 ,and Figure 4 Correspondingly, in this embodiment, the plate line welding area sub-images include M1, M2, M3, and M4.

[0123] In the above embodiment, the process of determining whether the plate wire welding sequence is incorrect based on the plate wire color recognition result in step (4) is as follows:

[0124] (4.1) Use the classifier algorithm model to train the plate line color model;

[0125] (4.2) Inputting the plate line welding area image into the trained classifier algorithm model, and performing plate line color recognition on the plate line welding area image through the classifier algorithm model;

[0126] (4.3) Match the plate wire color recognition result with the color sequence template. If the match is successful, the plate wire welding sequence is correct. Otherwise, the plate wire welding sequence is wrong. The wrong plate wire will be marked to facilitate quick locating of the wrong welded plate wire later.

[0127] Specifically, the training steps of the classifier algorithm model are as follows:

[0128] (4.11) Capture sample images of various colors (e.g., red, yellow, blue, white, black, etc.) from the PCB substrate inspection image and label the sample images, i.e., label the sample images with corresponding colors to obtain a data set;

[0129] (4.12) Input the sample data in the dataset into the MLP (Multi-layer Perceptron) classifier for model training.

[0130] Among them, the MLP classifier is trained on the data set to learn a function, function f(·):R m →R o , m is the dimension of input data, o is the dimension of output data; given a eigenvalue X=X1,X2......X m The MLP classifier can learn an estimated value of a nonlinear function for each classification and regression, given a target value Y. Unlike logistic regression, in an MLP classifier, there can be one or more nonlinear layers, or hidden layers, between the input and output layers. Each neuron in the hidden layer transforms the input layer value using a weighted linear summation and then uses a nonlinear activation function. The output layer receives the corresponding value from the last hidden layer and transforms it into an output value.

[0131] Example 3

[0132] The present invention provides a PCB line sequence detection system based on image recognition, please refer to Figure 6 , the system comprising:

[0133] A PCB carrier board detection image acquisition unit, wherein the PCB carrier board detection image acquisition unit acquires a PCB carrier board detection image;

[0134] a PCB carrier area image acquisition unit, which performs threshold segmentation or template matching processing on the PCB carrier detection image to obtain a PCB carrier area image;

[0135] A board line welding area image acquisition unit, wherein the board line welding area image acquisition unit performs image marking and affine transformation processing based on the PCB carrier area image to obtain a board line welding area image;

[0136] The plate line welding sequence determination unit performs plate line color recognition on the plate line welding area image and determines whether the plate line welding sequence is wrong based on the plate line color recognition result.

[0137] Example 4

[0138] A PCB line sequence detection mechanism based on image recognition, please refer to Figure 7 The mechanism includes a detection rack a, a conveyor belt b arranged on the detection rack a, an image collector c, an industrial computer d, a photoelectric sensor e and an audible and visual alarm f;

[0139] The conveyor belt b is used to transport the PCB carrier, and the image collector c is used to collect the PCB carrier detection image; the industrial computer d is used to perform PCB line sequence detection on the PCB carrier detection image to determine whether the board line welding sequence is wrong;

[0140] The photoelectric sensor e is used to detect the position of the PCB carrier on the conveyor belt b. When the PCB carrier is transferred to a preset position, the photoelectric sensor e outputs a signal to the industrial computer d, which controls the image collector to collect the PCB carrier detection image; the sound and light alarm f is used to issue an sound and light alarm based on the PCB line sequence detection result output by the industrial computer d; wherein, the image collector c can be a color camera, etc.

[0141] In this embodiment, the working principle of the PCB line sequence detection mechanism is as follows:

[0142] The soldered PCB carrier is placed on the conveyor belt b, and the PCB carrier is transported by the conveyor belt b;

[0143] When the PCB carrier is transferred to the bottom of the image collector c, the photoelectric sensor e is triggered, and the industrial computer d controls the image collector c to collect the PCB carrier inspection image;

[0144] The PCB line sequence is detected based on the PCB substrate detection image by the industrial computer d to determine whether the board line soldering sequence is incorrect. If an error occurs, the sound and light alarm f is controlled by the industrial computer d to sound and light alarm, and the position of the erroneous board line can be checked through the industrial computer d.

[0145] Example 5

[0146] The present invention provides a computer device, which includes a memory and a processor. The memory stores a computer program, and when the processor runs the computer program, it executes the steps of the PCB line sequence detection method based on image recognition described in Example 1 or 2.

[0147] The computer device provided in this embodiment can implement the method described in Example 1 or 2. To avoid repetition, it will not be described here.

[0148] Example 6

[0149] The present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of a PCB line sequence detection method based on image recognition described in Example 1 or 2 are implemented.

[0150] The computer-readable storage medium provided in this embodiment can implement the method described in Example 1 or 2, and will not be described again here to avoid repetition.

[0151] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0152] The memory can be used to store the computer program and / or module, and the processor implements the various functions of the printed circuit board defect detection device of the invention by running or executing the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.). In addition, the memory can include high-speed random access memory and non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0153] In the several embodiments provided in this application, it should be understood that the disclosed methods, systems and mechanisms can also be implemented in other ways. The mechanism embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architectures, functions and operations of the mechanisms, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or flowchart, and the combination of boxes in the structure diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

Claims

1. A PCB line sequence detection method based on image recognition, characterized in that: The method comprises the following steps: Obtain PCB substrate inspection images; Perform threshold segmentation or template matching on the PCB substrate detection image to obtain a PCB substrate area image; Performing image marking and affine transformation processing based on the PCB carrier area image to obtain a board line welding area image, wherein the board line welding area image is an area image of the root end of the PCB carrier area image; Performing plate line color recognition on the plate line welding area image, and determining whether the plate line welding sequence is incorrect based on the plate line color recognition result; The process of image labeling and affine transformation of the PCB carrier area image is as follows: The PCB carrier area image is segmented to obtain several PCB carrier area sub-images P1, P2, ..., P n ; Perform image recognition on the PCB carrier area image P1 to obtain a border line and two vias of the PCB carrier area image P1; A positioning line is obtained by taking the centers of the two via holes as reference points, and an upper border line and a lower border line parallel to the positioning line are selected based on the positioning line; Compare the distances between the upper and lower frame lines and the positioning line respectively, select the frame line with the smaller distance, and set a target frame with this frame line as the reference line. The image within this target frame is the plate line welding area sub-image M1, thereby obtaining the plate line welding area sub-image M1; Perform affine transformation on the plate line welding area sub-image M1 to obtain the plate line welding area sub-image M2...M n The affine transformation includes translation transformation, rotation transformation, scale transformation, vertical offset transformation, and horizontal offset transformation. The formula of the affine transformation is as follows: , Among them, (x, y) is the sub-image M2...M of the plate line welding area n The coordinates of the boundary pixel points of (v, w) are the coordinates of the boundary pixel points of the plate line welding area sub-image M1, and a1, b1, c1, a2, b2, and c2 are variable constants; The sub-images M1, M2, ... n Perform image stitching according to the arrangement order to obtain the plate line welding area image; The process of determining whether the plate wire welding sequence is incorrect based on the plate wire color recognition results is as follows: Use the classifier algorithm model to train the plate line color model; Input the plate line welding area image into the trained classifier algorithm model, and perform plate line color recognition on the plate line welding area image through the classifier algorithm model; The plate and wire color recognition results are matched with the color sequence template. If the match is successful, the plate and wire welding sequence is correct. Otherwise, the plate and wire welding sequence is wrong.

2. The PCB line sequence detection method based on image recognition according to claim 1, characterized in that: After obtaining the PCB substrate inspection image, it is necessary to perform image conversion on the PCB substrate inspection image, converting the PCB substrate inspection image from an RGB image to an HSV image.

3. The PCB line sequence detection method based on image recognition according to claim 1, characterized in that: The process of threshold segmentation of PCB substrate inspection images is as follows: Determine a segmentation threshold T and compare the grayscale value of the pixel point of the PCB substrate inspection image with the segmentation threshold T; The pixels whose grayscale value is greater than or equal to the segmentation threshold T are marked as 1, and the pixels whose grayscale value is less than the segmentation threshold T are marked as 0; Perform image extraction on the pixels marked as 1 to obtain the PCB carrier area image.

4. The PCB line sequence detection method based on image recognition according to claim 3, characterized in that: The formula for threshold segmentation of PCB substrate inspection image is as follows: , where (i, j) is the coordinate of the pixel point of the PCB substrate detection image, g(i, j) is the gray value marking result of the pixel point of the PCB substrate detection image, and f(i, j) is the gray value of the pixel point of the PCB substrate detection image.

5. The PCB line sequence detection method based on image recognition according to claim 1, characterized in that: The process of template matching for PCB substrate inspection images is as follows: Determine the matching template M and the matching threshold T1, and perform similarity matching between the PCB substrate inspection image and the matching template M; The area with similarity greater than the matching threshold T1 is selected as the PCB substrate area image.

6. A PCB line sequence detection system based on image recognition, characterized in that: The system comprises: A PCB carrier board detection image acquisition unit, wherein the PCB carrier board detection image acquisition unit acquires a PCB carrier board detection image; a PCB carrier area image acquisition unit, which performs threshold segmentation or template matching processing on the PCB carrier detection image to obtain a PCB carrier area image; a board line welding area image acquisition unit, which performs image marking and affine transformation processing based on the PCB carrier area image to obtain a board line welding area image, wherein the board line welding area image is an area image of the root end of the PCB carrier area image; a plate line welding sequence determination unit, which performs plate line color recognition on the plate line welding area image and determines whether the plate line welding sequence is incorrect based on the plate line color recognition result; The plate line welding area image acquisition unit specifically includes: The PCB carrier area image is segmented to obtain several PCB carrier area sub-images P1, P2, ..., P n ; Perform image recognition on the PCB carrier area image P1 to obtain a border line and two vias of the PCB carrier area image P1; A positioning line is obtained by taking the centers of the two via holes as reference points, and an upper border line and a lower border line parallel to the positioning line are selected based on the positioning line; Compare the distances between the upper and lower frame lines and the positioning line respectively, select the frame line with the smaller distance, and set a target frame with this frame line as the reference line. The image within this target frame is the plate line welding area sub-image M1, thereby obtaining the plate line welding area sub-image M1; Perform affine transformation on the plate line welding area sub-image M1 to obtain the plate line welding area sub-image M2...M n The affine transformation includes translation transformation, rotation transformation, scale transformation, vertical offset transformation, and horizontal offset transformation. The formula of the affine transformation is as follows: , Among them, (x, y) is the sub-image M2...M of the plate line welding area n The coordinates of the boundary pixel points of (v, w) are the coordinates of the boundary pixel points of the plate line welding area sub-image M1, and a1, b1, c1, a2, b2, and c2 are variable constants; The sub-images M1, M2, ... n Perform image stitching according to the arrangement order to obtain the plate line welding area image; The plate line welding sequence determination unit specifically includes: Use the classifier algorithm model to train the plate line color model; Input the plate line welding area image into the trained classifier algorithm model, and perform plate line color recognition on the plate line welding area image through the classifier algorithm model; The plate and wire color recognition results are matched with the color sequence template. If the match is successful, the plate and wire welding sequence is correct. Otherwise, the plate and wire welding sequence is wrong.

7. A PCB line sequence detection mechanism based on image recognition, used to implement a PCB line sequence detection method based on image recognition as claimed in any one of claims 1 to 5, characterized in that: The mechanism includes a detection rack, a conveyor belt arranged on the detection rack, an image collector and an industrial computer; The conveyor belt is used to transmit the PCB carrier board, and the image collector is used to collect the PCB carrier board detection image; the industrial computer is used to perform PCB line sequence detection on the PCB carrier board detection image to determine whether the board line welding sequence is wrong.

8. The PCB line sequence detection mechanism based on image recognition according to claim 7, characterized in that: The mechanism also includes a photoelectric sensor and an audible and visual alarm arranged on the detection frame; the photoelectric sensor is used to detect the position of the PCB carrier on the conveyor belt. When the PCB carrier is transmitted to a preset position, the photoelectric sensor outputs a signal to the industrial computer, which controls the image collector to collect the PCB carrier detection image; the audible and visual alarm is used to issue an audible and visual alarm based on the PCB line sequence detection result output by the industrial computer.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the PCB line sequence detection method based on image recognition as described in any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the PCB line sequence detection method based on image recognition according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Automatic wire laser soldering machine

    CN110860752A

  • Wiring harness sequence detection method based on background difference

    CN114332063A