A visual positioning method and system for PCB printed circuit board processing

By analyzing and fusing the edge distortion factors of the initial field of view, the hole distribution area is divided, and the optimal positioning parameters are obtained, which solves the problem of rapid positioning of PCB boards with complex hole layouts and improves processing efficiency and hole positioning accuracy.

CN120510210BActive Publication Date: 2025-10-28YUNFENG(KAIPING)ELECTRONIC PROD CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510613463.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-10-28
Estimated Expiration
2045-05-13

AI Technical Summary

Technical Problem

Existing single field-of-view parameters cannot meet the requirements for rapid positioning and multi-scale inspection of PCBs with complex hole layouts, and the edge distortion under large field-of-view optical systems seriously affects the accuracy of hole position coordinates.

Method used

By analyzing the edge distortion factor of the initial field of view, fusing the field of view, dividing the aperture distribution area, and obtaining the optimal positioning parameters, the aperture can be quickly located by combining camera movement and field of view parameter adjustment.

Benefits of technology

It improves the processing efficiency of PCBs with complex hole layouts under computer vision assistance, reduces the number of times camera field parameters need to be adjusted and the moving distance, and ensures the accuracy and speed of hole positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120510210B_ABST
    Figure CN120510210B_ABST
Patent Text Reader

Abstract

This invention relates to the field of image processing technology and proposes a visual positioning method and system for PCB printed circuit board processing. The method includes: acquiring several initial field-of-view ranges for a PCB board with a complex hole layout; analyzing the morphological characteristics of each hole position within each initial field-of-view range and their distribution relationship with the boundaries of the initial field-of-view ranges, and determining the edge distortion factors of each boundary range of each initial field-of-view range; fusing these to obtain a comprehensive field-of-view range; based on the hole size and clustering distribution characteristics within the comprehensive field-of-view range, dividing the PCB into several hole distribution regions and obtaining the optimal positioning parameters for each hole distribution region; combining the process of adjusting the field-of-view parameters to the optimal positioning parameters for each hole distribution region with the camera movement process to obtain the final positioning parameters for each hole distribution region; and adjusting the field-of-view parameters to quickly locate each hole distribution region. This invention aims to solve the problem that a single field-of-view parameter cannot perform rapid positioning and multi-scale detection for complex hole layouts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and specifically to a visual positioning method and system for PCB printed circuit board processing. Background Technology

[0002] In the manufacturing process of PCB printed circuit boards, the positioning of various holes is a crucial step. For PCBs with complex hole layouts, the holes are usually distributed over a large area with significant differences in diameter, typically ranging from micrometers to millimeters. During visual positioning, the camera's single physical field of view cannot cover the entire target area, requiring multiple camera movements or lens focal length adjustments to cover the entire board. Consequently, multiple calibrations are required during the visual positioning of the holes.

[0003] PCBs with complex hole layouts may contain various types of holes, such as high-density microvias that require high-resolution detection as functional holes, reference holes that require large-area rapid positioning as positioning holes, and heat dissipation holes with irregular shapes or array distributions. A single field of view parameter cannot simultaneously meet the detection and positioning requirements of multiple scales. In some optical systems with large fields of view, the edges will produce large-scale distortion, which will seriously affect the accuracy of hole position coordinates. It is necessary to eliminate the impact of edge distortion on positioning in the process of adaptive field of view positioning of multi-scale apertures. Summary of the Invention

[0004] This invention provides a visual positioning method and system for PCB printed circuit board processing, to solve the problem that existing single field-of-view parameters cannot perform rapid positioning and multi-scale detection for complex hole layouts. The specific technical solution adopted is as follows:

[0005] This invention proposes a visual positioning method for PCB printed circuit board processing, which includes the following steps:

[0006] Obtain several initial field-of-view ranges for PCBs with complex hole layouts;

[0007] Analyze the morphological characteristics of each aperture position in each initial field of view and its distribution relationship with the boundary of the initial field of view to determine the edge distortion factor of each boundary range of each initial field of view; based on the edge distortion factor of the boundary range, fuse each initial field of view to obtain the comprehensive field of view.

[0008] Based on the size and clustering distribution of apertures within the overall field of view, several aperture distribution areas are divided and the optimal positioning parameters for each aperture distribution area are obtained. By combining the process of adjusting the field of view parameters to the optimal positioning parameters for each aperture distribution area and the camera movement process, the final positioning parameters for each aperture distribution area are obtained.

[0009] Based on the final positioning parameters of each hole location distribution area, the camera's field of view parameters are adjusted to quickly locate each hole location distribution area.

[0010] Optionally, the specific method for analyzing the morphological characteristics of each aperture position within each initial field of view and its distribution relationship with the boundary of the initial field of view, and determining the edge distortion factor of each boundary range of each initial field of view, includes:

[0011] Based on the changes in the shape of each aperture position relative to a circle within the same initial field of view, and the distribution position of the center of each aperture position, the degree of morphological distortion of each aperture position within the initial field of view is obtained.

[0012] Each straight line parallel to the boundary of the field of view within any initial field of view is taken as a boundary range of the initial field of view, thus obtaining a number of lateral and longitudinal boundary ranges of the initial field of view.

[0013] For the i-th lateral boundary range within the initial field of view, obtain the distance between the center of each aperture position within the initial field of view and the i-th boundary range, and the edge distortion factor γ of the i-th lateral boundary range. h,i The calculation method is as follows:

[0014]

