A large-format PCB panel accurate positioning method with repeating elements

By combining the nine-point calibration method and homography matrix transformation with pyramid downsampling, Hough circle detection, and caliper circle detection, the problem of inaccurate component positioning on large-size PCBs was solved, achieving high-precision and highly adaptive rapid detection.

CN116612071BActive Publication Date: 2026-02-24GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310418227.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-18
Publication Date
2026-02-24
Estimated Expiration
2043-04-18

AI Technical Summary

Technical Problem

Existing technologies suffer from low positioning and detection accuracy when dealing with large-size PCBs and a large number of components, resulting in problems such as repeated positioning or missing positioning. In particular, positioning is inaccurate and has poor adaptability under non-uniform lighting conditions.

Method used

An industrial camera and calibration board are used to obtain initial pixel and pulse coordinates through a nine-point calibration method. Coordinate transformation and rotation correction are performed using a homography matrix. Coarse positioning is achieved by combining pyramid downsampling and Hough circle detection. Subpixel-level fine positioning is achieved by using calipers to detect the circle. Duplicate points are removed by the KNN algorithm to achieve high-precision component positioning.

Benefits of technology

It achieves rapid positioning and detection with high accuracy, high precision and strong adaptability, improving the efficiency of defect detection of electronic components in PCB panels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116612071B_ABST
    Figure CN116612071B_ABST
Patent Text Reader

Abstract

The application provides a large-format PCB panel accurate positioning method with repeated elements, which comprises nine-point calibration, initialization of industrial camera parameters, combination of pyramid downsampling and Hough circle detection for coarse positioning of Mark points and sub-pixel level accurate positioning of the algorithm for circle detection by using a caliper for positioning of two Mark points of the upper left and the lower right, conversion of the coordinates of the point set in the DXF coordinate system into pulse coordinates, conversion into pixel coordinates of the pixel coordinates of the component coordinate point set by combining the shot position information, and removal of repeated component coordinate information on the left and right adjacent FOVs through a KNN algorithm, so that high-accuracy, high-precision and strong-adaptive rapid positioning detection is realized, and each component on different PCB products can be accurately positioned and detected quickly and accurately, and the efficiency of electronic component defect detection in the PCB panel is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine vision and defect detection technology for electronic components on PCB panels, and more specifically, to a method for precise positioning of large-format PCB panels with repeating elements. Background Technology

[0002] In the field of equipment manufacturing, PCBs are important electronic components. PCBs are classified as single-sided, double-sided, and multilayer boards. In the most basic PCB, components are concentrated on one side, and conductors are concentrated on the other side; this type of PCB is called a single-sided board. Double-sided boards have copper-clad traces on both sides, and vias can be used to connect the two layers, forming the required network connections. Multilayer boards refer to boards with three or more conductive pattern layers laminated with insulating materials in between, and the conductive patterns are interconnected as required. PCBs mainly consist of pads, through-holes, mounting holes, wires, components, connectors, fillers, and electrical boundaries. The PCB uses a base insulating material to isolate the surface copper conductive layers, allowing current to flow along pre-designed paths through various components to perform functions such as work, amplification, attenuation, modulation, demodulation, and encoding.

[0003] The main challenges in PCB panel positioning and inspection are the dense arrangement of tiny electronic components in the PCB panel, the large number of components in a single PCB panel, the strict imaging requirements for the PCB board, the fact that the entire PCB panel will be divided into several fields of view after imaging, and the possibility of duplicate or missing components in different fields of view, as well as the poor robustness of positioning and inspection for different PCB products.

[0004] In current technologies, traditional PCB product positioning methods mostly rely on manual or mechanical positioning. The accuracy of these methods depends on the human skill and the precision of the mechanical design. Under non-uniform lighting conditions, manual positioning can be affected, making it unreliable. On the other hand, visual positioning technology suffers from problems such as degraded PCB board images, low contrast, and blurred edges, leading to significant positioning errors.

[0005] Current technology discloses a deep learning-based method for detecting surface defects on printed circuit boards. The device includes a conveying and positioning device, an image acquisition device, an image processing unit, and a deep learning analysis and processing unit. The deep learning analysis and processing unit analyzes the pre-processed printed circuit board surface image using a pre-set deep learning algorithm, providing detection results to achieve rapid and accurate detection of surface defects. While existing technologies utilize neural networks to analyze PCB board images to improve detection efficiency, the image acquisition method still relies on industrial cameras at different angles. This results in problems such as degraded PCB board image structure, low contrast, and blurred edges, leading to positioning errors and decreased detection accuracy. Furthermore, when dealing with circuit boards with a large number of components, the captured images also suffer from low accuracy and component ghosting, making it impossible to accurately locate each component and further reducing detection accuracy. Summary of the Invention

[0006] To overcome the shortcomings of existing technologies, such as low positioning accuracy and repetitive or missing positioning when dealing with PCBs with large product sizes and a large number of components, this invention provides a precise positioning method for large-format PCB panels with repetitive components, which can quickly and accurately position and detect various components on different PCB products.

[0007] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0008] A method for precise positioning of a large-format PCB panel with repeating elements includes the following steps:

