A High-Precision Registration Method for Complex PCBs

By generating template images and performing sub-picture segmentation, feature point matching and similarity checks, the problems of high matching error rate and low real-time performance in complex PCB panel environments are solved, and high-precision PCB image registration is achieved.

CN117173225BActive Publication Date: 2025-07-22ZHEJIANG NORMAL UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311239069.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2025-07-22
Estimated Expiration
2043-09-22

AI Technical Summary

Technical Problem

The existing PCB image registration methods have problems with high matching error rate and low real-time performance in complex panel environments, especially when the number of pads is uncertain, the area is large, and multiple array units exist, it is difficult for existing algorithms to achieve high-precision registration.

Method used

By generating template images, identifying the array data of the array unit and performing sub-graph segmentation, using feature point matching and similarity checks, combining grayscale threshold binarization and bit operation, the matching point set is optimized using the RANSAC algorithm, and calculating the homography matrix for projection transformation, achieving high-precision registration.

Benefits of technology

It realizes the rapid identification of array units on the panel PCB, improves image recognition accuracy and real-time performance, and adapts to the high-precision registration requirements of complex PCBs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117173225B_ABST
    Figure CN117173225B_ABST
Patent Text Reader

Abstract

The present invention relates to the fields of PCB processing and image recognition, and particularly relates to a high-precision registration method for complex PCBs. The method includes the following steps: Step a. Generate a template image through the processing file of the PCB; and collect the image to be matched; Step b. Identify the array data of the array units in the template image, where the array data includes the number of arrays and the coordinates of each array unit; Step c. Perform sub-image segmentation on the image to be matched according to the array data obtained in Step b to obtain sub-images with the same number as the number of arrays; Step d. Perform feature point matching between the array units and all the sub-images to obtain the coordinate information for registering the sub-images by the array units on the sub-images; Step e. Projectively transform the registered sub-images onto the template image to establish the corresponding relationship between the template image and the matching image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of PCB processing and image recognition, and particularly to a high-precision registration method for complex PCBs. Background Art

[0002] In recent years, computer vision has developed rapidly, and there are already many image registration methods based on computer vision. Among them, the NCC (normalized cross correlation) method, SIFT (Scale-invariant feature transform) method, and SURF (Speeded Up Robust Features) method have good applications in the registration and defect detection of bare PCB boards. However, at the same time, these methods also have some problems. First, their real-time performance will decrease as the number of PCB surface features (points) increases in actual production. Second, these algorithms are all based on similar features for calculation. When encountering PCBs using the panel splicing process, feature overlap is likely to occur, resulting in incorrect calculation of the projection matrix and thus registration failure.

[0003] In the prior art, there are also patent documents with publication numbers CN 106373161 B and CN 114897946 A. Both of them use feature points to extract camera image features and template features, then calculate the matching point pairs between the camera image and the template image, obtain inliers through an outlier rejection algorithm, and finally use the inliers to calculate the homography matrix and the projection matrix, so as to obtain the registered image through projective transformation.

[0004] These two technologies are both applicable to PCBs with relatively simple situations (few solder pads, small area, single-board independent). The above methods can obtain relatively high-precision matching and good real-time performance. However, in the real industrial production environment (uncertain number of solder pads, large area, panel splicing), especially when there is panel splicing processing, there will be multiple array units on the entire PCB, and the elements of each array unit are the same. In the above methods, there is a high probability of matching errors and low real-time performance. Summary of the Invention

[0005] Aiming at the above-mentioned deficiencies or defects in the prior art, the present invention provides a high-precision registration method for complex PCBs. This method for image recognition and registration of panel-spliced PCBs can quickly identify the array units with the same features in the panel-spliced PCBs, confirm the number and position of the array units in the PCBs, and improve the image recognition accuracy of such panel-spliced PCBs.

[0006] In order to achieve the purpose of quickly performing image recognition on panel-spliced PCBs, the present invention provides a high-precision registration method for complex PCBs, including the following steps

[0007] Step a. Generate a template image from the PCB processing file; and collect the image to be matched;

[0008] Step b. Identify the array data of the array units in the template image, where the array data includes the number of arrays and the coordinates of each array unit;