[0015] Where N represents the number of apertures in the initial field of view, and D h d represents the distance between the two lateral boundaries of the initial field of view. h,i d represents the minimum distance between the i-th lateral boundary and the two lateral boundaries within the initial field of view. h,i (n) represents the center of the nth aperture in the initial field of view, and d. h,i The distance between the corresponding lateral boundaries, β n This indicates the degree of morphological distortion of the nth aperture position within the initial field of view, and || represents the absolute value function.

[0016] Optionally, the specific method for obtaining the degree of morphological distortion of each aperture position in the initial field of view includes:

[0017] For any aperture position within any initial field of view, obtain the center of the aperture position, as well as the center of its minimum bounding rectangle and minimum bounding circle;

[0018] Obtain the distance between two intersection points of any straight line passing through the center of the hole and the edge of the hole, take this straight line as a radial straight line of the hole, and take the distance as the radial length of the radial straight line, thus obtaining several radial straight lines of the hole and their radial lengths.

[0019] The degree of morphological distortion β of the j-th aperture position within the initial field of view j The calculation method is as follows:

[0020]

[0021] Among them, h j Let r represent the length of the shorter side of the minimum bounding rectangle of the j-th hole position. j,min r represents the minimum radial length among all radial straight lines at the j-th hole position. j,max c represents the maximum radial length among all radial straight lines at the j-th hole position. j This represents the distance between the center of the j-th hole and the center of its smallest circumcircle.

[0022] Optionally, the specific method for fusing the initial field of view ranges to obtain the comprehensive field of view range includes:

[0023] If the edge distortion factor of any boundary range in any initial field of view is greater than or equal to the reference threshold, several apertures whose centers are located on the boundary range in the initial field of view will not participate in the fusion.

[0024] If the edge distortion factor of any boundary range in any initial field of view is less than the reference threshold, the difference obtained by subtracting the edge distortion factor of that boundary range from 1 is used as the reference weight of that boundary range in the initial field of view.

[0025] If a hole exists in multiple initial fields of view, the fields of view are fused based on the reference weights of the boundary ranges where the center of the hole is located in each initial field of view. If a hole exists in only one initial field of view, the hole is directly used as the hole in the composite field of view. The composite field of view is obtained by fusing the reference weights of the hole and the boundary ranges of the initial fields of view.

[0026] Optionally, the specific method for dividing the distribution area of ​​several holes is as follows:

[0027] Obtain the center of each aperture position and its minimum circumcircle and diameter within the comprehensive field of view; obtain the distance between the centers of any two aperture positions within the comprehensive field of view; based on the distance between the centers of the aperture positions and their minimum circumcircles, obtain several aperture position clusters through cluster analysis.

[0028] For several holes in the same hole location cluster, the diameter of the smallest circumcircle of all holes in the hole location cluster is taken as the hole location diameter of the hole location cluster. If the distance between the centers of two holes is less than or equal to the hole location diameter of their respective hole location clusters, the two holes are assigned to the same distribution area. By continuously judging the distance between the centers of holes in the same hole location cluster and the hole location diameter, several distribution areas of the hole location cluster are obtained.

[0029] Several distribution areas of each pore cluster are taken as several pore distribution areas of the comprehensive field of view.

[0030] Optionally, the method of obtaining several pore clusters through cluster analysis based on the distance between the centers of the pores and their minimum circumcircle includes the following specific methods:

[0031] The ratio of the area of ​​any aperture position within the overall field of view to the area of ​​its smallest circumcircle is taken as the circularity regularity of that aperture position.

[0032] The nearest neighbor range of a hole is defined as twice the diameter of its smallest circumcircle. Holes whose distance from the center of the hole is less than this nearest neighbor range are considered its neighboring holes. The method for calculating the nearest neighbor distance *s* is as follows:

[0033]

[0034] Where M represents the number of adjacent holes at this hole location, l m p represents the distance between the center of the hole and its m-th neighboring hole, p0 represents the diameter of the smallest circumcircle of the hole, p m Let || denote the diameter of the smallest circumcircle of the m-th neighboring hole, || denotes the absolute value function, and exp() denotes the exponential function with the natural constant as the base.

[0035] A three-dimensional sample space is constructed based on the circularity, proximity distance, and diameter of the smallest circumcircle of each hole position within the comprehensive field of view. Each hole position is then mapped into the three-dimensional sample space according to its circularity, proximity distance, and diameter of the smallest circumcircle, thus obtaining the sample points corresponding to each hole position in the three-dimensional sample space.

[0036] Density clustering is performed on all sample points, and the distance metric is the Euclidean distance between sample points, resulting in several clusters, which are denoted as several pore clusters.

[0037] Optionally, the optimal positioning parameters for each hole location distribution area are obtained using the following method:

[0038] For any given hole distribution area, obtain the hole diameter of the corresponding hole cluster and compare it with the diameters of various hole types during PCB positioning. Take the diameter of the hole type with the smallest absolute difference from the given hole diameter as the standard diameter for that hole distribution area. Take the field of view parameter corresponding to the standard diameter as the optimal field of view parameter for that hole distribution area and obtain the area of ​​the field of view range of the optimal field of view parameter. The optimization degree F of the q-th field of view parameter for that hole distribution area is then determined. q The calculation method is as follows:

[0039]

[0040] Where, k q Let kq represent the q-th field-of-view parameter of the aperture location distribution area, k0 represent the optimal field-of-view parameter of the aperture location distribution area, and S represent the area of ​​the aperture location distribution area. q S0 represents the area of ​​the field of view of the q-th field of view parameter in the aperture distribution area, S0 represents the area of ​​the field of view of the optimal field of view parameter in the aperture distribution area, || represents the absolute value function, and exp() represents the exponential function with the natural constant as the base.