[0009] S1: Using an industrial camera and calibration board, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating components are obtained through the nine-point calibration method. The homography matrix between the pulse coordinate system and the pixel coordinate system, as well as the initial slope and initial angle between the two Mark points at the top left and bottom right, are also obtained.

[0010] S2: Acquire DXF image data of the PCB panel, set several shooting positions in the DXF image data, input the homography matrix into the industrial camera and initialize all its parameters;

[0011] S3: Preprocess the PCB image data captured at each camera position, and perform coarse and fine positioning on the two Mark points in the upper left and lower right of the preprocessed PCB image data to obtain the pixel coordinates of the two Mark points in the pixel coordinate system.

[0012] S4: Use the homography matrix to convert the pixel coordinates of the top left and bottom right Mark points in the pixel coordinate system into pulse coordinates, and recalculate the slope and angle between the top left and bottom right Mark points. Rotate the preprocessed DXF image data with the center of the DXF coordinate system as the rotation center so that the slope between the top left and bottom right Mark points is the same as the initial slope, thus completing the alignment of the coordinate system.

[0013] S5: Based on the preset shooting positions, use the initialized industrial camera to shoot point sets. Set several fields of view at each shooting position. After shooting a field of view, output the pulse coordinates of the points in that field of view and remove the points in that field of view from the total point set in the DXF image data.

[0014] After traversing the total point set in the DXF image data, the pulse coordinates of all points are obtained, and the homography matrix is ​​used to convert the pulse coordinates of each point into pixel coordinates.

[0015] S6: Use the KNN algorithm to remove duplicate points during the traversal of the total point set of the DXF image data, save and output the pixel coordinates of all deduplicated points, and complete the precise positioning of all components.

[0016] Preferably, in step S1, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating elements are obtained in the pulse coordinate system using an industrial camera and a calibration board through a nine-point calibration method, and the homography matrix between the initial pulse coordinates and the initial pixel coordinates is obtained. The specific method is as follows:

[0017] Fix the industrial camera on the AOI industrial inspection equipment, with the height of the industrial camera at the same height as the large-format PCB panel with repetitive components; place the calibration board below the camera, with its position area consistent with the working area of ​​the machine's industrial camera scanning the PCB panel.

[0018] After setting the focal length of the industrial camera, take a picture, process the captured image in grayscale, and use the contour circle finding method to identify the initial pixel coordinates of all Mark points. Based on the spacing between Mark points on the input calibration board and the position information of the first Mark point, generate the initial pulse coordinates of all Mark points on the calibration board. Calculate the homography matrix based on the initial pixel coordinates of the Mark points and their corresponding initial pulse coordinates, and record the pulse coordinates of the current shooting position.

[0019] Preferably, the homography matrix includes a rotation matrix and a translation matrix, specifically:

[0020]