[0009] Step c. Sub - image cut the image to be matched according to the array data obtained in step b to obtain sub - images with the same number as the number of arrays;

[0010] Step d. Perform feature - point matching between the array units and all the sub - images to obtain the coordinate information of the registered sub - images of the array units on the sub - images;

[0011] Step e. Projectively transform the registered sub - images onto the template image to establish the correspondence between the template image and the matching image.

[0012] Preferably, after step d and before step e, perform a similarity check of the entire image for the registered sub - images and the array units;

[0013] Perform gray - scale threshold binarization processing on the registered sub - images and the array units respectively, then perform bit operation xor on the processed registered sub - images and array units, and then summarize the output results of the xor operation to obtain the similarity between the registered sub - images and the array units.

[0014] Preferably, in step a, collecting the image to be matched includes the following steps:

[0015] First, use a camera to take a raw image of the PCB board, and then use a foreground extraction algorithm to determine and extract the PCB area in the raw image to obtain the image to be matched.

[0016] The foreground extraction algorithm includes the following steps:

[0017] S1. Convert the collected raw image into a grayscale image;

[0018] S2. Perform binarization processing on the grayscale image to obtain a binary image with pixel values of 0 or 1;

[0019] S3. Denoise the binary image to obtain a denoised image. First, perform an opening operation to remove background noise, and then perform a closing operation to remove foreground noise;

[0020] S4. Perform contour extraction and extract the largest contour from the contours;

[0021] S5. Calculate the perimeter of the largest contour and use its perimeter as an approximate precision parameter to calculate the contour - approximated polygon, using the Douglas - Peucker algorithm to obtain the four vertices of its fitted quadrilateral;

[0022] S6. Taking two right-angled vertices that are farther from the image edge among the four vertices as the centers, and taking two-thirds of the length of the right-angled side as the radius to make intersecting circles, and extracting the internal intersection points;

[0023] S7. Extracting the corresponding right-angled sides of the PCB template image, taking the right-angled vertices to make intersecting circles, and extracting the internal intersection points;

[0024] S8. Calculating the affine matrix for the right-angled vertices and the internal intersection points of the intersecting circles on the original image and the template image,

[0025] S9. Performing an affine transformation on the denoised image to obtain the image to be matched from the original image.

[0026] Preferably, in step b, an array image detection algorithm is used to identify the array data of the array units in the template image, and the array image detection algorithm includes the following steps:

[0027] T1. Cutting several slices in the X and Y directions of the template image respectively;

[0028] T2. Using each slice as a template to perform template matching on the whole image;

[0029] T3. Performing non-maximum suppression (NMS) on the matching results and counting the number of entries in the X direction and the Y direction;

[0030] T4. Counting the number of entries of each slice and calculating the mode;

[0031] T5. Using the mode as the number of arrays in its direction and outputting the array matrix;

[0032] T6. In each direction, taking the list corresponding to the slice with the matching mode as a sample, and calculating the difference between the distances of two elements in the list matched by each slice in this direction;

[0033] T7. In each direction, counting the mode of all distance differences to obtain the corresponding exact difference in its direction;

[0034] T8. Integrating the differences in the X and Y directions to obtain the length and width of the array unit;

[0035] T9. Sliding the array template image with the index coordinate (0, 0) in the X direction, and at the same time sliding the image with the index coordinate (n, m), comparing the two, and recording the similarity to the list;

[0036] T10. Sliding the array template image with the index coordinate (0, 0) in the Y direction, and at the same time sliding the image with the index coordinate (n, m), comparing the two, and recording the similarity to the list;

[0037] T11. Calculating the maximum value in the list in the X direction to obtain the starting point in the X direction;

[0038] T12: Calculate the maximum value in the list in the Y direction to obtain the starting point in the Y direction;

[0039] T13: Integrate the starting points in the X and Y directions, the number of arrays, and the size of each column unit to obtain the output array information.

[0040] Preferably, when performing feature matching in step d, each sub-image is processed independently and accelerated using multi-threading in parallel.

[0041] Preferably, in step d, the feature point extraction algorithms include SIFT, SURF, and ORB;

[0042] Use the Fast Library for Approximate Nearest Neighbors (FLANN) search algorithm to match the detected feature points in two sub-images, which mainly includes importing feature descriptors, establishing a tree structure index, searching in the tree space, calculating the matching scores of the nearest descriptors, and generating the final matching results.