[0041] By adjusting the optimal field of view parameters, the area of ​​the field of view is continuously increased. When the degree of preference of the field of view parameters decreases for the first time, the field of view parameters corresponding to the previous adjustment are taken as the optimal positioning parameters for the hole distribution area.

[0042] Optionally, the specific method for obtaining the final positioning parameters of each hole location distribution area includes:

[0043] For any two aperture distribution regions, the minimum distance between the edge pixels of each aperture distribution region is taken as the distance between the two aperture distribution regions; taking the aperture distribution region at the upper left corner of the comprehensive field of view as the starting aperture distribution region, the optimal positioning parameters of the starting aperture distribution region are taken as its final positioning parameters.

[0044] The aperture distribution area with the smallest distance from the initial aperture distribution area is obtained as the next aperture distribution area to be located. Based on the optimal positioning parameters and the best field of view parameters of the next aperture distribution area, the optimization factors of each field of view parameter of the next aperture distribution area are obtained.

[0045] For the optimal positioning parameters of the next positioning hole distribution area, adjust them to the final positioning parameters of the initial hole distribution area; when the optimization factor decreases for the first time during the adjustment process, use the field of view parameter corresponding to the previous adjustment as the final positioning parameter of the next positioning hole distribution area.

[0046] By analogy, after the final positioning parameters of the next positioning hole distribution area are determined, the nearest hole distribution area to the next positioning hole distribution area is obtained, and the final positioning parameters are obtained for each hole distribution area, so as to obtain the final positioning parameters of each hole distribution area.

[0047] Optionally, the specific method for obtaining the preferred factors of each field of view parameter of the next positioning aperture distribution region includes:

[0048]

[0049] Among them, F v ′ (1) F represents the optimization factor for the v-th field parameter of the aperture distribution area for the next positioning. v (1) represents the degree of preference of the v-th field parameter of the aperture distribution area for the next positioning, k ′ (0) represents the final positioning parameter of the initial borehole distribution area, k ′ (1) represents the optimal positioning parameters for the next positioning hole distribution area, k. ′ v (1) represents the v-th field parameter of the aperture distribution area for the next positioning, and || represents the absolute value function.

[0050] The present invention also proposes a visual positioning system for PCB printed circuit board processing. The system includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of the above method.

[0051] The beneficial effects of this invention are as follows: This invention eliminates the distortion of the edge portion of the aperture positions within the initial field of view, fuses the initial field of view to obtain a comprehensive field of view, and classifies the aperture positions based on their morphological appearance, size, and distribution relationship to obtain the aperture position distribution area and analyze positioning parameters; Specifically, by stretching the appearance of each aperture position within the initial field of view and combining its distribution relationship near the boundary of the initial field of view, the edge distortion factor of the boundary range of the initial field of view is quantified to reflect the impact of edge distortion on the visual appearance of the aperture positions within each initial field of view. Based on the weighting of the edge distortion factor, multiple initial field of view ranges are fused based on the aperture positions to obtain a comprehensive field of view and the aperture positions within it, providing a basis for subsequent analysis based on the comprehensive field of view. This provides a foundation for hole distribution and classification analysis within the comprehensive field of view. By analyzing the morphology, size, and distribution relationships of holes within the comprehensive field of view, hole clusters are obtained, and hole distribution areas are divided. By referencing and adjusting the field of view parameters during the positioning process of each type of hole, the optimal positioning parameters for the hole distribution area are determined. Furthermore, by combining the camera's rapid positioning movement process and the field of view parameter adjustment process, the optimal positioning parameters are further adjusted to obtain the final positioning parameters. This ensures that the degree and number of camera adjustments to the field of view parameters are minimized, thereby guaranteeing rapid hole positioning during the processing of PCBs with complex hole layouts and improving the processing efficiency of PCBs with computer vision assistance. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 This is a schematic flowchart of a visual positioning method for PCB printed circuit board processing provided in one embodiment of the present invention. Detailed Implementation

[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0055] Please see Figure 1 The diagram illustrates a flowchart of a visual positioning method for PCB printed circuit board processing according to an embodiment of the present invention. The method includes the following steps:

[0056] Step S001: Obtain several initial field ranges for the PCB board with complex hole layout.

[0057] The purpose of this embodiment is to enable rapid hole location in PCBs with complex hole layouts during the manufacturing process using computer vision. This requires image acquisition first. During the hole location process on the PCB, the industrial camera needs to continuously adjust the field of view parameters to locate and analyze holes with different shapes and sizes. In this embodiment, the initial field of view parameters are obtained using the maximum focal length of the industrial camera, and the initial field of view range is obtained accordingly. Since the surface area of ​​PCBs with complex hole layouts is large, the initial field of view parameters cannot completely capture the entire PCB, resulting in several initial field of view ranges.

[0058] Specifically, during the PCB board processing, an industrial camera is positioned above the processing assembly line and used as a mobile device. The maximum focal length of the industrial camera is used as the initial field of view parameter to photograph the PCB board. By moving the industrial camera, the PCB board is photographed completely, and each photographed PCB board image is used as the initial field of view image. It should be noted that in this embodiment, during the multiple photographs taken by moving the industrial camera, the overlapping part of two adjacent horizontally adjacent images accounts for 1 / 3, and the overlapping part of two adjacent vertically adjacent images accounts for 1 / 2. That is, overlapping photographs provide a basis for subsequent elimination of edge distortion of the initial field of view range.