[0021] Among them, (x c ,y c(x) represents the initial pixel coordinates. t ,y t Let R be the initial pulse coordinates, and R be the rotation matrix, satisfying... M is a translation matrix that satisfies

[0022] Based on the initial pixel coordinates of the Mark point and its corresponding initial pulse coordinates, the homography matrix is ​​calculated using the following formula:

[0023]

[0024]

[0025] Among them, (x c1 ,y c1 ),(x c2 ,y c2 ),(x c3 ,y c3 (x) represents the initial pixel coordinates of the first, second, and third Marks, respectively; t1 ,y t1 ),(x t2 ,y t2 ),(x t3 ,y t3 The initial pulse coordinates of the first, second, and third Marks are respectively.

[0026] The initial pixel coordinates and initial pulse coordinates of the nine Mark points are divided into three groups. The homography matrix is ​​calculated three times according to the above formula and the average value is taken as the final homography matrix.

[0027] Preferably, in step S2, the specific method for inputting the homography matrix into the industrial camera and initializing all its parameters is as follows:

[0028] Input the homography matrix into the industrial camera and initialize the industrial camera's focal length, principal distance, distortion coefficient, adjacent pixel distance, and the actual range of a single field of view in the DXF image data.

[0029] Preferably, the specific method for preprocessing the PCB image data captured at each camera position in step S3 is as follows:

[0030] The PCB image data captured from each camera position is converted to grayscale. The grayscale PCB image data is then subjected to Gaussian filtering and median filtering to complete the preprocessing.

[0031] Preferably, in step S3, the specific method for coarsely locating the two Mark points in the upper left and lower right corners of the preprocessed PCB image data is as follows:

[0032] Three pyramid downsampling processes were performed on the areas surrounding the upper left and lower right Mark points in the preprocessed PCB image data.

[0033] According to Hough circle detection, the first stage is used to detect the center of the circle for the upper left and lower right Mark points, and the second stage is used to derive the circle radius from the center. The coarse positioning of the two Mark points, the upper left and lower right, is completed through the two stages.

[0034] Preferably, in step S3, the specific method for precisely locating the two Mark points in the upper left and lower right corners of the preprocessed PCB image data is as follows:

[0035] The contours of the two Mark points, located at the top left and bottom right, after coarse positioning are subjected to Gaussian filtering using calipers to detect circles, and edge points are extracted to complete fine positioning, thereby obtaining the pixel coordinates of the two Mark points in the pixel coordinate system.

[0036] Preferably, the positioning accuracy of the fine positioning is at the sub-pixel level.

[0037] Preferably, in step S4, the preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center, specifically as follows:

[0038] The initial slopes and initial angles of the two Mark points at the top left and bottom right are denoted as k0 and a0, respectively. The slopes and angles obtained after recalculation are denoted as k1 and a1, respectively.

[0039] The preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center. The rotation angle is a1-a0, so that the slope k between the two Mark points at the top left and bottom right is the same as the initial slope k0, thus completing the alignment of the coordinate system.

[0040] Preferably, in step S6, the specific method for removing duplicate points during the traversal of the total point set of the DXF image data using the KNN algorithm is as follows:

[0041] Calculate the distance between a point and the pixel coordinates of all other points using the Hamming distance formula, and sort all distances in ascending order;

[0042] Select the K points with the smallest distance and input them into the trained KNN model. Calculate the similarity between each point and the K points. Remove points with similarity higher than a preset threshold as duplicate points.

[0043] The trained KNN model and Hamming distance formula are used to remove duplicate points from all points.

[0044] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0045] This invention provides a method for precise positioning of a large-format PCB panel with repeating elements. Using an industrial camera and calibration board, the initial pixel coordinates and initial pulse coordinates of Mark points on the large-format PCB panel with repeating elements are obtained through a nine-point calibration method. The homography matrix between the pulse coordinate system and the pixel coordinate system, as well as the initial slope and initial angle between the top-left and bottom-right Mark points, are also obtained. DXF image data of the PCB panel is acquired, and several shooting positions are set in the DXF image data. The homography matrix is ​​input into the industrial camera, and all its parameters are initialized. The PCB image data obtained from each shooting position is preprocessed. Coarse and fine positioning are performed on the top-left and bottom-right Mark points in the preprocessed PCB image data to obtain the pixel coordinates of the top-left and bottom-right Mark points in the pixel coordinate system. The homography matrix is ​​then used to reposition the top-left and bottom-right Mark points in the pixel coordinate system. The pixel coordinates are converted to pulse coordinates, and the slope and angle between the top left and bottom right Mark points are recalculated. The preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center, so that the slope between the top left and bottom right Mark points is the same as the initial slope, thus aligning the coordinate system. Point sets are captured using an initialized industrial camera according to the preset shooting positions. Several fields of view are set at each shooting position. After each field of view is captured, the pulse coordinates of the points in that field of view are output, and the points in that field of view are removed from the total point set in the DXF image data. After traversing the total point set in the DXF image data, the pulse coordinates of all points are obtained, and the pulse coordinates of each point are converted to pixel coordinates using the homography matrix. The KNN algorithm is used to remove duplicate points during the traversal of the total point set in the DXF image data. The pixel coordinates of all deduplicated points are saved and output, thus completing the precise positioning of all components.

[0046] This invention targets large-format PCB panels with numerous repetitive and tiny components. The proposed positioning method effectively avoids the shortcomings of traditional machine vision positioning algorithms, such as inaccuracy, poor precision, and poor adaptability. This invention combines coarse positioning of Mark points using pyramid downsampling and Hough circle detection with sub-pixel-level fine positioning using a caliper-based circle detection algorithm. It converts the coordinates of the point set in the DXF coordinate system into pulse coordinates, combines the image position information to convert to pixel coordinates to obtain the pixel coordinates of the component coordinate point set, and then uses the KNN algorithm to remove duplicate coordinate information of repetitive components on the left and right sides of the FOV. This achieves rapid positioning and detection with high accuracy, high precision, and strong adaptability. At the same time, it can quickly and accurately locate and detect various components on different PCB products, greatly improving the efficiency of defect detection of electronic components in PCB panels. Attached Figure Description

[0047] Figure 1This is a flowchart of a method for precise positioning of a large-format PCB panel with repeating elements, as provided in Example 1.

[0048] Figure 2 This is a flowchart of a method for precise positioning of a large-format PCB panel with repeating elements, as provided in Example 2. Detailed Implementation

[0049] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0050] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;

[0051] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.

[0052] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0053] Example 1

[0054] like Figure 1 As shown, this embodiment provides a method for precise positioning of a large-format PCB panel with repeating elements, including the following steps:

[0055] S1: Using an industrial camera and calibration board, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating components are obtained through the nine-point calibration method. The homography matrix between the pulse coordinate system and the pixel coordinate system, as well as the initial slope and initial angle between the two Mark points at the top left and bottom right, are also obtained.

[0056] S2: Acquire DXF image data of the PCB panel, set several shooting positions in the DXF image data, input the homography matrix into the industrial camera and initialize all its parameters;

[0057] S3: Preprocess the PCB image data captured at each camera position, and perform coarse and fine positioning on the two Mark points in the upper left and lower right of the preprocessed PCB image data to obtain the pixel coordinates of the two Mark points in the pixel coordinate system.

[0058] S4: Use the homography matrix to convert the pixel coordinates of the top left and bottom right Mark points in the pixel coordinate system into pulse coordinates, and recalculate the slope and angle between the top left and bottom right Mark points. Rotate the preprocessed DXF image data with the center of the DXF coordinate system as the rotation center so that the slope between the top left and bottom right Mark points is the same as the initial slope, thus completing the alignment of the coordinate system.