[0043] Preferably, in step d, the RANSAC algorithm is used to optimize the set of matching points, removing the "outliers" and retaining the "inliers". The main steps are as follows:

[0044] Select the smallest data set that can estimate the model; use this data set to calculate the data model;

[0045] Bring all the data into this model, calculate the number of "inliers"; compare the number of "inliers" of the current model and the best model derived previously, record the model parameters and the number of "inliers" with the largest number of "inliers"; repeat the above steps until the iteration ends.

[0046] Preferably, step e includes: calculating the projected vertex matrix through the homography matrix and the matrix of the four corner vertices of the sub-graph in the original image area, and then performing projective transformation on each sub-graph using the projection matrix of each sub-graph.

[0047] Preferably, after step e, there is also step f,

[0048] Step f. Stitch all the sub-graphs after the projective transformation to form a large graph with high-precision matching.

[0049] Through the above technical solution of the present invention, a high-precision registration method for complex PCBs can adapt to the situation of panelized PCBs with a large number of repeated elements, and has the advantages of fast recognition speed, high precision, and automatic operation of the program.

[0050] Specifically, first directly generate a high-precision template image from the PCB processing file, and then identify the repeated array units, the horizontal and vertical array numbers of the array units, and the coordinates of each array unit in the template image during panel production.

[0051] According to the result of array recognition, the to-be-matched image directly captured from the PCB is cut, and then each cut sub-image is separately feature-matched with the array unit to determine the corresponding position of the array unit on the sub-image, that is, the registered sub-image. Meanwhile, the coordinate information of the registered sub-image is obtained, and then projection transformation is performed based on the position of the registered image and the template image. Thus, a corresponding relationship is established between the PCB processing file and the template file, and then a corresponding relationship is established between the template file and the to-be-matched image.

[0052] Other features and advantages of the present invention will be described in detail in the following specific implementation part. Brief Description of the Drawings

[0053] Figure 1 is a flowchart of an embodiment of the present invention. Specific Embodiments

[0054] The following will describe the specific embodiments of the present invention in detail. It should be understood that the specific embodiments described herein are only for explaining and illustrating the present invention, and are not used to limit the present invention.

[0055] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances for the embodiments of the present invention described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0056] To solve the problems of traditional PCB processing pointed out in the background art section. The present invention provides a high-precision registration method for complex PCBs, including the following steps.

[0057] Step a. Generate a template image through the PCB processing file; and collect the to-be-matched image;

[0058] Step b. Identify the array data of the array units in the template image, where the array data includes the number of arrays and the coordinates of each array unit;

[0059] Step c. Perform sub-image segmentation on the to-be-matched image according to the array data obtained in step b to obtain sub-images with the same number as the number of arrays;

[0060] Step d. Perform feature point matching between the array units and all the sub-images to obtain the coordinate information of the registered sub-images of the array units on the sub-images;

[0061] Step e. Projectively transform the registered sub-image onto the template image to establish the correspondence between the template image and the matching image.

[0062] In step a, generating the template image includes the following process: reading the processing file of the PCB and automatically converting it into a simulation template image. Specifically, read the GERBER file, automatically draw it on a high-resolution virtual canvas using a program, and output it in picture format.

[0063] In step a, acquiring the image to be matched includes the following steps: First, use a camera to take an original image of the PCB board. The original image will include the PCB part, as well as the processing platform and fixtures, etc. Therefore, it is necessary to use a foreground extraction algorithm to determine the PCB area in the original image and extract it to obtain the image to be matched.

[0064] The foreground extraction algorithm includes the following steps:

[0065] S1. The original image directly captured by the industrial camera is named PCB-IMG and is a color image containing color information. Here, the acquired original image is converted into a grayscale image, including performing a color space conversion on PCB-IMG from the RGB color space to the GRAY color space. The formula is: Gray = R * 0.299 + G * 0.587 + B * 0.114. Obtain PCB-IMG-GRAY.