[0059] Furthermore, for any initial field-of-view image, the non-PCB board background portion is removed from the initial field-of-view image through semantic segmentation. The semantic segmentation is implemented through a neural network, and the training dataset consists of a large number of PCB board images. The cross-entropy loss function is used. The initial field-of-view image is output to the trained semantic segmentation neural network, which outputs an image labeled with the PCB board portion. The PCB board portion is used as the initial field-of-view range of the initial field-of-view image. By obtaining the initial field-of-view range of each initial field-of-view image in the above manner, several initial field-of-view ranges are obtained.

[0060] Step S002: Analyze the morphological characteristics of each aperture position in each initial field of view and its distribution relationship with the boundary of the initial field of view, and determine the edge distortion factor of each boundary range of each initial field of view; based on the edge distortion factor of the boundary range, fuse each initial field of view to obtain a comprehensive field of view.

[0061] It should be noted that large-scale field parameters in the initial field of view will cause distortion in the visual appearance of apertures near the field of view boundary. Distortion will cause the apertures to be stretched, and the stretching can reflect the degree of distortion in the edge range. That is, the more severe the longitudinal stretching of the aperture, the closer it may be to the lateral boundary of the initial field of view and be affected by edge distortion. Therefore, by analyzing the stretching of the apertures and based on the distribution of the apertures in the range near the edge, the distortion of the boundary range can be quantified.

[0062] Preferably, in one embodiment of the present invention, the method for analyzing the morphological characteristics of each aperture position in each initial field of view and its distribution relationship with the boundary of the initial field of view to determine the edge distortion factor of each boundary range of each initial field of view includes:

[0063] For any aperture position within any initial field of view (incomplete aperture positions within this initial field of view are not processed further), obtain the center of the aperture position, as well as the center of its smallest circumscribed rectangle and smallest circumscribed circle; obtain the distance between the two intersection points of any straight line passing through the center of the aperture position and the edge of the aperture position, take this straight line as a radial straight line of the aperture position, and take the distance as the radial length of this radial straight line, thus obtaining several radial straight lines of the aperture position and their radial lengths; then, the degree of morphological distortion β of the j-th aperture position within the initial field of view is determined. j The calculation method is as follows:

[0064]

[0065] Among them, h j Let r represent the length of the shorter side of the minimum bounding rectangle of the j-th hole position. j,minr represents the minimum radial length among all radial straight lines at the j-th hole position. j,max c represents the maximum radial length among all radial straight lines at the j-th hole position. j This represents the distance between the center of the j-th hole and the center of its smallest circumcircle.

[0066] It should be noted that the closer the minimum radial length of the hole is to the short side length of the minimum circumscribed rectangle, the more its minimum radial length matches the diameter of the hole without distortion. The difference between the maximum and minimum radial length can directly reflect the degree of stretching caused by hole distortion. At the same time, the center change caused by hole stretching can be reflected by quantifying the distance between the center and the center of the minimum circumscribed circle, thus obtaining the degree of morphological distortion of the hole.

[0067] Furthermore, each straight line parallel to the boundary of any initial field of view is taken as a boundary range of the initial field of view, thus obtaining several lateral and longitudinal boundary ranges of the initial field of view; for the i-th lateral boundary range of the initial field of view, the distance between the center of each aperture position in the initial field of view and the i-th boundary range is obtained, and the edge distortion factor γ of the i-th lateral boundary range is calculated. h,i The calculation method is as follows:

[0068]

[0069] Where N represents the number of apertures in the initial field of view, and D h d represents the distance between the two lateral boundaries of the initial field of view. h,i d represents the minimum distance between the i-th lateral boundary and the two lateral boundaries within the initial field of view. h,i (n) represents the center of the nth aperture in the initial field of view, and d. h,i The distance between the corresponding lateral boundaries, β n This indicates the degree of morphological distortion of the nth aperture position within the initial field of view, and || represents the absolute value function.

[0070] Furthermore, similarly, the edge distortion factors of each boundary range in the horizontal and vertical directions within the initial field of view are obtained. In the process of obtaining the edge distortion factor of the vertical boundary range, the minimum distance between the vertical boundary range and the two vertical boundaries is used for calculation, thus obtaining the edge distortion factor of each boundary range of the initial field of view.

[0071] It should be noted that for the boundary range, the smaller the distance between the center and the boundary range of the aperture, the greater the reference value of the degree of morphological distortion for the edge distortion of the boundary range. That is, the closer the boundary range is to a boundary, the smaller the difference between the distance between the center of the aperture and that boundary and the distance between the boundary range and the boundary, the greater the corresponding reference weight; at the same time, the greater the degree of morphological distortion, the greater the edge distortion factor of the corresponding boundary range.

[0072] Preferably, in one embodiment of the present invention, the comprehensive field of view is obtained by fusing the initial field of view ranges based on the edge distortion factor of the boundary range, including the following specific method:

[0073] It should be noted that after determining the edge distortion factor of each boundary range of each initial field of view, the edge distortion factor reflects the edge distortion of the boundary range. In the process of fusing multiple images into a whole comprehensive field of view, it is necessary to eliminate the influence of edge distortion, remove the boundary range with a larger edge distortion factor, and use the boundary range with a smaller edge distortion factor for fusion, and obtain weights based on the edge distortion factor.