[0059] S5: Based on the preset shooting positions, use the initialized industrial camera to shoot point sets. Set several fields of view at each shooting position. After shooting a field of view, output the pulse coordinates of the points in that field of view and remove the points in that field of view from the total point set in the DXF image data.

[0060] After traversing the total point set in the DXF image data, the pulse coordinates of all points are obtained, and the homography matrix is ​​used to convert the pulse coordinates of each point into pixel coordinates.

[0061] S6: Use the KNN algorithm to remove duplicate points during the traversal of the total point set of the DXF image data, save and output the pixel coordinates of all deduplicated points, and complete the precise positioning of all components.

[0062] In the specific implementation process, firstly, using an industrial camera and calibration board, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating components are obtained through a nine-point calibration method. The homography matrix between the pulse coordinate system and the pixel coordinate system, as well as the initial slope and initial angle between the upper left and lower right Mark points, are also obtained. Next, DXF image data of the PCB panel is acquired, and several shooting positions are set in the DXF image data. The homography matrix is ​​input into the industrial camera, and all its parameters are initialized. The PCB image data obtained from each shooting position is preprocessed. Coarse and fine positioning are performed on the upper left and lower right Mark points in the preprocessed PCB image data to obtain the pixel coordinates of the upper left and lower right Mark points in the pixel coordinate system. Finally, the pixel coordinates of the upper left and lower right Mark points in the pixel coordinate system are converted into pulse coordinates using the homography matrix. The coordinates are adjusted, and the slope and angle between the top left and bottom right Mark points are recalculated. The preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center, so that the slope between the top left and bottom right Mark points is the same as the initial slope, thus aligning the coordinate system. Point sets are captured using an initialized industrial camera according to the preset shooting positions. Several fields of view are set at each shooting position. After each field of view is captured, the pulse coordinates of the points in that field of view are output, and the points in that field of view are removed from the total point set in the DXF image data. After traversing the total point set in the DXF image data, the pulse coordinates of all points are obtained, and the homography matrix is ​​used to convert the pulse coordinates of each point into pixel coordinates. Finally, the KNN algorithm is used to remove duplicate points during the traversal of the total point set in the DXF image data. The pixel coordinates of all deduplicated points are saved and output, thus completing the precise positioning of all components.

[0063] This method targets large-format PCB panels with numerous repetitive and tiny components. The proposed positioning method effectively avoids the shortcomings of traditional machine vision positioning algorithms, such as inaccuracy, poor precision, and poor adaptability. This method combines coarse positioning of Mark points using pyramid downsampling and Hough circle detection with sub-pixel-level fine positioning using a caliper-based circle detection algorithm. It converts the coordinates of the point set in the DXF coordinate system into pulse coordinates, combines the image position information, and converts them into pixel coordinates to obtain the pixel coordinates of the component coordinate point set. Then, the KNN algorithm is used to remove duplicate coordinate information of repetitive components on the left and right sides of the FOV, thereby achieving rapid positioning and detection with high accuracy, high precision, and strong adaptability. At the same time, it can quickly and accurately locate and detect various components on different PCB products, greatly improving the efficiency of defect detection of electronic components in PCB panels.

[0064] Example 2

[0065] like Figure 2 As shown, this embodiment provides a method for precise positioning of a large-format PCB panel with repeating elements, including the following steps:

[0066] S1: Using an industrial camera and calibration board, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating components are obtained through the nine-point calibration method. The homography matrix between the pulse coordinate system and the pixel coordinate system, as well as the initial slope and initial angle between the two Mark points at the top left and bottom right, are also obtained.

[0067] S2: Acquire DXF image data of the PCB panel, set several shooting positions in the DXF image data, input the homography matrix into the industrial camera and initialize all its parameters;

[0068] S3: Preprocess the PCB image data captured at each camera position, and perform coarse and fine positioning on the two Mark points in the upper left and lower right of the preprocessed PCB image data to obtain the pixel coordinates of the two Mark points in the pixel coordinate system.

[0069] S4: Use the homography matrix to convert the pixel coordinates of the top left and bottom right Mark points in the pixel coordinate system into pulse coordinates, and recalculate the slope and angle between the top left and bottom right Mark points. Rotate the preprocessed DXF image data with the center of the DXF coordinate system as the rotation center so that the slope between the top left and bottom right Mark points is the same as the initial slope, thus completing the alignment of the coordinate system.

[0070] S5: Based on the preset shooting positions, use the initialized industrial camera to shoot point sets. Set several fields of view at each shooting position. After shooting a field of view, output the pulse coordinates of the points in that field of view and remove the points in that field of view from the total point set in the DXF image data.

[0071] After traversing the total point set in the DXF image data, the pulse coordinates of all points are obtained, and the homography matrix is ​​used to convert the pulse coordinates of each point into pixel coordinates.

[0072] S6: Use the KNN algorithm to remove duplicate points during the traversal of the total point set of DXF image data, save and output the pixel coordinates of all deduplicated points, and complete the precise positioning of all components.