[0066] S2. Binarize the grayscale image to obtain a binary image with pixel values of 0 or 1. Use an image threshold to binarize PCB-IMG-GRAY, setting the part greater than the threshold to 255 and the part less than the threshold to 0, obtaining PCB-IMG-GRAY-BINARY. In this way, the grayscale image is converted into a binary image, that is, an image with only 0 and 1 in the image.

[0067] S3. Denoise the binary image to obtain a denoised image. First, perform an opening operation to remove background noise, and then perform a closing operation to remove foreground noise. The unprocessed image has noise (black background with white dots or white background with black dots). This step is to remove these noises. The method is as follows:

[0068] Denoise using morphological operations. First, perform an opening operation to remove background noise, and then perform a closing operation to remove foreground noise to obtain PCB-IMG-GRAY-BINARY-FLITED. The opening operation is to erode first and then dilate, and the closing operation is to dilate first and then erode. Dilation is to broaden the image to a certain extent, that is, A⊕B, described as the dilation of set B to set A. The formula is:

[0069]

[0070] Erosion is to reduce the image to a certain extent. That is, AΘB is described as the erosion of set A by set B, and the formula is:

[0071]

[0072] S4. Perform contour extraction and extract the largest contour from the contours; that is, perform contour extraction on PCB-IMG-GRAY-BINARY-LITED and extract the largest contour MAX_CNT from the contours. The largest contour extracted here is the contour of the PCB board, and this contour contains a closed point set that can enclose the target.

[0073] S5. Calculate the perimeter of the largest contour and use its perimeter as the approximate accuracy parameter to calculate the approximate polygon of the contour. Use the Douglas-Peucker algorithm to obtain the four vertices of the fitted quadrilateral; specifically, calculate the perimeter of MAX_CNT and use its perimeter as the approximate accuracy parameter to calculate the approximate polygon of the contour. Use the Douglas-Peucker algorithm to obtain the four vertices of the fitted quadrilateral. The purpose is to calculate the vertices of the contour image of the PCB from the point set for subsequent transformation.

[0074] S6. Take the two right-angled vertices that are farther from the image edge among the four vertices as the centers, and use two-thirds of the length of the right-angled side as the radius to make intersecting circles, and extract the internal intersection points;

[0075] Specifically, when operating, take the two right-angled vertices that are farther from the image edge among the four vertices as the centers, and use two-thirds of the length of the right-angled side as the radius to make intersecting circles, and extract the internal intersection points S7 Note: Because affine transformation requires at least a dot matrix composed of 3 points and the corresponding mapping dot matrix, so only two points on the edge are not enough.

[0076] The purpose of making the circles is to extract the third point. No matter what transformation the graph undergoes, the relative relationship of this point to the edge remains unchanged.

[0077] S7: Extract the corresponding right-angled sides of the PCB template image, make intersecting circles with the right-angled vertices, and extract the internal intersection points; the operation method and purpose here are the same as those in step S6.

[0078] S8: Calculate the affine matrix for the right-angled vertices on the original image and the template image and the internal intersection points of the intersecting circles. The calculation method is as follows

[0079]

[0080] Among them

[0081]

[0082] S9: Perform an affine transformation on the denoised image to obtain the image to be matched from the original image. That is, perform an affine transformation on PCB-IMG-GRAY-BINARY-FLITED to obtain the roughly registered image to be matched from the original image.

[0083] Array image detection algorithm

[0084] In step b, first obtain the template image from the PCB processing file, and then use the array image detection algorithm to identify the array data of the array units in the template image. The array image detection algorithm includes the following steps:

[0085] T1. Cut several slices from the template image in the X and Y directions respectively; Extract slices from the X side and Y side of the template image. The number of slices is adjustable, and the width of each slice is also adjustable. The number of slices is 3 - 9, and the width of each slice is 20 - 100 pixels. The slices run through the entire template image in the length direction. Preferably, multiple slices in the same direction are adjacent.

[0086] Before performing T1, it is necessary to remove the edges of the template image, that is, remove the parts of the actual PCB where there are no components and wiring at the edges. Since this part does not contain any image features, it is not suitable for use as image comparison material. The specific method can be to start slicing not from the edge, but leaving several pixels such as 10 - 50 pixels empty at the edge and then taking the first slice.

[0087] The X direction and Y direction here are two mutually perpendicular directions, or can be understood as the direction pointed by the length of the image and the direction pointed by the width of the image.