[0074] Specifically, since there is overlap between the initial field of view ranges, a preset reference threshold is used. In this embodiment, the reference threshold is described as 0.6. If the edge distortion factor of any boundary range in any initial field of view range is greater than or equal to the reference threshold, several apertures whose centers are located on the boundary range in the initial field of view range will not participate in the fusion. If the edge distortion factor of any boundary range in any initial field of view range is less than the reference threshold, the difference obtained by subtracting the edge distortion factor of the boundary range from 1 is used as the reference weight of the boundary range in the initial field of view range.

[0075] Furthermore, if a hole exists in multiple initial field-of-view ranges, the fusion is performed based on the reference weights of the boundary ranges where the center of the hole is located in each initial field-of-view range; if a hole exists only in one initial field-of-view range, the hole is directly used as the hole in the comprehensive field-of-view range; the comprehensive field-of-view range is obtained by fusing the reference weights of the hole and the boundary ranges of each initial field-of-view range; it should be noted that the image fusion uses existing technology, which will not be described in detail in this embodiment.

[0076] Thus, by stretching the performance of each aperture position within the initial field of view and combining their distribution relationship near the boundary of the initial field of view, the edge distortion factor of the boundary range of the initial field of view is quantified to reflect the impact of edge distortion on the visual performance of the aperture position within each initial field of view. Based on the weighting of the edge distortion factor, multiple initial fields of view are fused based on the aperture position to obtain the comprehensive field of view and the aperture positions within it, providing a foundation for subsequent aperture position distribution and classification analysis based on the comprehensive field of view.

[0077] Step S003: Based on the size and clustering distribution of apertures in the comprehensive field of view, divide the field of view into several aperture distribution areas and obtain the optimal positioning parameters for each aperture distribution area; combine the process of adjusting the field of view parameters to the optimal positioning parameters for each aperture distribution area and the camera movement process to obtain the final positioning parameters for each aperture distribution area.

[0078] It should be noted that the comprehensive field of view is considered as a complete PCB board image of complex hole layout. Therefore, it is necessary to classify and locate the holes in the complex hole layout. Holes of the same type are similar in shape and size. Due to the array distribution, some types of holes will be clustered together. Therefore, the holes are classified based on their size, the distribution distance between sizes, and their shape. Cluster analysis is used to determine the types of holes. Furthermore, the holes that are distributed close together are fused to obtain the distribution area of ​​each hole, reflecting the clustered distribution of the same type of holes. Based on the hole size, the field of view parameters of each hole distribution area, i.e., the optimal positioning parameters, are adaptively obtained.

[0079] Preferably, in one embodiment of the present invention, based on the aperture size and clustering distribution within the comprehensive field of view, several aperture distribution regions are divided and the optimal positioning parameters for each aperture distribution region are obtained. The specific method includes:

[0080] Obtain the center of each aperture position within the comprehensive field of view, along with the diameter of its smallest circumcircle. Obtain the distance between the centers of any two aperture positions within the comprehensive field of view. Use the ratio of the area of ​​any aperture position within the comprehensive field of view to the area of ​​its smallest circumcircle as the circularity regularity of that aperture position. Define twice the diameter of the smallest circumcircle of that aperture position as its neighboring range. Define aperture positions whose distance from the center of that aperture position is less than this neighboring range as its neighboring aperture positions. The method for calculating the neighboring distance s of that aperture position is as follows:

[0081]

[0082] Where M represents the number of adjacent holes at this hole location, l m p represents the distance between the center of the hole and its m-th neighboring hole, p0 represents the diameter of the smallest circumcircle of the hole, p m This represents the diameter of the smallest circumcircle of the m-th neighboring hole position. || represents the absolute value function, and exp() represents the exponential function with the natural constant as the base. In this embodiment, the exp(-x) model is used to present the inverse proportional relationship and normalization processing. x is the input of the model. The implementer can set the inverse proportional function and normalization function according to the actual situation.

[0083] Furthermore, a three-dimensional sample space is constructed based on the circularity regularity, proximity distance, and diameter of the smallest circumcircle of each aperture position within the comprehensive field of view. Each aperture position is mapped into the three-dimensional sample space according to its circularity regularity, proximity distance, and diameter of the smallest circumcircle, thus obtaining the sample points corresponding to each aperture position in the three-dimensional sample space. DBSCAN clustering is performed on all sample points, and the Euclidean distance between sample points is used as the distance metric, resulting in several clusters, which are denoted as several aperture position clusters.

[0084] Furthermore, for several holes in the same hole position cluster, the diameter of the smallest circumcircle of all holes in the hole position cluster is taken as the hole position diameter of the hole position cluster; if the distance between the centers of two holes is less than or equal to the hole position diameter of their respective hole position clusters, the two holes are assigned to the same distribution area. By continuously judging the distance between the centers of holes in the same hole position cluster and the hole position diameter, several distribution areas of the hole position cluster are obtained; and several distribution areas of each hole position cluster are taken as several hole position distribution areas of the comprehensive field of view.

[0085] Furthermore, for any given hole distribution area, the diameter of the hole cluster corresponding to that distribution area is obtained and compared with the diameters of various types of holes during PCB board positioning. The diameter of the hole type with the smallest absolute difference from the given diameter is taken as the standard diameter of that hole distribution area (fixed field-of-view parameters are used for precise positioning of each type of hole in PCB board positioning). The field-of-view parameter corresponding to the standard diameter is taken as the optimal field-of-view parameter for that hole distribution area, and the area of ​​the field of view of the optimal field-of-view parameter is obtained. Then, the degree of preference F of the q-th field-of-view parameter of that hole distribution area is determined. q The calculation method is as follows:

[0086]

[0087] Where, k q Let kq represent the q-th field-of-view parameter of the aperture location distribution area, k0 represent the optimal field-of-view parameter of the aperture location distribution area, and S represent the area of ​​the aperture location distribution area. q S0 represents the area of ​​the field of view of the qth field of view parameter in the aperture distribution area, S0 represents the area of ​​the field of view of the optimal field of view parameter in the aperture distribution area, || represents the absolute value function, exp() represents the exponential function with the natural constant as the base, and this embodiment uses the exp(-x) model to present the inverse proportional relationship and normalization processing, where x is the input of the model. The implementer can set the inverse proportional function and the normalization function according to the actual situation.

[0088] Furthermore, by adjusting the field of view parameters, i.e. the optimal field of view parameters, the area of ​​the field of view range is continuously increased. When the degree of preference of the field of view parameters decreases for the first time, the field of view parameters corresponding to the previous adjustment are taken as the optimal positioning parameters for the hole distribution area.

[0089] It should be noted that the optimal field of view parameter is applicable to the location of a single hole in the hole distribution area. However, the hole distribution area usually contains multiple holes of the same type clustered together. Therefore, it is necessary to adjust the optimal field of view parameter to increase the field of view range so that more holes can be located. At the same time, the increased field of view parameter needs to ensure that the difference from the optimal field of view parameter is small enough to avoid excessive adjustment that may cause deviation in the location of the hole.

[0090] It should be further noted that during the multiple rapid positioning processes of the entire PCB board with complex hole layouts, the number of camera calibrations and the moving distance need to be considered. At the same time, the number of adjustments to the field of view parameters needs to be minimized. That is, the camera needs to quickly calibrate multiple hole distribution areas based on the optimal positioning parameters with a small number of field of view parameter adjustments, reducing the moving distance and minimizing the adjustment process of the field of view parameters, so as to determine the final positioning parameters of each hole distribution area.

[0091] Preferably, in one embodiment of the present invention, the final positioning parameters for each aperture distribution area are obtained by combining the process of adjusting the field of view parameters to the optimal positioning parameters for each aperture distribution area and the camera movement process. The specific method includes:

[0092] For any two hole distribution areas, the minimum distance between the edge pixels of each hole distribution area is taken as the distance between the two hole distribution areas. If the two hole distribution areas overlap, the distance between the two hole distribution areas is 0. Taking the hole distribution area at the upper left corner of the comprehensive field of view as the starting hole distribution area, the optimal positioning parameters of the starting hole distribution area are taken as its final positioning parameters.

[0093] Furthermore, the aperture distribution region with the smallest distance from the initial aperture distribution region is selected as the next aperture distribution region to be located. Then, the optimization factor F of the v-th field parameter of the next aperture distribution region is determined. v ′ (1) is calculated as follows:

[0094]

[0095] Among them, F v (1) represents the degree of preference of the v-th field parameter of the aperture distribution area for the next positioning, k ′ (0) represents the final positioning parameter of the initial borehole distribution area, k ′(1) represents the optimal positioning parameters for the next positioning hole distribution area, k. ′ v (1) represents the v-th field parameter of the aperture distribution area for the next positioning, and || represents the absolute value function.

[0096] Furthermore, for the optimal positioning parameters of the next positioning hole distribution area, they are adjusted towards the final positioning parameters of the initial hole distribution area. That is, if the final positioning parameters of the initial hole distribution area are greater than the optimal positioning parameters of the next positioning hole distribution area, they are adjusted to be larger; if they are less, they are adjusted to be smaller; if they are equal, no adjustment is needed, and the optimal positioning parameters are directly determined as the final positioning parameters. During the adjustment process, when the optimization factor decreases for the first time, the field of view parameters corresponding to the previous adjustment are used as the final positioning parameters of the next positioning hole distribution area.

[0097] It should be noted that, based on the optimization level, it is necessary to further ensure that the field of view parameters are adjusted to be sufficiently small during the positioning process in the nearest hole distribution area, so as to obtain the optimization factor and the final positioning parameters.

[0098] Furthermore, following this principle, after the final positioning parameters of the next positioning hole distribution area are determined, the nearest hole distribution area to the next positioning hole distribution area is obtained. Hole distribution areas whose final positioning parameters have already been determined are not obtained again. The final positioning parameters are obtained for each hole distribution area according to the above method. That is, based on the final positioning parameters of the determined hole distribution areas, the optimal positioning parameters of the undetermined hole distribution areas are adjusted to finally obtain the final positioning parameters of each hole distribution area.

[0099] Thus, by analyzing the morphology, size, and distribution of apertures within the comprehensive field of view, aperture clusters are obtained and their distribution areas are divided. By referencing and adjusting the field of view parameters during the positioning process of each type of aperture, the optimal positioning parameters for the aperture distribution area are determined. Furthermore, by combining the camera's rapid positioning movement process and the field of view parameter adjustment process, the optimal positioning parameters are further adjusted to obtain the final positioning parameters.

[0100] Step S004: Based on the final positioning parameters of each hole location distribution area, quickly locate each hole location distribution area by adjusting the field of view parameters of the camera.