[0073] In step S1, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating elements are obtained in the pulse coordinate system using an industrial camera and a calibration board through a nine-point calibration method. The homography matrix between the initial pulse coordinates and the initial pixel coordinates is then obtained. The specific method is as follows:

[0074] Fix the industrial camera on the AOI industrial inspection equipment, with the height of the industrial camera at the same height as the large-format PCB panel with repetitive components; place the calibration board below the camera, with its position area consistent with the working area of ​​the machine's industrial camera scanning the PCB panel.

[0075] After setting the focal length of the industrial camera, take a picture, process the captured image in grayscale, use the contour circle finding method to identify the initial pixel coordinates of all Mark points, generate the initial pulse coordinates of all Mark points on the calibration board based on the spacing between Mark points on the input calibration board and the position information of the first Mark point, calculate and obtain the homography matrix based on the initial pixel coordinates of the Mark points and their corresponding initial pulse coordinates, and record the pulse coordinates of the current shooting position.

[0076] The homography matrix includes a rotation matrix and a translation matrix, specifically:

[0077]

[0078] Among them, (x c ,y c (x) represents the initial pixel coordinates. t ,y t Let R be the initial pulse coordinates, and R be the rotation matrix, satisfying... M is a translation matrix that satisfies

[0079] Based on the initial pixel coordinates of the Mark point and its corresponding initial pulse coordinates, the homography matrix is ​​calculated using the following formula:

[0080]

[0081]

[0082] Among them, (x c1 ,y c1 ),(x c2 ,y c2 ),(x c3 ,y c3 (x) represents the initial pixel coordinates of the first, second, and third Marks, respectively; t1 ,y t1 ),(x t2 ,y t2 ),(x t3 ,y t3 The initial pulse coordinates of the first, second, and third Marks are respectively.

[0083] The initial pixel coordinates and initial pulse coordinates of the nine Mark points are divided into three groups. The homography matrix is ​​calculated three times according to the above formula and the average value is taken as the final homography matrix.

[0084] In step S2, the specific method for inputting the homography matrix into the industrial camera and initializing all its parameters is as follows:

[0085] Input the homography matrix into the industrial camera and initialize the industrial camera's focal length, principal distance, distortion coefficient, adjacent pixel distance, and the actual range of a single field of view in the DXF image data;

[0086] The specific method for preprocessing the PCB image data captured at each camera position in step S3 is as follows:

[0087] The PCB image data captured from each camera position is preprocessed by converting it to grayscale. The grayscale PCB image data is then subjected to Gaussian filtering and median filtering to complete the preprocessing.

[0088] In step S3, the specific method for coarsely locating the two Mark points in the upper left and lower right corners of the preprocessed PCB image data is as follows:

[0089] Three pyramid downsampling processes were performed on the areas surrounding the upper left and lower right Mark points in the preprocessed PCB image data.

[0090] According to Hough circle detection, the first stage is used to detect the center of the circle for the upper left and lower right Mark points, and the second stage is used to derive the circle radius from the center. The coarse positioning of the two Mark points, the upper left and lower right, is completed through the two stages.

[0091] In step S3, the specific method for precisely locating the two Mark points in the upper left and lower right corners of the preprocessed PCB image data is as follows:

[0092] The contours of the two Mark points in the upper left and lower right corners after coarse positioning are subjected to Gaussian filtering by using calipers to detect circles, and edge points are extracted to complete fine positioning and obtain the pixel coordinates of the two Mark points in the upper left and lower right corners.

[0093] The positioning accuracy of the fine positioning is at the sub-pixel level;

[0094] In step S4, the preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center, specifically as follows:

[0095] The initial slopes and initial angles of the two Mark points at the top left and bottom right are denoted as k0 and a0, respectively. The slopes and angles obtained after recalculation are denoted as k1 and a1, respectively.

[0096] The preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center. The rotation angle is a1-a0, so that the slope k between the two Mark points at the top left and bottom right is the same as the initial slope k0, thus completing the alignment of the coordinate system.

[0097] In step S6, the specific method for removing duplicate points during the traversal of the total point set of DXF image data using the KNN algorithm is as follows:

[0098] Calculate the distance between a point and the pixel coordinates of all other points using the Hamming distance formula, and sort all distances in ascending order;

[0099] Select the K points with the smallest distance and input them into the trained KNN model. Calculate the similarity between each point and the K points. Remove points with similarity higher than a preset threshold as duplicate points.

[0100] The trained KNN model and Hamming distance formula are used to remove duplicate points from all points.

[0101] In the specific implementation process, in order to determine the relationship between the three-dimensional geometric position of a point on the surface of a spatial PCB panel and its corresponding point in the image, the panel needs to be calibrated. Calibration is beneficial for high-precision measurement and positioning. Spatial objects present a three-dimensional geometric position, while the projected image in the camera is a two-dimensional position. Therefore, calibration is to determine the relationship between the three-dimensional geometric position of a point on the spatial object and its corresponding point in the projected image. Calibration must establish a projection mathematical model of the object and the camera, that is, the geometric model of camera imaging. The mathematical parameters for constructing the geometric model are the content that needs to be calibrated, namely the intrinsic and extrinsic parameters of the camera. The intrinsic parameters are the camera's process parameters, including focal length, principal distance, distortion coefficient, and distance between adjacent pixels, etc., while the extrinsic parameters are the camera's position parameters, including rotation angle and translation distance, etc. In this embodiment, the nine-point calibration method in industrial vision is selected to calibrate the PCB panel and obtain the transformation relationship from pixel coordinate system to pulse coordinate system.

[0102] First, using an industrial camera and calibration board, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating components are obtained through a nine-point calibration method. Then, the homography matrix between the pulse coordinate system and the pixel coordinate system, as well as the initial slope and initial angle between the top-left and bottom-right Mark points, are obtained. The specific method is as follows:

[0103] Fix the industrial camera on the AOI industrial inspection equipment, with the height of the industrial camera at the same height as the large-format PCB panel with repetitive components; place the calibration board below the camera, with its position area consistent with the working area of ​​the machine's industrial camera scanning the PCB panel.

[0104] After setting the focal length of the industrial camera, take a picture, process the captured image in grayscale, use the contour circle finding method to identify the initial pixel coordinates of all Mark points, generate the initial pulse coordinates of all Mark points on the calibration board based on the spacing between Mark points on the input calibration board and the position information of the first Mark point, calculate and obtain the homography matrix based on the initial pixel coordinates of the Mark points and their corresponding initial pulse coordinates, and record the pulse coordinates of the current shooting position.

[0105] The homography matrix includes a rotation matrix and a translation matrix, specifically:

[0106]

[0107] Among them, (x c ,y c (x) represents the initial pixel coordinates. t ,y t Let R be the initial pulse coordinates, and R be the rotation matrix, satisfying... M is a translation matrix that satisfies

[0108] Based on the initial pixel coordinates of the Mark point and its corresponding initial pulse coordinates, the homography matrix is ​​calculated using the following formula:

[0109]

[0110]

[0111] Among them, (x c1 ,y c1 ),(x c2 ,y c2 ),(x c3 ,y c3 (x) represents the initial pixel coordinates of the first, second, and third Marks, respectively; t1 ,y t1 ),(x t2 ,y t2 ),(x t3 ,y t3 The initial pulse coordinates of the first, second, and third Marks are respectively.

[0112] Divide the initial pixel coordinates and initial pulse coordinates of the nine Mark points into three groups. Calculate the homography matrix three times according to the above formula and take the average value as the final homography matrix. The position coordinates of the z-axis can be set as needed to complete the calibration.

[0113] Acquire DXF image data of the PCB panel, set several shooting positions in the DXF image data, input the homography matrix into the industrial camera and initialize all its parameters, including the focal length, principal distance, distortion coefficient, adjacent pixel distance of the industrial camera, and the actual range of a single field of view in the DXF image data.

[0114] The PCB image data is then preprocessed, specifically as follows:

[0115] The PCB image data is converted to grayscale, and then Gaussian filtering and median filtering are performed on the grayscale PCB image data to complete the preprocessing.

[0116] Coarse and fine positioning are performed on the two Mark points in the upper left and lower right corners of the preprocessed PCB image data to obtain the pixel coordinates of the two Mark points in the pixel coordinate system.

[0117] Due to the large size of the PCB panel, the imaging cannot be completed in one go and needs to be divided into multiple fields of view. Therefore, it is necessary to locate multiple fields of view. A two-stage positioning method is used, imaging a very small area of ​​two Mark points at the upper left and lower right corners of the PCB board for positioning. In this embodiment, the Mark point positioning is performed in two stages: first, coarse positioning, and then fine positioning, which greatly reduces the error of Mark point positioning.

[0118] In this embodiment, coarse localization uses an image pyramid to segment the Mark point image, performs Gaussian kernel convolution on the image to give higher weights to neighboring pixels, resulting in a blurring effect, then deletes all even-numbered rows and columns, and downsamples to shrink the image;

[0119] In this embodiment, the area around the upper left and lower right Mark points in the preprocessed PCB image data is first subjected to three pyramid downsampling processes. Then, coarse localization is performed based on Hough circle detection. The first stage is used to detect the circle center, and the second stage is used to derive the circle radius from the circle center. The principle of detecting the circle center is that the circle center is the intersection of all normals of the circle. Therefore, as long as this intersection point is found, the circle center can be determined. The method of detecting the circle radius is to find that the distance (i.e., radius) from the circle center to any point on the circle is the same. Only a threshold needs to be determined. As long as the number of the same distance is greater than the threshold, the distance can be considered as the circle radius corresponding to the circle center. After obtaining the circle center and radius, a circle can be obtained, and the coarse localization of the Mark point is completed.

[0120] Based on coarse positioning, fine positioning is performed, which is sub-pixel level positioning. This embodiment uses a caliper-based circle detection method. The principle of this method is to find the places where the gray value changes abruptly within N small rectangular ROIs. First, the average gray value is calculated along the slicing direction for each rectangular ROI using the caliper (this only works when the contour line is not perpendicular to the boundary of the image to be measured). Gaussian filtering is then applied to the average gray value (contour). The purpose of Gaussian filtering is to make the curve smoother and eliminate noise. Then, edge points are extracted according to preset parameters, and sub-pixel extraction is performed. Through coarse and fine positioning, edge detection with strong anti-interference, strong robustness and high accuracy can be achieved, thereby improving the positioning accuracy of the Mark points.

[0121] Since the PCB panel may be tilted during calibration in step S1, it is necessary to align the DXF image data with the actual PCB board in step S4. Using the homography matrix, the pixel coordinates of the top-left and bottom-right Mark points are converted to pulse coordinates in the pixel coordinate system, and the slope and angle between the top-left and bottom-right Mark points are recalculated. The preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center, so that the slope between the top-left and bottom-right Mark points is the same as the initial slope, thus completing the coordinate system alignment. Specifically:

[0122] The initial slopes and initial angles of the two Mark points at the top left and bottom right are denoted as k0 and a0, respectively. The slopes and angles obtained after recalculation are denoted as k1 and a1, respectively.

[0123] The preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center. The rotation angle is a1-a0, so that the slope k between the two Mark points at the top left and bottom right is the same as the initial slope k0, thus completing the alignment of the coordinate system.

[0124] Then, point set shooting is performed using an initialized industrial camera according to the preset shooting position. Several fields of view are set at each shooting position. After each field of view is shot, the pulse coordinates of the points in that field of view are output, and the points in that field of view are removed from the total point set in the DXF image data. Then, the next field of view is shot.

[0125] Repeat the above operation until all shooting positions are captured and the total point set is traversed. After traversing the total point set in the DXF image data, obtain the pulse coordinates of all points, and use the homography matrix to convert the pulse coordinates of each point into pixel coordinates.

[0126] After obtaining the pixel coordinates of all point sets, large-format repeated target point sets will appear in adjacent fields of view. This is because some elements are partly at one edge of a field of view and partly at another edge of a field of view. The points of the element selected after shooting in two fields of view will be repeated.

[0127] Therefore, the KNN algorithm is finally used to remove duplicate points during the traversal of the total point set of the DXF image data. The specific method is as follows:

[0128] Calculate the distance between a point and the pixel coordinates of all other points using the Hamming distance formula, and sort all distances in ascending order;

[0129] Select the K points with the smallest distance and input them into the trained KNN model. Calculate the similarity between each point and the K points. Remove points with similarity higher than a preset threshold as duplicate points.

[0130] The trained KNN model and Hamming distance formula are used to remove duplicate points from all points;

[0131] Save and output the pixel coordinates of all deduplicated points to complete the precise positioning of all components;

[0132] This method targets large-format PCB panels with numerous repetitive and tiny components. The proposed positioning method effectively avoids the shortcomings of traditional machine vision positioning algorithms, such as inaccuracy, poor precision, and poor adaptability. This method combines coarse positioning of Mark points using pyramid downsampling and Hough circle detection with sub-pixel-level fine positioning using a caliper-based circle detection algorithm. It converts the coordinates of the point set in the DXF coordinate system into pulse coordinates, combines the image position information, and converts them into pixel coordinates to obtain the pixel coordinates of the component coordinate point set. Then, the KNN algorithm is used to remove duplicate coordinate information of repetitive components on the left and right sides of the FOV, thereby achieving rapid positioning and detection with high accuracy, high precision, and strong adaptability. At the same time, it can quickly and accurately locate and detect various components on different PCB products, greatly improving the efficiency of defect detection of electronic components in PCB panels.

[0133] The same or similar labels correspond to the same or similar parts;

[0134] The terms used to describe positional relationships in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent.

[0135] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for precise positioning of a large-format PCB panel with repeating elements, characterized in that, Includes the following steps: S1: Using an industrial camera and calibration board, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating components are obtained through the nine-point calibration method. The homography matrix between the pulse coordinate system and the pixel coordinate system, as well as the initial slope and initial angle between the two Mark points at the top left and bottom right, are also obtained. S2: Acquire DXF image data of the PCB panel, set several shooting positions in the DXF image data, input the homography matrix into the industrial camera and initialize all parameters; S3: Preprocess the PCB image data captured at each camera position, and perform coarse and fine positioning on the two Mark points in the upper left and lower right of the preprocessed PCB image data to obtain the pixel coordinates of the two Mark points in the pixel coordinate system. S4: Use the homography matrix to convert the pixel coordinates of the top left and bottom right Mark points in the pixel coordinate system into pulse coordinates, and recalculate the slope and angle between the top left and bottom right Mark points. Rotate the preprocessed DXF image data with the center of the DXF coordinate system as the rotation center so that the slope between the top left and bottom right Mark points is the same as the initial slope, thus completing the alignment of the coordinate system. S5: Based on the preset shooting positions, use the initialized industrial camera to shoot point sets. Set several fields of view at each shooting position. After shooting a field of view, output the pulse coordinates of the points in that field of view and remove the points in that field of view from the total point set in the DXF image data. After traversing the total point set in the DXF image data, the pulse coordinates of all points are obtained, and the homography matrix is ​​used to convert the pulse coordinates of each point into pixel coordinates. S6: Use the KNN algorithm to remove duplicate points during the traversal of the total point set of the DXF image data, save and output the pixel coordinates of all deduplicated points, and complete the precise positioning of all components.

2. The method for precise positioning of a large-format PCB panel with repeating elements according to claim 1, characterized in that, In step S1, the initial pixel coordinates and initial pulse coordinates of the Mark points on a large-format PCB panel with repeating elements are obtained using an industrial camera and a calibration board through a nine-point calibration method, and the homography matrix between the pulse coordinate system and the pixel coordinate system is obtained. The specific method is as follows: Fix the industrial camera on the AOI industrial inspection equipment, with the height of the industrial camera at the same height as the large-format PCB panel with repetitive components; place the calibration board below the camera, with its position area consistent with the working area of ​​the machine's industrial camera scanning the PCB panel. After setting the focal length of the industrial camera, take a picture, process the captured image in grayscale, and use the contour circle finding method to identify the initial pixel coordinates of all Mark points. Based on the spacing between Mark points on the input calibration board and the position information of the first Mark point, generate the initial pulse coordinates of all Mark points on the calibration board. Calculate the homography matrix based on the initial pixel coordinates of the Mark points and their corresponding initial pulse coordinates, and record the pulse coordinates of the current shooting position.

3. The method for precise positioning of a large-format PCB panel with repeating elements according to claim 2, characterized in that, The homography matrix includes a rotation matrix and a translation matrix, specifically: in, These are the initial pixel coordinates. Let R be the initial pulse coordinates, and R be the rotation matrix, satisfying... M is a translation matrix that satisfies ; Based on the initial pixel coordinates of the Mark point and its corresponding initial pulse coordinates, the homography matrix is ​​calculated using the following formula: in, These are the initial pixel coordinates of the first, second, and third Marks, respectively; These are the initial pulse coordinates for the first, second, and third Marks, respectively. The initial pixel coordinates and initial pulse coordinates of the nine Mark points are divided into three groups. The homography matrix is ​​calculated three times according to the formula above, and the average value is taken as the final homography matrix.

4. The method for precise positioning of a large-format PCB panel with repeating elements according to claim 1, characterized in that, In step S2, the specific method for inputting the homography matrix into the industrial camera and initializing all parameters is as follows: Input the homography matrix into the industrial camera and initialize the industrial camera's focal length, principal distance, distortion coefficient, adjacent pixel distance, and the actual range of a single field of view in the DXF image data.

5. A method for precise positioning of a large-format PCB panel with repeating elements according to claim 1, characterized in that, The specific method for preprocessing the PCB image data captured at each camera position in step S3 is as follows: The PCB image data captured from each camera position is converted to grayscale. The grayscale PCB image data is then subjected to Gaussian filtering and median filtering to complete the preprocessing.

6. A method for precise positioning of a large-format PCB panel with repeating elements according to claim 5, characterized in that, In step S3, the specific method for coarsely locating the two Mark points in the upper left and lower right corners of the preprocessed PCB image data is as follows: Three pyramid downsampling processes were performed on the areas surrounding the upper left and lower right Mark points in the preprocessed PCB image data. According to Hough circle detection, the first stage is used to detect the center of the circle for the upper left and lower right Mark points, and the second stage is used to derive the circle radius from the center. The coarse positioning of the two Mark points, the upper left and lower right, is completed through the two stages.

7. A method for precise positioning of a large-format PCB panel with repeating elements according to claim 1 or 6, characterized in that, In step S3, the specific method for precisely locating the two Mark points in the upper left and lower right corners of the preprocessed PCB image data is as follows: The contours of the two Mark points, located at the top left and bottom right, after coarse positioning are subjected to Gaussian filtering using calipers to detect circles, and edge points are extracted to complete fine positioning, thereby obtaining the pixel coordinates of the two Mark points in the pixel coordinate system.

8. A method for precise positioning of a large-format PCB panel with repeating elements according to claim 7, characterized in that, The positioning accuracy of the fine positioning is at the sub-pixel level.

9. A method for precise positioning of a large-format PCB panel with repeating elements according to claim 8, characterized in that, In step S4, the preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center, specifically as follows: The initial slopes and initial angles of the two Mark points at the top left and bottom right are denoted as k0 and a0, respectively. The slopes and angles obtained after recalculation are denoted as k1 and a1, respectively. The preprocessed DXF image data is rotated with the center of the DXF coordinate system as the rotation center. The rotation angle is a1-a0, so that the slope k between the two Mark points at the top left and bottom right is the same as the initial slope k0, thus completing the alignment of the coordinate system.

10. A method for precise positioning of a large-format PCB panel with repeating elements according to claim 9, characterized in that, In step S6, the specific method for removing duplicate points during the traversal of the total point set of DXF image data using the KNN algorithm is as follows: Calculate the distance between a point and the pixel coordinates of all other points using the Hamming distance formula, and sort all distances in ascending order; Select the K points with the smallest distance and input them into the trained KNN model. Calculate the similarity between each point and the K points. Remove points with similarity higher than a preset threshold as duplicate points. The trained KNN model and Hamming distance formula are used to remove duplicate points from all points.

Citation Information

Patent Citations

  • High-precision and high anti-interference positioning method and device for Mark point of PCB

    CN104732207A

  • Precision hole part geometrical characteristic detection method and system based on machine vision

    CN111862037A