[0088] T2. Use each slice as a template to perform template matching on the whole image;

[0089] Use each slice as a template respectively to perform template matching within the whole image range. The output result of the matching is a matrix with the shape of n*4*2, where n represents the number of matched images, 4 represents the four vertex boxes of the image to be matched, and 2 represents the X and Y coordinate values. Use standard correlation matching, and the formula is:

[0090]

[0091] Specifically, there are six methods for gray - level histogram matching, namely: "cv.TM_CCOEFF, cv.TM_CCOEFF_NORMED, cv.TM_CCORR, cv.TM_CCORR_NORMED, cv.TM_SQDIFF, cv.TM_SQDIFF_NORMED". When matching, the input is two pictures (template and the large image to be matched), and the output is n objects that meet the set matching threshold.

[0092] This step is to find out how many places the slice template appears in the whole image, so as to obtain how many regions in the image are exactly the same length as the slice.

[0093] T3. Perform non-maximum suppression (NMS) on the matching results and count the number of entries in the X and Y directions; in T2, it is known how many places the template appears in the whole image, but the n regions that are matched may overlap, so NMS is performed, that is, in a region, only the matched item with the largest matching score is retained to obtain the accurate number of the slice template in the whole image.

[0094] T4. Count the number of entries for each slice and calculate the mode; the execution objects of steps T2 - T3 are individual slices. In step T1, the number of slices is plural. Therefore, the operations in T3 - T4 are performed once on each slice, forming a sample set with the number of slices. However, it is not certain that the array quantity is accurately recorded in each sample set. Therefore, the mode statistics are performed on this sample set to eliminate this uncertainty, that is, a more accurate true array quantity in this direction on the whole image can be obtained.

[0095] T5. Use the mode as the number of arrays in its direction and output the array matrix; the array matrix in this step only has the quantity information of the arrays and no coordinate information. Since there will be edges for mechanical clamping when the PCB board is generated, the edges will be removed first in step T1 before cutting and extracting the slices. Therefore, the starting point of its array is not necessarily at the position of (0, 0).

[0096] T6. In each direction, that is, the X direction and the Y direction, using the list corresponding to the slice that matches the mode as a sample, calculate the difference in the distances of two elements in the list matched by each slice in this direction; the distance difference between adjacent matching samples is the width of the array unit in this direction.

[0097] T7. In each direction, count the mode of all distance differences to obtain the corresponding accurate difference in this direction; similar to the previous text, since multiple slices are taken, the calculation of the width for a single slice may have deviations. Therefore, the mode is taken to eliminate the error.

[0098] T8: Integrate the differences in the X and Y directions to obtain the length and width of the array unit.

[0099] T9: Slide the array template image with the index at the coordinate (0, 0) in the X direction, and at the same time slide the image with the index at the coordinate (n, m), compare the two, and record the similarity to the list;

[0100] T10: Slide the array template image with the index at the coordinate (0, 0) in the Y direction, and at the same time slide the image with the index at the coordinate (n, m), compare the two, and record the similarity to the list;

[0101] T11: Calculate the maximum value in the list in the X direction to obtain the starting point in the X direction;

[0102] T12: Calculate the maximum value in the list in the Y direction to obtain the starting point in the Y direction;

[0103] T13: Integrate the data in T8 - T12, that is, integrate the starting points in the X and Y directions, the number of arrays, and the size of the entire column unit to obtain the output array information. The obtained information includes the image of an array unit, the number of array units in the X and Y directions, and the position of each array unit.

[0104] After step d and before step e, perform a similarity check of the entire image on the registered sub - image and the array unit; perform grayscale threshold binarization on the registered sub - image and the array unit respectively, then perform a bit operation xor on the processed registered sub - image and array unit, and then summarize the output results of the xor operation to obtain the similarity between the registered sub - image and the array unit.

[0105] Specifically, obtain the registered sub - image a and the image b of the array unit, perform grayscale threshold binarization on a and b respectively to obtain a - t and b - t, perform a bit operation xor (exclusive or) on a - t and b - t to obtain the ab - xor image. The white pixels in this image represent the different parts between a - t and b - t. Calculating the area of the white pixels can obtain the difference between the two images after matching.