[0101] Specifically, after obtaining the final positioning parameters of each hole distribution area, starting from the hole distribution area at the upper left corner of the PCB board with a complex hole layout, the holes in the hole distribution area are located based on their final positioning parameters. After positioning, the system moves to the hole distribution area closest to the original hole distribution area and adjusts it to the corresponding final positioning parameters to locate the holes therein. This process is repeated, moving to the nearest hole distribution area and adjusting it to the corresponding final positioning parameters to traverse and locate all hole distribution areas, thus achieving rapid visual positioning of the PCB board with a complex hole layout. It should be noted that this embodiment starts positioning from the upper left corner of the overall field of view. In other embodiments, the starting position is not limited. Based on the hole distribution area corresponding to the starting position, the final positioning parameters are obtained for each hole distribution area, and the processing visual positioning of the PCB board with a complex hole layout is finally completed.

[0102] Thus, by eliminating distortion of the holes at the edge of the initial field of view, the overall field of view is obtained by fusing the initial field of view. Based on the hole shape, size, and distribution relationship, the hole distribution area is obtained and the positioning parameters are analyzed to ensure that the degree and number of camera adjustments to the field of view parameters are minimized. This ensures rapid positioning of holes in PCBs with complex hole layouts during processing, thereby improving the processing efficiency of PCBs with computer vision assistance.

[0103] Another embodiment of the present invention provides a visual positioning system for PCB printed circuit board processing. The system includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the above-described method steps S001 to S004.

[0104] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A visual positioning method for PCB printed circuit board processing, characterized in that, The method includes the following steps: Obtain several initial field-of-view ranges for PCBs with complex hole layouts; Analyze the morphological characteristics of each aperture position in each initial field of view and its distribution relationship with the boundary of the initial field of view to determine the edge distortion factor of each boundary range of each initial field of view. The analysis of the morphological characteristics of each aperture position within each initial field of view and its distribution relationship with the boundary of the initial field of view, and the determination of the edge distortion factor of each boundary range of each initial field of view, includes the following specific methods: Based on the changes in the shape of each aperture position relative to a circle within the same initial field of view, and the distribution position of the center of each aperture position, the degree of morphological distortion of each aperture position within the initial field of view is obtained. Each straight line parallel to the boundary of the field of view within any initial field of view is taken as a boundary range of the initial field of view, thus obtaining a number of lateral and longitudinal boundary ranges of the initial field of view. For the horizontal direction within this initial field of view The boundary range is defined to obtain the center of each aperture position within the initial field of view and the first... The distance of the boundary range, the horizontal first Edge distortion factor of the boundary range The calculation method is as follows: in, This indicates the number of apertures within the initial field of view. This represents the distance between the two lateral boundaries of the initial field of view. This indicates the horizontal first position within the initial field of view. The minimum distance between the boundary range and the two lateral boundaries. This indicates the first [unit] in the initial field of view. The center of each hole and The distance between the corresponding horizontal boundaries, This indicates the first [unit] in the initial field of view. The degree of morphological distortion of each aperture. Represents the absolute value function; Based on the edge distortion factor of the boundary range, the initial field of view ranges are fused to obtain the comprehensive field of view range; Based on the size and clustering distribution of apertures within the overall field of view, several aperture distribution areas are divided and the optimal positioning parameters for each aperture distribution area are obtained. By combining the process of adjusting the field of view parameters to the optimal positioning parameters for each aperture distribution area and the camera movement process, the final positioning parameters for each aperture distribution area are obtained. Based on the final positioning parameters of each hole location distribution area, the camera's field of view parameters are adjusted to quickly locate each hole location distribution area.

2. The visual positioning method for PCB printed circuit board processing according to claim 1, characterized in that, The specific method for obtaining the degree of morphological distortion of each aperture position in the initial field of view includes: For any aperture position within any initial field of view, obtain the center of the aperture position, as well as the center of its minimum bounding rectangle and minimum bounding circle; Obtain the distance between two intersection points of any straight line passing through the center of the hole and the edge of the hole, take this straight line as a radial straight line of the hole, and take the distance as the radial length of the radial straight line, thus obtaining several radial straight lines of the hole and their radial lengths. The first in the initial field of view Degree of morphological distortion of each pore The calculation method is as follows: in, Indicates the first The length of the shorter side in the smallest bounding rectangle of each hole position. Indicates the first The minimum radial length of all radial straight lines at each hole position. Indicates the first The maximum radial length of all radial straight lines at each hole position. Indicates the first The distance between the center of each hole and the center of its smallest circumcircle.

3. The visual positioning method for PCB printed circuit board processing according to claim 2, characterized in that, The specific method for fusing the initial field of view ranges to obtain the comprehensive field of view range includes: If the edge distortion factor of any boundary range in any initial field of view is greater than or equal to the reference threshold, several apertures whose centers are located on the boundary range in the initial field of view will not participate in the fusion. If the edge distortion factor of any boundary range in any initial field of view is less than the reference threshold, the difference obtained by subtracting the edge distortion factor of that boundary range from 1 is used as the reference weight of that boundary range in the initial field of view. If a hole exists in multiple initial fields of view, the fields of view are fused based on the reference weights of the boundary ranges where the center of the hole is located in each initial field of view. If a hole exists in only one initial field of view, the hole is directly used as the hole in the composite field of view. The composite field of view is obtained by fusing the reference weights of the hole and the boundary ranges of the initial fields of view.

