Method and system for identifying mixed batches of PCBs, electronic equipment and medium
By assigning through-hole identification at different locations to the PCB and combining image processing technology, efficient identification of PCB batch detection is achieved, solving the problems of low efficiency and high dependence in the prior art, improving the recognition accuracy and reducing costs.
Patent Information
- Application Number
- CN202510135909.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-07
- Publication Date
- 2025-03-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is inefficient in PCB batch detection, and cannot meet the needs of PCB batch identification with the same size. It relies on ID code and material number, has high light source dependence, and has high recognition accuracy and cost.
By assigning detection marks to each batch of PCBs, the positions of through holes on the board are different, and batch identification of batches of PCBs to be tested is performed using technologies such as image acquisition, graying, binarization, image registration and differential computing.
It realizes high efficiency of PCB batch detection, meets the needs of PCB batch recognition in the same size, reduces dependence on light sources, improves recognition accuracy and reduces identification costs.
Smart Images

Figure CN119579595A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PCB batch management, and in particular to a method, system, electronic equipment and medium for identifying mixed batches of PCBs. Background Art
[0002] Printed circuit board (PCB for short) is an important electronic component, which is the support of electronic components and the carrier of electrical connection of electronic components. Because it is made by electronic printing, it is also called printed circuit board. After electronic equipment adopts PCB, due to the consistency of the same type of printed boards, manual wiring errors are avoided, and automatic insertion or placement of electronic components, automatic soldering, and automatic detection can be realized, which ensures the quality of electronic equipment, reduces costs and facilitates maintenance.
[0003] At present, in the process of PCB board production, there are often cases where PCB boards have the same size or are not much different in size. If these PCB boards appear in the same production process after molding, it is easy for similar PCB boards to be confused with each other, which will lead to production errors in subsequent processes and cause PCB board quality problems. In serious cases, it may lead to mixed boards in packaging, which will bring unnecessary losses and great rework and maintenance difficulties to manufacturers. To prevent mixed boards, traditional methods usually use special marks or text on the PCB board surface or grooves on the edge of the PCB board to distinguish different PCB boards to prevent mixed boards, but these methods all rely on manual visual inspection, which has high labor costs and is prone to omissions, and the mixed board rate is still high.
[0004] With the advancement of science and technology, PCB mixed board detection has developed from traditional manual visual inspection to modern automated and intelligent detection. However, existing automated and intelligent detection technologies often face problems such as low detection efficiency. For example, the Chinese invention patent with publication number CN109587952A provides a method and system for preventing mixed boards in the PCB production process, and specifically discloses the allocation of material numbers for PCBs of the same specification, and the allocation of similar material numbers for similar PCBs, and replaces manual visual inspection by detecting material numbers to prevent material numbers of similar sizes from appearing in the same process; for another example, the Chinese invention patent with publication number CN107135618A provides a control method and system for preventing mixed batches in the PCB production process, and specifically discloses the allocation of a unique ID code for each core board, and the prevention of mixed batches is achieved by detecting the ID code.
[0005] Although the above-mentioned prior art has achieved the automation and intelligent transformation of batch identification, it still has certain limitations, such as the following: (1) The prior art can only detect PCBs one by one, with low detection efficiency, and cannot meet the needs of PCB batch detection; (2) The prior art can only recognize PCBs of different sizes, and cannot meet the needs of batch identification of PCBs of the same size; (3) The prior art needs to assign a unique ID code to each PCB, and the ID code may be difficult to recognize due to ambiguity when scanning. Therefore, the prior art has a high degree of dependence on hardware equipment such as light sources, and cannot guarantee recognition accuracy and increases recognition costs.
[0006] Based on this, how to achieve efficient batch testing of different batches of PCBs is a technical problem that needs to be solved urgently. Summary of the invention
[0007] The purpose of the present invention is to provide a method, system, electronic device and medium for identifying mixed batches of PCBs, so as to solve the technical problem of how to achieve efficient batch detection of different batches of PCBs.
[0008] The present invention is implemented by the following technical solution: A method for identifying mixed batches of PCBs, comprising the following steps: Assign a detection mark to each batch of PCBs in advance, wherein the detection mark is a through hole on the board, and different batches of PCBs have different through hole loading positions; Obtaining a panoramic image of the batch of PCBs to be tested, and performing grayscale and binarization processing on the panoramic image in sequence to obtain a binarized image of the batch of PCBs to be tested; Performing a differential operation on any set of binary image pairs in the binary images of the batch of PCBs to be tested to obtain a differential image of any set of binary image pairs, and before performing the differential operation, performing image registration on any set of binary image pairs; The PCBs to be tested corresponding to the all-zero difference images obtained by each group of binary image pairs are divided into the same batch and feature identifiers are marked on the corresponding binary images, similarity analysis values are obtained by performing similarity analysis on the non-zero difference images obtained by each group of binary image pairs, and batch identification is performed based on the similarity analysis values and the feature identifiers corresponding to the binary images; The batch identification result of the batch of PCBs to be tested is outputted.
[0009] According to a preferred embodiment, the different batches of PCBs also have different through-hole loading sizes.
[0010] According to a preferred embodiment, the through-hole loading method is: controlling a drilling machine or a laser to load through-holes corresponding to the batch on each PCB.
[0011] According to a preferred embodiment, the through holes of each PCB are loaded in a fixed area of the board edge.
[0012] According to a preferred embodiment, a differential operation is performed on any pair of binary images in the binary images of the batch of PCBs to be tested, specifically: a differential operation of a fixed area is performed on any pair of binary images in the binary images of the batch of PCBs to be tested; Performing image registration on any one of the sets of binary image pairs specifically includes: performing image registration on a fixed area of any one of the sets of binary image pairs.
[0013] According to a preferred embodiment, the panoramic image is binarized using the Otsu algorithm.
[0014] According to a preferred embodiment, the specific process of performing image registration is as follows: Calculate the contour centroid A1 of the detection area in the binary image P1 and the contour centroid A2 of the detection area in the binary image P2, and determine the horizontal offset of the contour centroid A1 and the contour centroid A2 and the vertical offset y; For the binary image P1, the new edge point set after the original edge point set of the detection area is homogenized is calculated for N rotation angles in turn, and the Hausdorff distance between the new edge point set of the detection area of the binary image P1 and the edge point set of the detection area of the binary image P2 is calculated, until the Hausdorff distance calculation of N rotation angles is completed, where N is a positive integer greater than or equal to 2; Determine the minimum value among the N Hausdorff distances, and when the minimum value meets the registration distance threshold condition, calculate the offset value according to the offset value. , offset The rotation angles corresponding to y and the minimum value form the registration matrix; An affine transformation of the detection area of the binary image P2 is performed based on the registration matrix to execute image registration.
[0015] The present invention also provides a system for identifying mixed batches of PCBs, which is applied to the method described above, and the system comprises: A pre-processing module is used to pre-assign a detection mark to each batch of PCBs, wherein the detection mark is a through hole on the board, and different batches of PCBs have different through hole positions; An image acquisition and preprocessing module is used to acquire a panoramic image of the batch of PCBs to be tested, and sequentially perform grayscale and binarization processing on the panoramic image to obtain a binarized image of the batch of PCBs to be tested; An image processing module, used for performing a differential operation on any set of binary image pairs in the binary images of the batch of PCBs to be tested to obtain a differential image of any set of binary image pairs, and before performing the differential operation, also includes performing image registration on any set of binary image pairs; A batch identification module is used to classify the PCBs to be tested corresponding to the all-zero difference images obtained by each group of binary image pairs into the same batch and mark the corresponding binary images with feature identifiers, perform similarity analysis on the non-zero difference images obtained by each group of binary image pairs to obtain similarity analysis values, and perform batch identification based on the similarity analysis values and the feature identifiers corresponding to the binary images; The output module is used to output the batch identification results of the batch of PCBs to be tested.
[0016] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described above when executing the computer program.
[0017] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described above is implemented.
[0018] The technical solution of a method, system, electronic device and medium for identifying mixed batches of PCBs provided by the present invention has at least the following advantages and beneficial effects: (1) by performing batch detection on the PCBs to be tested, higher detection efficiency is achieved; (2) by assigning detection identification marks to each batch of PCBs, PCBs of different batches have different through-hole loading positions, which can meet the batch identification requirements of PCBs of the same size; (3) by identifying the through-holes loaded on the edge of the board, compared with identifications such as ID codes and material numbers, the dependence on light sources is lower, and the recognition accuracy can be guaranteed in low-light environments, with lower recognition costs; (4) by combining binarization, image configuration and differential operation, the edge information and through-hole morphological distribution of the through-holes on the edge of the board can be accurately obtained. Combined with the method of batch identification based on similarity analysis values and feature identifications corresponding to the binarized images, PCBs of the same batch can be screened out from the batch-processed PCBs, thereby improving the recognition accuracy of PCB batches. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A schematic flow chart of a method for identifying mixed batches of PCBs provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0021] Example 1 The embodiment of the present invention provides a method for identifying mixed batches of PCBs. Figure 1 As shown, Figure 1 The flowchart of the method for identifying mixed batches of PCBs is shown in FIG. 1 . In this embodiment, the method for identifying mixed batches of PCBs provided includes the following steps: Pre-processing step: pre-assign a detection mark to each batch of PCBs, the detection mark is a through hole on the board, and different batches of PCBs have different through-hole loading positions and through-hole loading sizes to support the distinction between multiple batches of PCBs; it should be noted that the through-hole loading method of this embodiment is to control the drilling machine or laser to load the through holes corresponding to its batch on each PCB, and the through holes of each PCB are loaded in a fixed area on the edge of the board to avoid the wiring area and reduce interference with the PCB.
[0022] It should be noted that, in this embodiment, by assigning detection marks to each batch of PCBs, different batches of PCBs have different through-hole loading positions, which can meet the identification requirements of PCB batches of the same size; in addition, by identifying the through-holes loaded on the edge of the board, compared with identifications such as ID codes and material numbers, the dependence on light sources is lower, and the recognition accuracy can be guaranteed in low-light environments, with lower recognition costs.
[0023] Image acquisition step: obtaining a panoramic image of the batch of PCBs to be tested; in a preferred embodiment, the motion control platform performs panoramic image scanning and splicing on a plurality of PCBs to be tested placed on the stage to obtain a spliced panoramic image of the batch of PCBs to be tested in an ultra-field of view; It should be noted that this embodiment has higher detection efficiency by performing batch detection on the PCBs to be tested.
[0024] Image preprocessing step: grayscale and binarization are performed on the panoramic image in sequence to obtain binarized images of the batch of PCBs to be tested. In this embodiment, the panoramic image is grayscaled using one of the average method, the maximum method or the weighted average method, and the grayscale processing method is not specifically limited here; it should be noted that since the grayscale image only retains the brightness information of the PCB to be tested and no longer contains color information, the data flow is greatly reduced, thereby speeding up the subsequent processing speed.
[0025] Furthermore, the grayscale image is binarized. In the present embodiment, the Otsu algorithm is used to perform binarization on the grayscale image. It should be noted that the Otsu algorithm can be roughly divided into the following steps: the first step is to calculate the grayscale probability distribution in the grayscale image. The second step is to calculate the pixel ratio and grayscale mean of the target and the background, and then obtain the two-class spacing and the class average variance. The third step is to calculate the threshold selection function. The fourth step is to obtain the maximum value of the function and take the corresponding grayscale level as the optimal threshold. The fifth step is to segment the grayscale image according to the optimal threshold.
[0026] Image processing step: performing image registration for a fixed area of any group of binary images in the binary images of the batch of PCBs to be tested; in a preferred implementation of this embodiment, the specific process of performing image registration is as follows: Calculate the contour centroid A1 of the detection area in the binary image P1 and the contour centroid A2 of the detection area in the binary image P2, and determine the horizontal offset of the contour centroid A1 and the contour centroid A2 and the vertical offset y; For the binary image P1, the new edge point set after the original edge point set of the detection area is homogenized is calculated for N rotation angles in turn, and the Hausdorff distance between the new edge point set of the detection area of the binary image P1 and the edge point set of the detection area of the binary image P2 is calculated, until the Hausdorff distance calculation of N rotation angles is completed, where N is a positive integer greater than or equal to 2; Determine the minimum value among the N Hausdorff distances, and when the minimum value meets the registration distance threshold condition, calculate the offset value according to the offset value. , offset The rotation angles corresponding to y and the minimum value form the registration matrix; An affine transformation of the detection area of the binary image P2 is performed based on the registration matrix to execute image registration.
[0027] Furthermore, a fixed-region differential operation is performed on any set of binary image pairs after image registration to obtain a fixed-region differential image of any set of binary image pairs.
[0028] Batch identification step: the PCBs to be tested corresponding to the all-zero difference images obtained from each group of binary image pairs are divided into the same batch and feature identification is marked on the corresponding binary images; it should be noted that the all-zero difference image means that the two binary images are exactly the same, that is, the PCBs to be tested corresponding to the two binary images belong to the same batch of PCBs, and the feature identification is marked on the binary image of the PCB so that it can be distinguished from other binary images when the binary image is subsequently involved in the differential operation of other binary images again.
[0029] Further, similarity analysis is performed on the obtained non-zero difference images of each group of binarized images to obtain a similarity analysis value, and batch identification is performed based on the similarity analysis value and the feature identifier corresponding to the binarized image; it should be noted that the non-zero difference image indicates that there is a difference between the two binarized images. Since there is no other interference item in the fixed area, it also indicates that the PCBs to be tested corresponding to the two binarized images belong to different batches. For multiple non-zero difference images, in order to further improve the detection efficiency, this embodiment adopts a similarity analysis method to perform similarity analysis on multiple non-zero difference images; wherein, potential PCBs of the same batch in multiple non-zero difference images will show a certain similarity, and the similarity analysis value will be higher, and there may also be binarized images that have completed batch identification in these non-zero difference images, that is, the above-mentioned binarized images marked with feature identifiers, so the binarized images that have not completed batch identification can be distinguished from them by combining the similarity analysis value and the feature identifier corresponding to the binarized image, and then their batches can be determined.
[0030] It should be noted that this embodiment combines binarization, image configuration and differential operation to accurately obtain edge information and hole morphology distribution of board edge through holes, and combines batch identification based on similarity analysis values and feature identifiers corresponding to the binary image to screen out PCBs of the same batch from batch-processed PCBs, thereby improving the recognition accuracy of PCB batches.
[0031] Output step: Through the above steps, the batch identification results of all the PCBs to be tested in the batch of PCBs to be tested can be obtained, and the batch identification of the PCBs to be tested can be completed. Further, the batch identification results of the batch of PCBs to be tested can be output to batch manage different batches of PCBs.
[0032] Example 2 The embodiment of the present invention provides a system for identifying mixed batches of PCBs based on the technical solution provided in Example 1. The system is applied to the method described in Example 1. The system includes a pre-processing module, an image acquisition and pre-processing module, an image processing module, a batch identification module, and an output module. The pre-processing module is configured to pre-assign a detection mark to each batch of PCBs, wherein the detection mark is a through hole on the board, and different batches of PCBs have different through hole positions; the image acquisition and pre-processing module is configured to acquire a panoramic image of the batch of PCBs to be tested, and sequentially perform grayscale and binarization processing on the panoramic image to obtain a binary image of the batch of PCBs to be tested; the image processing module is configured to perform a differential operation on any group of binary image pairs in the binary images of the batch of PCBs to be tested, and obtain the difference of any group of binary image pairs. The image further comprises performing image registration on any one of the groups of binary image pairs before performing a differential operation; a batch identification module is configured to classify the PCBs to be tested corresponding to the all-zero difference images obtained by each group of binary image pairs into the same batch and mark the corresponding binary images with feature identifiers, perform similarity analysis on the non-zero difference images obtained by each group of binary image pairs to obtain similarity analysis values, and perform batch identification based on the similarity analysis values and the feature identifiers corresponding to the binary images; and an output module is configured to output the batch identification results of the batch of PCBs to be tested.
[0033] Example 3 This embodiment provides an electronic device based on the technical solution provided in Embodiment 1, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in Embodiment 1 when executing the computer program.
[0034] Example 4 Based on the technical solution provided in Example 1, this embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described in Example 1 is implemented.
[0035] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for identifying mixed batches of PCBs, characterized in that: The following steps are involved: Assign a detection mark to each batch of PCBs in advance, wherein the detection mark is a through hole on the board, and different batches of PCBs have different through hole loading positions; Obtaining a panoramic image of the batch of PCBs to be tested, and performing grayscale and binarization processing on the panoramic image in sequence to obtain a binarized image of the batch of PCBs to be tested; Performing a differential operation on any set of binary image pairs in the binary images of the batch of PCBs to be tested to obtain a differential image of any set of binary image pairs, and before performing the differential operation, performing image registration on any set of binary image pairs; The PCBs to be tested corresponding to the all-zero difference images obtained by each group of binary image pairs are divided into the same batch and feature identifiers are marked on the corresponding binary images, similarity analysis values are obtained by performing similarity analysis on the non-zero difference images obtained by each group of binary image pairs, and batch identification is performed based on the similarity analysis values and the feature identifiers corresponding to the binary images; The batch identification result of the batch of PCBs to be tested is outputted.
2. The method for identifying mixed batches of PCBs as claimed in claim 1, characterized in that: The different batches of PCBs also have different through-hole loading sizes.
3. The method for identifying mixed batches of PCBs as claimed in claim 2, characterized in that: The through-hole loading method is: loading the through-holes corresponding to the batch on each PCB by controlling a drilling machine or a laser.
4. The method for identifying mixed batches of PCBs as claimed in claim 3, characterized in that: The through holes of each PCB are loaded into a fixed area on the edge of the board.
5. The method for identifying mixed batches of PCBs as claimed in claim 4, characterized in that: Performing a differential operation on any pair of binary images in the binary images of the batch of PCBs to be tested, specifically: performing a differential operation of a fixed area on any pair of binary images in the binary images of the batch of PCBs to be tested; Performing image registration on any one of the sets of binary image pairs specifically includes: performing image registration on a fixed area of any one of the sets of binary image pairs.
6. The method for identifying mixed batches of PCBs according to any one of claims 1 to 5, characterized in that: The panoramic image is binarized using the Otsu algorithm.
7. The method for identifying mixed batches of PCBs as claimed in claim 6, characterized in that: The specific process of performing image registration is as follows: Calculate the contour centroid A1 of the detection area in the binary image P1 and the contour centroid A2 of the detection area in the binary image P2, and determine the horizontal offset of the contour centroid A1 and the contour centroid A2 and the vertical offset y; For the binary image P1, the new edge point set after the original edge point set of the detection area is homogenized is calculated for N rotation angles in turn, and the Hausdorff distance between the new edge point set of the detection area of the binary image P1 and the edge point set of the detection area of the binary image P2 is calculated, until the Hausdorff distance calculation of N rotation angles is completed, where N is a positive integer greater than or equal to 2; Determine the minimum value among the N Hausdorff distances, and when the minimum value meets the registration distance threshold condition, calculate the offset value according to the offset value. , offset The rotation angles corresponding to y and the minimum value form the registration matrix; An affine transformation of the detection area of the binary image P2 is performed based on the registration matrix to execute image registration.
8. A system for identifying mixed batches of PCBs, characterized in that: Applied to the method according to any one of claims 1 to 7, the system comprises: A pre-processing module is used to pre-assign a detection mark to each batch of PCBs, wherein the detection mark is a through hole on the board, and different batches of PCBs have different through hole positions; An image acquisition and preprocessing module is used to acquire a panoramic image of the batch of PCBs to be tested, and sequentially perform grayscale and binarization processing on the panoramic image to obtain a binarized image of the batch of PCBs to be tested; An image processing module, used for performing a differential operation on any set of binary image pairs in the binary images of the batch of PCBs to be tested to obtain a differential image of any set of binary image pairs, and before performing the differential operation, also includes performing image registration on any set of binary image pairs; A batch identification module is used to classify the PCBs to be tested corresponding to the all-zero difference images obtained by each group of binary image pairs into the same batch and mark the corresponding binary images with feature identifiers, perform similarity analysis on the non-zero difference images obtained by each group of binary image pairs to obtain similarity analysis values, and perform batch identification based on the similarity analysis values and the feature identifiers corresponding to the binary images; The output module is used to output the batch identification results of the batch of PCBs to be tested.
9. An electronic 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 method according to any one of claims 1 to 7 is 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 method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and system for avoiding board mixing in PCB production process
CN109587952A
Batch part automatic detection system and method based on machine vision
CN103499296A
Control method and system against batch mix-up in PCB production process
CN107135618A
Two-dimensional code application method and device of PCB and storage medium
CN109583526A