[0106] When performing feature matching in step d, each sub - image is processed independently and accelerated using multi - threading in parallel. The specific formula is:

[0107]

[0108] L is the image after Gaussian blur, G is the Gaussian kernel function,

[0109]

[0110] I is the original image

[0111]

[0112] D is the DoG image

[0113]

[0114] The feature descriptor is the gray - scale gradient direction of the surrounding pixels:

[0115]

[0116] 1), Divide the obtained angle values into 36 equal parts.

[0117] 2) Calculate the gradient value in the scale space corresponding to the feature points.

[0118] 3) Use a Gaussian kernel to calculate the weights for the gradient.

[0119] That is, the weights of the pixels around a pixel are determined by two values: one is the magnitude of its own gradient, and the second is the distance from the pixel being examined.

[0120] In step d, the feature point extraction algorithm uses SIFT, SURF, or ORB.

[0121] Use the approximate nearest neighbor search algorithm (FLANN) to match the detected feature points in the two subgraphs, which mainly includes importing the feature descriptors, building the tree structure index, searching in the tree space, calculating the matching scores of the nearest neighbor descriptors, and finally generating the matching results.

[0122] Then in step d, use the RANSAC algorithm to optimize the set of matching points, remove the "outliers", and retain the "inliers". The main steps are as follows:

[0123] Select the smallest data set that can estimate the model; use this data set to calculate the data model.

[0124] Bring all the data into this model, calculate the number of "inliers"; compare the number of "inliers" of the current model and the best model derived previously, and record the model parameters and the number of "inliers" with the largest number of "inliers"; repeat the above steps until the iteration ends.

[0125] Then, calculate the homography matrix from the original image region subgraph to the template subgraph coordinates through the inlier point set. This algorithm can find and return the transformation matrix H between the source plane and the target plane.

[0126]

[0127] The calculation method of the back-projection error rate is as follows:

[0128]

[0129] Calculate the projected vertex matrix through the homography matrix and the four corner vertex matrices of the original image region subgraph, and then perform projective transformation on each subgraph using the projection matrix of each subgraph.

[0130] After step e, it also includes step f. Step f: Stitch all the subgraphs after the projective transformation to form a large graph with high-precision matching. The final registered large graph is not necessary. If needed, it can be generated later.

[0131] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various simple modifications can be made to the technical solutions of the present invention, and these simple modifications all fall within the protection scope of the present invention.

[0132] In addition, it should be noted that, in the various specific technical features described in the above specific embodiments, they can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present invention will not separately describe various possible combination methods.

[0133] Furthermore, any combination can be made between various different embodiments of the present invention, as long as it does not violate the idea of the present invention, and it should also be regarded as the content disclosed by the present invention.

Claims

1. A high-precision registration method for complex PCBs, characterized in that including the following steps, Step a. Generate a template image from the PCB processing file; and acquire the image to be matched; Step b. Identify the array data of the array units in the template image, where the array data includes the number of arrays and the coordinates of each array unit; Step c. Sub-image cut the image to be matched according to the array data obtained in step b to obtain sub-images with the same number as the number of arrays; Step d. Perform feature point matching between the array units and all the sub-images to obtain the coordinate information of the registered sub-images of the array units on the sub-images; Step e. Projectively transform the registered sub-images onto the template image to establish the correspondence between the template image and the matching image; In step b, an array image detection algorithm is used to identify the array data of the array units in the template image, and the array image detection algorithm includes the following steps: T1. Cut several slices from the template image in the X and Y directions respectively; T2. Use each slice as a template to perform template matching on the whole image; T3. Perform non-maximum suppression (NMS) on the matching results and count the number of entries in the X direction and the Y direction; T4. Count the number of entries of each slice and calculate the mode; T5. Use the mode as the number of arrays in its direction and output the array matrix; T6. In each direction, take the list corresponding to the slice matching the mode as a sample, and calculate the difference between the distances of two elements in the list of each slice matching in this direction; T7. In each direction, count the mode of all the distance differences to obtain the corresponding exact difference in this direction; T8. Integrate the differences in the X and Y directions to obtain the length and width of the array unit; T9. Slide the array template image with the index coordinate (0, 0) in the X direction, and at the same time slide the image with the index coordinate (n, m), compare the two, and record the similarity to the list; T10. Slide the array template image with the index coordinate (0, 0) in the Y direction, and at the same time slide the image with the index coordinate (n, m), compare the two, and record the similarity to the list; T11. Calculate the maximum value in the list in the X direction to obtain the starting point in the X direction; T12. Calculate the maximum value in the list in the Y direction to obtain the starting point in the Y direction; T13. Integrate the starting points in the X and Y directions, the number of arrays, and the size of the whole column unit to obtain the output array information.