4. The visual positioning method for PCB printed circuit board processing according to claim 1, characterized in that, The specific method for dividing the distribution area of ​​several pore positions is as follows: Obtain the center of each aperture position and its minimum circumcircle and diameter within the comprehensive field of view; obtain the distance between the centers of any two aperture positions within the comprehensive field of view; based on the distance between the centers of the aperture positions and their minimum circumcircles, obtain several aperture position clusters through cluster analysis. For several holes in the same hole location cluster, the diameter of the smallest circumcircle of all holes in the hole location cluster is taken as the hole location diameter of the hole location cluster. If the distance between the centers of two holes is less than or equal to the hole location diameter of their respective hole location clusters, the two holes are assigned to the same distribution area. By continuously judging the distance between the centers of holes in the same hole location cluster and the hole location diameter, several distribution areas of the hole location cluster are obtained. Several distribution areas of each pore cluster are taken as several pore distribution areas of the comprehensive field of view.

5. The visual positioning method for PCB printed circuit board processing according to claim 4, characterized in that, Based on the distance between the centers of the pores and their minimum circumcircle, several pore clusters are obtained through cluster analysis, including the following specific methods: The ratio of the area of ​​any aperture position within the overall field of view to the area of ​​its smallest circumcircle is taken as the circularity regularity of that aperture position. Using twice the diameter of the smallest circumcircle of the hole as the vicinity range, and considering holes whose distance from the center of the hole is less than this vicinity range as neighboring holes, the vicinity distance of the hole is then determined. The calculation method is as follows: in, This indicates the number of adjacent holes to this hole. This indicates that the hole position is related to its first... The distance between the centers of adjacent apertures This indicates the diameter of the smallest circumcircle of the hole. This indicates the first hole position. The diameter of the smallest circumcircle of the nearest hole. Represents the absolute value function. Represents an exponential function with the natural constant as its base; A three-dimensional sample space is constructed based on the circularity, proximity distance, and diameter of the smallest circumcircle of each hole position within the comprehensive field of view. Each hole position is then mapped into the three-dimensional sample space according to its circularity, proximity distance, and diameter of the smallest circumcircle, thus obtaining the sample points corresponding to each hole position in the three-dimensional sample space. Density clustering is performed on all sample points, and the distance metric is the Euclidean distance between sample points, resulting in several clusters, which are denoted as several pore clusters.

6. The visual positioning method for PCB printed circuit board processing according to claim 4, characterized in that, The optimal positioning parameters for each hole location distribution area are obtained using the following method: For any given hole distribution area, obtain the hole diameter of the corresponding hole cluster and compare it with the diameters of various hole types during PCB positioning. Take the diameter of the hole type with the smallest absolute difference from the given hole diameter as the standard diameter for that hole distribution area. Use the field of view parameter corresponding to the standard diameter as the optimal field of view parameter for that hole distribution area, and obtain the area of ​​the field of view range of the optimal field of view parameter. The first hole distribution area... Degree of optimization of each field of view parameter The calculation method is as follows: in, This indicates the first [hole location] distribution area. One field of view parameter, This indicates the optimal field-of-view parameters for the aperture distribution area. This represents the area of ​​the region where the boreholes are located. This indicates the first [hole location] distribution area. The area of ​​the field of view for each field of view parameter. The area representing the field of view range of the optimal field of view parameters for this aperture distribution region. Represents the absolute value function. Represents an exponential function with the natural constant as its base; By adjusting the optimal field of view parameters, the area of ​​the field of view is continuously increased. When the degree of preference of the field of view parameters decreases for the first time, the field of view parameters corresponding to the previous adjustment are taken as the optimal positioning parameters for the hole distribution area.

7. The visual positioning method for PCB printed circuit board processing according to claim 6, characterized in that, The specific method for obtaining the final positioning parameters of each hole location distribution area is as follows: For any two aperture distribution regions, the minimum distance between the edge pixels of each aperture distribution region is taken as the distance between the two aperture distribution regions; taking the aperture distribution region at the upper left corner of the comprehensive field of view as the starting aperture distribution region, the optimal positioning parameters of the starting aperture distribution region are taken as its final positioning parameters. The aperture distribution area with the smallest distance from the initial aperture distribution area is obtained as the next aperture distribution area to be located. Based on the optimal positioning parameters and the best field of view parameters of the next aperture distribution area, the optimization factors of each field of view parameter of the next aperture distribution area are obtained. For the optimal positioning parameters of the next positioning hole distribution area, adjust them to the final positioning parameters of the initial hole distribution area; when the optimization factor decreases for the first time during the adjustment process, use the field of view parameter corresponding to the previous adjustment as the final positioning parameter of the next positioning hole distribution area. By analogy, after the final positioning parameters of the next positioning hole distribution area are determined, the nearest hole distribution area to the next positioning hole distribution area is obtained, and the final positioning parameters are obtained for each hole distribution area, so as to obtain the final positioning parameters of each hole distribution area.

8. The visual positioning method for PCB printed circuit board processing according to claim 7, characterized in that, The specific method for obtaining the optimal factors for each field of view parameter of the next positioning aperture distribution region includes: in, This indicates the first hole location distribution area for the next positioning. The optimal factors for each field of view parameter. This indicates the first hole location distribution area for the next positioning. The degree of optimization of each field of view parameter The final positioning parameters represent the initial hole location distribution area. This represents the optimal positioning parameters for the next positioning hole distribution area. This indicates the first hole location distribution area for the next positioning. One field of view parameter, This represents the absolute value function.

9. A visual positioning system for PCB (Printed Circuit Board) processing, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the visual positioning method for PCB printed circuit board processing as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Vision-based automatic accurate positioning method and device for PCB (printed circuit board)

    CN115661266A

  • Optical monitoring device

    US20230073702A1