2. The high-precision registration method for complex PCBs according to claim 1, wherein After step d and before step e, perform a similarity check of the whole image on the registered sub-images and the array units; Perform gray threshold binaryzation processing on the registered sub-images and the array units respectively, then perform bit operation xor on the processed registered sub-images and array units, and then summarize the output results of the xor operation to obtain the similarity between the registered sub-images and the array units.

3. A high-precision registration method for complex PCBs according to claim 1, characterized in that In step a, acquiring the image to be matched includes the following steps: First, use a camera to take a picture of the PCB board to obtain the original image, and then use the foreground extraction algorithm to determine the PCB area in the original image and extract it to obtain the image to be matched.

4. A high-precision registration method for complex PCBs according to claim 3, characterized in that The foreground extraction algorithm includes the following steps: S1. Convert the acquired original image into a grayscale image; S2. Perform binaryzation processing on the grayscale image to obtain a binary image with pixel values of 0 or 1; S3. Denoise the binary image to obtain a denoised image. First, perform opening operation to remove background noise, and then perform closing operation to remove foreground noise; S4. Extract the contours and extract the largest contour from the contours; S5. Calculate the perimeter of the largest contour and use its perimeter as the approximate precision parameter to calculate the contour approximated polygon. Adopt the Douglas - Peucker algorithm to obtain the four vertices of the fitted quadrilateral; S6. Take the two right - angled vertices farther from the image edge among the four vertices as the centers, and use two - thirds of the length of the right - angled side as the radius to make intersecting circles, and extract the inner intersection points; S7. Extract the corresponding right - angled sides of the PCB template image, make intersecting circles with the right - angled vertices, and extract the inner intersection points; S8. Calculate the affine matrix from the right - angled vertices and the inner intersection points of the intersecting circles on the original image and the template image; S9. Perform affine transformation on the denoised image to obtain the image to be matched from the original image.

5. A high-precision registration method for complex PCBs according to claim 1, characterized in that When performing feature matching in step d, each sub - image is processed independently and accelerated by using multi - threading in parallel.

6. A high-precision registration method for complex PCBs according to claim 1, characterized in that, In step d, the feature point extraction algorithms adopt SIFT, SURF, ORB; Use the approximate nearest neighbor search algorithm (FLANN) to match the detected feature points in two sub - images, which mainly includes importing feature descriptors, establishing tree - structure indexes, searching in tree space, calculating the matching scores of the nearest descriptors, and finally generating the matching results.

7. A high-precision registration method for complex PCBs according to claim 6, characterized in that, In step d, use the RANSAC algorithm to optimize the set of matching points, remove the "outliers" and retain the "inliers". Its main steps are: Select the smallest data set that can estimate the model; use this data set to calculate the data model; Bring all the data into this model, calculate the number of "inliers"; compare the number of "inliers" of the current model and the best model derived before, record the model parameters and the number of "inliers" of the model with the largest number of "inliers"; repeat the above steps until the iteration ends.

8. A high-precision registration method for complex PCBs according to claim 1, characterized in that, Step e includes: Calculate the projected vertex matrix through the homography matrix and the matrix of the four - corner vertices of the sub - image in the original image region, and then perform projection transformation on each sub - image using the projection matrix of each sub - image.

9. A high-precision registration method for complex PCBs according to claim 1, characterized in that, After step e, there is also step f, Step f. Stitch all the sub - images after the projection transformation to form a large image with high - precision matching.

Citation Information

Patent Citations

  • A localization method based on SIFT feature points

    CN106373161B

  • Improved PCB bare board image registration method

    CN114897946A

  • Template-based array image registration method in snapshot spectral imaging

    CN103824289A

  • Method and device for performing image registration based on slices

    CN107194959A