Positioning method for PCB processing based on image processing
By constructing a sampling area to calculate radial structural contrast and gradient intersection voting, and screening peak points to calculate candidate scores, the problem that the Hough circle transform cannot distinguish between reference points and interference objects in PCB circuit board positioning is solved, thereby improving positioning accuracy and reliability.
Patent Information
- Application Number
- CN202511299431.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-09-12
AI Technical Summary
In the prior art, the Hough circle transform cannot effectively distinguish between real reference points and interference objects with similar geometric shapes when positioning PCB circuit boards, resulting in insufficient positioning accuracy and reliability.
The radial structural contrast is calculated by constructing a sampling area, and the edge point pairs are screened by combining the gradient direction and angle. The gradient intersection voting is used to form a gradient convergence field, and the peak points are screened and the candidate scores are calculated to identify the center of the reference point.
It achieves accurate identification of real reference points, improves positioning accuracy and reliability in PCB automated processing, and effectively eliminates the influence of interference.
Smart Images

Figure CN120807644A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing. More particularly, the present application relates to a positioning method for PCB circuit board processing based on image processing. BACKGROUND
[0002] In modern electronic manufacturing industry, printed circuit board (PCB) is the cornerstone of carrying electronic components and connecting circuits. In the automatic processing flow of PCB circuit board, such as surface mount (SMT), automatic optical inspection (AOI), drilling and flying probe test, etc., it is necessary to quickly and accurately position the PCB circuit board through a machine vision system, which is usually achieved by recognizing the pre-set fiducial mark (Fiducial Mark) on the PCB circuit board. The fiducial mark is generally a standard circular pattern with high contrast.
[0003] Hough circle transformation can effectively detect circular features in an image by mapping edge points in the image space to the parameter space for voting. It has a certain robustness to the partial occlusion or incompleteness of the circular edge. Currently, Hough circle transformation is commonly used for positioning the fiducial mark in the PCB circuit board.
[0004] However, Hough transformation is a kind of isolated shape analysis method, which only votes for edge pixel points that meet the geometric constraints of the circle. In the voting process, all edge pixel points are treated equally, which makes it impossible to distinguish the true positioning target (fiducial mark) from a large number of interference objects on the PCB circuit board, such as circular pads, vias, etc., which have extremely similar geometric shapes. This may cause the processing equipment to be positioned at the wrong position, affecting the accuracy and reliability of the PCB circuit board processing.
[0005] Therefore, there is an urgent need for a positioning method for PCB circuit board processing based on image processing. SUMMARY
[0006] To solve the technical problem of poor positioning accuracy caused by relying only on geometric features in the above-mentioned traditional method, the present application provides a positioning method for PCB circuit board processing based on image processing, comprising: edge pixel points are extracted by performing edge detection on the gray-scale image of the PCB circuit board; two sampling regions are constructed along the gradient direction and the opposite direction of the edge pixel points, and the radial structure contrast of the edge pixel points is determined according to the gray-scale mean difference of the two sampling regions and the variance of each sampling region; the included angle between the gradient directions is not equal to 90 degrees, and the included angle between the gradient directions is not equal to 180 degrees. and Any two edge pixel points constitute an edge point pair, and the intersection of the gradient extension lines of the two edge pixel points is used as the gradient intersection of the edge point pair. Votes are cast for the gradient intersection according to the angle between the gradient directions of the edge pixel points in the edge point pair and the radial structural contrast of the edge pixel points. The voting values at the same position in the grayscale image are accumulated to obtain the gradient convergence strength, and the gradient convergence strengths of all positions constitute a gradient convergence field. Peak points are screened in the gradient convergence field as candidate center points, and associated edge pixel points of the candidate center points are obtained. The associated edge pixel points are divided into two categories. The candidate scores of the candidate center points are determined according to the gradient convergence strength of the candidate center points, the standard deviation of the distances from each category of associated edge pixel points to the candidate center points, and the mean radial structural contrast of all associated edge pixel points. The center of the reference point is determined according to the size of the candidate scores to achieve PCB circuit board positioning.
[0007] The present invention constructs a sampling area along the gradient direction and the reverse direction and calculates the radial structural contrast. The grayscale mean difference is used to reflect the material difference inside and outside the edge, and the variance is used to reflect the uniformity of the sampling area, so that the radial structural contrast can distinguish between the real reference point and the interference object with similar geometric shape. The present invention uses the intersection of the edge point and the gradient extension line as the voting target, and combines the gradient angle and the radial structural contrast voting. The center of the real reference point can form a high gradient convergence intensity due to the voting of a large number of high-quality, geometrically consistent point pairs, and the interference position has no significant peak due to the scattered voting. The present invention selects the peak point of the gradient convergence field as the candidate point of the center of the circle, and calculates the candidate score by combining the gradient convergence intensity, the standard deviation of the distance from each type of associated edge pixel point to the candidate point of the center of the circle, and the structural contrast mean of the associated edge pixel points. This achieves accurate identification of the real reference point, enables the machine vision system to intelligently distinguish interference objects with different functions but the same appearance, and improves the positioning accuracy and reliability in PCB automated processing.
[0008] Preferably, the two sampling areas are both rectangular areas of 3×5 pixels, and the edge pixels are located on the extension line of the line connecting the midpoints of the two short sides of the rectangle.
[0009] Preferably, the radial structural contrast satisfies the expression: Where, Indicates edge pixels Radial structure contrast; Indicates edge pixels The first sampling area The mean of the grayscale values of all pixels in ; Indicates edge pixels The second sampling area The mean of the grayscale values of all pixels in ; Indicates edge pixels a first sampling region of the edge point pair a variance of the gray values of all the pixel points in the second sampling region an edge pixel point a second sampling region of the edge point pair a variance of the gray values of all the pixel points in the second sampling region an absolute value symbol normalization
[0010] Preferably, the voting of the gradient intersection point according to the included angle between the gradient directions of the edge pixel points in the edge point pair and the radial structure contrast of the edge pixel points comprises: the voting value of the voting of the gradient intersection point satisfies an expression: ; in the expression, an edge point pair a voting value of the corresponding gradient intersection point an edge pixel point a radial structure contrast of the edge pixel point an edge pixel point a radial structure contrast of the edge pixel point an edge pixel point an included angle between the gradient directions of the edge pixel point and the edge pixel point an included angle between the gradient directions of the edge pixel point and the edge pixel point an angle weight
[0011] The application utilizes the geometric characteristics that the gradient directions of the antipodal points on a real circular edge are opposite, ensures that only the edge point pairs that are geometrically consistent with the antipodal point features can contribute high-weight voting through the angle weight function, and combines the radial structure contrast to evaluate the physical characteristics of the edge points, so that the fiducial edge with uniform material inside and outside the edge obtains high confidence, the interference edge such as the solder pad and the via connected with the trace obtains low confidence, the center position of the real fiducial point forms a significant peak value due to the high-weight and high-confidence voting, and the interference object has dispersed and low-intensity voting due to the lack of geometric and physical consistency, so that the accurate positioning of the fiducial point is realized, and the positioning reliability of the PCB is improved.
[0012] Preferably, the angle weight satisfies an expression: ; in the expression, a standard deviation parameter
[0013] Preferably, the screening of the peak points in the gradient convergence field as the center candidate points comprises: obtaining the peak points with the maximum gradient convergence strength in the gradient convergence field as the center candidate points; wherein the gradient convergence strength of the peak point is greater than all the points in the 8-neighborhood of the peak point, the local maximum value detection algorithm is adopted to obtain is a preset number of peak points.
[0014] Preferably, the associated edge pixel point of the circle center candidate point is obtained, and the associated edge pixel point is divided into two categories, including: for the circle center candidate point , if the gradient intersection point of the edge point pair falls within a circle with the circle center and the radius , the edge pixel point and the edge pixel point are taken as the associated edge pixel point of the circle center candidate point ; all the associated edge pixel points are clustered into two categories according to the distance from each associated edge pixel point to the circle center candidate point , wherein is a preset radius threshold.
[0015] The present application can capture the edge pixel points constituting the potential circle by setting the radius threshold, taking the edge pixel points in all the edge point pairs contributing to the circle center candidate point as the associated edge pixel points of the circle center candidate point, excluding the interference edge pixel points irrelevant to the current circle center candidate point, providing a data basis for the subsequent candidate score calculation, and improving the high precision and high reliability of the PCB reference point positioning; the present application can effectively identify the double-ring structure feature of the reference point by clustering the associated edge pixel points into two categories, providing a basis for the subsequent candidate score calculation.
[0016] Preferably, the candidate score of the circle center candidate point satisfies the expression: ; In the expression, denotes the candidate score of the circle center candidate point ; denotes the gradient convergence strength of the circle center candidate point ; denotes the set of associated edge pixel points of the circle center candidate point ; denotes the average value of the radial structure contrast of all the associated edge pixel points of the circle center candidate point ; denotes the standard deviation of the distance from the first type of associated edge pixel point to the circle center candidate point ; denotes the standard deviation of the distance from the second type of associated edge pixel point to the circle center candidate point ; denotes the normalization.
[0017] The present invention takes into account that the real reference point forms a significant peak in the gradient convergence field and has a concentric double ring structure in the image, so that the distances from the associated edge pixels of the same category to the center of the circle are highly consistent. At the same time, the edge pixels have structural characteristics that conform to the physical properties of the reference points. Therefore, the gradient convergence intensity, the standard deviation of the distance from each category of associated edge pixels to the candidate center point, and the mean structural contrast of the associated edge pixels are combined to obtain the candidate score of the candidate center point. The candidate score can be used to effectively exclude interference objects that only meet some conditions, thereby improving the accuracy of reference point positioning.
[0018] Preferably, the determination of the center of the reference point according to the size of the candidate score includes: The center candidate point of the circle is used as a valid reference point; in response to the absence of a valid reference point, a positioning failure result is output and a prompt is given to re-collect the PCB circuit board image; in response to the insufficient number of valid reference points In response to the number of valid reference points being greater than or equal to The candidate with the highest score Valid reference points as The center of the circle is a reference point, The preset number of reference points.
[0019] The present invention screens reference points by candidate scores, which can eliminate low-quality candidate points caused by noise, interference or poor image quality, achieve accurate identification of real reference points, and improve positioning accuracy and reliability in PCB automated processing.
[0020] Preferably, it further includes: setting the angle between the gradient directions to be not equal to and is not equal to , and any two edge pixel points whose spatial distance is less than the distance threshold constitute an edge point pair.
[0021] The beneficial effects of the present application are that the present application constructs a sampling area along the gradient direction of the edge pixel point, and calculates the radial structure contrast combined with the gray mean difference and variance, which can accurately distinguish the real reference point and the interference; the present application uses the characteristic that the opposite gradient directions of the circular pair of points, filters the geometric consistent edge point pairs through the Gaussian angle weight function, calculates the voting value combined with the radial structure contrast, forms the gradient convergence field, makes the real reference point circle center form a significant peak value due to the high weight and high confidence voting, filters the peak point as the circle center candidate point, calculates the multi-dimensional candidate score combined with the gradient convergence intensity, the standard deviation of the distance of each type of associated edge pixel point to the circle center candidate point, and the structure contrast mean value of all associated edge pixel points, filters the reference point according to the candidate score, can exclude low-quality candidate points and pseudo-reference points, realizes the accurate identification of the real reference point, and improves the positioning accuracy and reliability in the automatic processing of the PCB. BRIEF DESCRIPTION OF DRAWINGS
[0022] Figure 1 is a flow chart schematically showing a positioning method for PCB circuit board processing based on image processing in the present application; Figure 2 is a RGB image of a PCB circuit board schematically shown; Figure 3 is a gray image of a PCB circuit board schematically shown; Figure 4 is an edge image of a PCB circuit board schematically shown; Figure 5 is a schematic diagram of a first sampling area and a second sampling area; Figure 6 is a detection result of an effective reference point schematically shown. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0024] The specific embodiments of the present application will be described in detail below with reference to the drawings.
[0025] The embodiments of the present application disclose a positioning method for PCB circuit board processing based on image processing, referring to Figure 1 , including steps S1 to S5: S1, collecting the gray image of the PCB circuit board, performing edge detection on the gray image to extract the edge pixel point.
[0026] A high-resolution industrial camera captures images of the PCB circuit board and converts them into grayscale to obtain a grayscale image of the PCB circuit board. The Canny edge detection algorithm is used to detect edges in the grayscale image and obtain all edge pixels in the grayscale image. Figure 2 is the RGB image of the PCB circuit board, Figure 3 is the grayscale image of the PCB circuit board, Figure 4 is the edge image.
[0027] It should be noted that the Canny edge detection algorithm can effectively extract continuous edges through non-maximum suppression and double threshold processing. In PCB circuit board images, circular structures such as reference points, pads, and vias will produce clear edges, but these edges are very similar in geometry and difficult to distinguish based solely on edge position information. Considering that the gradient direction of edge pixels is perpendicular to the edge direction, for an ideal circular edge, its gradient direction should point toward or away from the center of the circle. Therefore, for each edge pixel, the present invention records the gradient direction obtained during the Canny edge detection process.
[0028] S2. Construct a first sampling area and a second sampling area for edge pixels along the gradient direction and the opposite direction of the gradient direction of the edge pixels, and determine the radial structural contrast of the edge pixels based on the grayscale mean difference and standard deviation between the first sampling area and the second sampling area.
[0029] Specifically, for each edge pixel, a first sampling area is defined along the gradient direction of the edge pixel. , define a second sampling area along the opposite direction of the gradient direction of the edge pixel point In the present invention, the first sampling area and the second sampling area are The pixel-sized rectangular area is located on the extension line of the line connecting the midpoints of the two short sides of the rectangular area, ensuring that the first sampling area covers the inside and outside of the edge along the gradient direction. For example, Figure 5 Schematic diagram of the first sampling area and the second sampling area. Figure 5 The middle curve represents the edge, P is an edge pixel on the edge, Figure 5 The direction indicated by the arrow in the middle is the gradient direction of the edge pixel point P. is the first sampling area of pixel point P, is the second sampling area of pixel point P.
[0030] It's important to note that the size of the first and second sampling areas must strike a balance between capturing local features and suppressing noise. If the first or second sampling areas are too small, they will struggle to capture local texture features. If they are too large, they may contain excessive irrelevant information, reducing feature differentiation. During PCB positioning, since the fiducial size is typically 1-2 mm, corresponding to approximately 20-40 pixels in the image, a 5-pixel length is sufficient to capture the differences in features inside and outside the fiducial.
[0031] Furthermore, the radial structural contrast of the edge pixels is determined according to the grayscale values of all pixels in the first sampling area and the grayscale values of all pixels in the second sampling area:
[0032] Where, Indicates edge pixels Radial structure contrast; represents the first sampling area; Indicates edge pixels The second sampling area; Indicates edge pixels A set consisting of the grayscale values of all pixels in the first sampling area; Indicates edge pixels A set consisting of the grayscale values of all pixels in the second sampling area; represents the mean function, Indicates edge pixels The mean of the grayscale values of all pixels in the first sampling area, Indicates edge pixels The mean of the grayscale values of all pixels in the second sampling area; represents the variance function, Indicates edge pixels The variance of the grayscale values of all pixels in the first sampling area is Indicates edge pixels The variance of the grayscale values of all pixels in the second sampling area; Indicates the absolute value symbol; In terms of normalization, the present invention adopts linear normalization, and implementers can also select a normalization algorithm according to actual implementation conditions.
[0033] Where, Indicates the grayscale mean difference between the inner and outer areas of the edge where the edge pixel is located. The real reference point is a double-ring structure. The outer side of the outer ring is green solder mask ink, the middle of the outer and inner rings is a black mark area, and the inner ring is copper foil. When the edge pixel point belongs to the edge of the outer ring of the real fiducial point, the inner and outer regions of the edge of the outer ring are a black mark region and a green solder resist ink respectively, the gray mean value difference between the black mark region and the green solder resist ink is large, so that the gray mean value difference between the first sampling region and the second sampling region is large , the gray distribution of the black mark region and the green solder resist ink is uniform, so that the variances and are both small, and then the radial structure contrast is large; when the edge pixel point belongs to the edge of the inner ring of the real fiducial point, the inner and outer regions of the edge of the inner ring are a copper foil and a black mark region respectively, the gray mean value difference between the copper foil and the black mark region is large, so that the gray mean value difference between the first sampling region and the second sampling region is large , the gray distribution of the copper foil and the black mark region is uniform, so that the variances and are both small, and then the radial structure contrast is large. The pad is a single metal region, when the edge pixel point belongs to the pad connected with the trace, the inner region of the edge where the edge pixel point is located is uniform, but the outer region is complex in texture due to the inclusion of the trace, so that one of the variances and is small and the other is large, so that is large, so that the value of the radial structure contrast of the edge pixel point of the pad is suppressed and is smaller than that of the edge pixel point of the fiducial point. The via is a metalized hole on the PCB circuit board for connecting electrical circuits between different layers, which has a double-ring structure, the outer side of the outer ring is green solder resist ink, the middle of the outer ring and the inner ring is metal, and the inner part of the inner ring is a hole, when the edge pixel point belongs to the edge of the outer ring of the via, the inner and outer regions of the edge of the outer ring are green solder resist ink and metal respectively, the gray mean value difference between the green solder resist ink and the metal is large, so that the gray mean value difference between the first sampling region and the second sampling region is large , the gray distribution of the green solder resist ink and the metal is uniform, so that the variances and are both small, and then the radial structure contrast is large; when the edge pixel point belongs to the edge of the inner ring of the via, the outer region of the edge of the inner ring is metal and the gray distribution is uniform, and the inner region is a hole, which may have shadows, irregular reflections, etc., so that one of the variances and is small and the other is large, so that The radial structure contrast of the edge pixel points of the inner ring of the via is small , and is smaller than the radial structure contrast of the edge pixel points of the reference point. When the edge pixel points belong to pseudo-edges composed of random noise, the gray scale distribution of the regions on both sides of the edge where the edge pixel points are located is chaotic, and the difference between the mean values of the gray scales may be small, while the variances and are large, so that the radial structure contrast is small.
[0034] S3, any two edge pixel points with an included angle between the gradient directions not equal to and are used to form an edge point pair, the intersection of the gradient extension lines of the two edge pixel points is used as a gradient intersection point of the edge point pair, a vote is cast to the gradient intersection point according to the included angle between the gradient directions of the edge pixel points in the edge point pair and the radial structure contrast of the edge pixel points, and the gradient convergence strength of the same position in the gray scale image is obtained by accumulating the voting values, so that the gradient convergence strengths of all positions form a gradient convergence field.
[0035] Specifically, a two-dimensional array with the same size as the original image is initialized as the gradient convergence field, all elements of which are initialized to 0, where the gradient convergence strength at the coordinate is represented, and the larger the value is, the more likely the position is a candidate point of the center of the circle.
[0036] It should be noted that the intersection of the gradient extension lines of the two edge pixel points on the circle can indicate the position of the center of the circle. Ideally, the gradient directions of the opposite points on a complete circle should be completely opposite, with an included angle of 180°, that is, when the two edge pixel points are located at the two ends of the diameter of the circle, the gradient directions of the two edge pixel points are opposite, and the included angle between the gradient directions is close to 180°, at which time the two edge pixel points have the strongest pointing property to the center of the circle, and the intersection position is the most accurate. When the two edge pixel points in the edge point pair are located on the same side of the circle, the gradient directions of the two edge pixel points are similar, and the included angle between the gradient directions is close to 0°, at which time the intersection position may be far away from the true center of the circle, or even at infinity. In actual implementation, when the included angle between the gradient directions of the two edge pixel points is exactly 0° or 180°, the two gradient extension lines are parallel or coincide, and a unique intersection point cannot be determined. Therefore, the present application screens the edge point pair according to the included angle between the edge pixel points, and increases a voting value of the gradient intersection point of the edge point pair in the gradient convergence field GCF according to the included angle between the gradient directions of the two edge pixel points in the edge point pair and the radial structure contrast of each edge pixel point in the edge point pair, so as to locate the center of the circle.
[0037] Specifically, for any two edge pixel points, the angle between the gradient directions of the two edge pixel points is obtained, and in response to the angle not being equal to and is not equal to When , the two edge pixels form an edge point pair, and the intersection of the gradient extension lines of the two edge pixels in the edge point pair is obtained, and recorded as the gradient intersection point of the edge point pair. The gradient extension line is a straight line that extends infinitely in the direction and opposite direction of the edge pixel gradient.
[0038] Furthermore, the voting value satisfies the expression:
[0039] Where, Represents edge point pairs The voting value to the corresponding gradient intersection; Indicates edge pixels Radial structure contrast; Indicates edge pixels Radial structure contrast; Indicates edge pixels and edge pixels The angle between the gradient directions of Represents angle weight: ,in, Represents the standard deviation parameter, and in the present invention, Set to , implementation personnel can adjust according to the actual implementation situation.
[0040] It should be noted that the present invention uses the form of Gaussian function to obtain the angle weight ,when When it is close to 180°, it takes the maximum value of 1. The exponential decay of the deviation from 180° ensures that only when the two edge pixels are geometrically close to the features of the radial points can they contribute high-weight votes. For example, when the two edge pixels are located near the two ends of a diameter on a circle, The larger the The present invention uses the radial structural contrast of two edge pixel points in the edge point pair to calculate the radial structural contrast of two edge pixel points. and Added together as the structural confidence, it ensures that only edge point pairs composed of edge pixels whose physical characteristics conform to the reference point structure can cast high-value votes. For example, when both edge pixels belong to the real reference points, and are close to 1, if the angle weights of the two edge pixels are The larger the value, the The closer it is to 2, if the two edge pixels belong to interference or noise, 、 Smaller, making the voting value Will be significantly reduced.
[0041] Furthermore, for the gradient intersection of each edge point pair, the voting value of the edge point pair to its corresponding gradient intersection is accumulated to the position corresponding to the gradient intersection in the gradient convergence field. By traversing all edge point pairs that meet the calculation conditions and completing the voting value accumulation, the final gradient convergence intensity of each position is obtained. It should be noted that since the image coordinates are discrete, in actual implementation, the coordinates of the gradient intersection need to be rounded off, or bilinear interpolation is used to distribute the voting values to the four pixel points closest to the gradient intersection to improve positioning accuracy. The present invention adopts the rounding method, and the implementer can choose the coordinate rounding method according to the actual implementation situation.
[0042] It should be further explained that, in order to reduce the amount of calculation, in another embodiment, the calculation can be limited to the gradient intersections of edge point pairs whose spatial distance is less than a distance threshold and the voting values of edge point pairs toward their gradient intersections, because edge points that are too far apart are unlikely to belong to the same circle. The distance threshold can be set according to the size of the reference point, for example, set to 1.5 times the diameter of the reference point.
[0043] S4. Filter peak points in the gradient convergence field as candidate center points, obtain associated edge pixel points of the candidate center points, and divide the associated edge pixel points into two categories. Determine the candidate score of the candidate center points based on the gradient convergence strength of the candidate center points, the standard deviation of the distance from each category of associated edge pixel points to the candidate center points, and the mean radial structural contrast of all associated edge pixel points.
[0044] It should be noted that, ideally, for a real reference point, a large number of edge point pairs consisting of edge pixels belonging to the reference point will generate high-weighted votes pointing to the same center of the circle, making the gradient convergence field An obvious peak is formed at this position, and for the edge point pairs generated by interference or noise, their votes will be scattered in the gradient convergence field due to the lack of geometric consistency and physical consistency. Therefore, the present invention obtains the point that may be the center of the circle based on the peak value in the gradient convergence field.
[0045] Specifically, obtain the gradient convergence field The strongest gradient convergence Peak points are used as candidate points for the circle center, where the gradient convergence intensity of the peak point is greater than that of all points in its 8-neighborhood area, and the local maximum detection algorithm is used to obtain the points. is the number of preset peak points. In the present invention, is set to 10, and the implementer can adjust it according to the actual implementation .
[0046] Further, for each circle center candidate point , , the associated edge pixel points of the circle center candidate point are obtained: if the gradient intersection of the edge point pair falls within a circle with the circle center and the radius , then the edge pixel point and the edge pixel point are taken as the associated edge pixel points of the circle center candidate point , and the set composed of all the associated edge pixel points is denoted as . In the present application, is set to 2 pixels, and the implementer can adjust it according to the actual implementation.
[0047] It should be noted that, since the PCB reference point is a double-ring structure, the outer ring is a green solder resist ink area, the middle between the outer ring and the inner ring is a black mark area, and the inside of the inner ring is a copper foil area, forming clear concentric edges of the inner and outer rings on the image, therefore, the associated edge pixel point set of the reference point contains the edge pixel points of the outer ring and the edge pixel points of the inner ring, and therefore, the present application clusters the associated edge pixel points into two categories.
[0048] Specifically, all the associated edge pixel points of the circle center candidate point are clustered, and the associated edge pixel points are divided into two categories, and the set composed of the associated edge pixel points of each category is denoted as , . The present application adopts K-means clustering, and in other embodiments, the implementer can select a clustering algorithm according to the actual implementation.
[0049] Further, according to the gradient convergence strength of the circle center candidate point, the standard deviation of the distance of each category of associated edge pixel points to the circle center candidate point, and the average radial structure contrast of all the associated edge pixel points, the candidate score of the circle center candidate point is determined:
[0050] In the formula, denotes the candidate score of the circle center candidate point ; denotes the gradient convergence strength of the circle center candidate point ; denotes the set of associated edge pixel points of the circle center candidate point ; denotes the standard deviation of the distance of each category of associated edge pixel points to the circle center candidate point the mean value of the radial structure contrast of all the associated edge pixel points of the first type; the standard deviation of the distance of the first type of associated edge pixel points to the center candidate point ; the standard deviation of the distance of the second type of associated edge pixel points to the center candidate point ; denotes normalization, and the present application adopts linear normalization. The implementer can also select a normalization algorithm according to the actual implementation situation.
[0051] It should be noted that, reflects the original intensity of the center candidate point in the gradient convergence field; reflects the accuracy of the center candidate point as a geometric center. For an ideal concentric circle ring, the distances of the edge pixel points of the inner ring and the outer ring to the center should be very constant, that is, and should be close to 0, so that is large, close to 1. If the edge pixel points are distributed randomly or are not concentric, the standard deviation will increase, so that will be significantly reduced, thereby suppressing the candidate score of the center candidate point of the non-real center. reflects the structural consistency of the associated edge pixel points of the center candidate point . The real reference point contains a double-circle ring structure, and the two sides of the edges of the outer ring and the inner ring and the two sides of the edge of the inner ring are uniform areas of different materials, so that the radial structure contrast of the edge pixel points on the edges of the outer ring and the inner ring is high, and thus is large; the outside of the edge of the circular pad is complex in texture because it is connected with the wire, so that the radial structure contrast of the edge pixel points of the circular pad is smaller than that of the edge pixel points of the real reference point, and thus the corresponding to the center of the circular pad is smaller than the corresponding to the center of the real reference point; the via is a double-circle ring structure, and the inside of the edge of the inner ring is the inside of the hole, which may have shadows, irregular reflections or backgrounds, etc., so that the radial structure contrast of the corresponding edge pixel points is small, and thus the corresponding to the center of the via is smaller than the corresponding to the center of the real reference point. The present application comprehensively uses the gradient convergence intensity , , the structural consistency to obtain the candidate score of the center candidate point . When , , are large, the center candidate point More likely to be the center of the reference point.
[0052] S5. Determine the center of the reference point according to the candidate score of the center candidate point to achieve PCB circuit board positioning.
[0053] Specifically, the candidate score is greater than or equal to the score threshold In response to the absence of a valid reference point, a positioning failure result is output and a prompt is given to recapture the PCB circuit board image; in response to the insufficient number of valid reference points, If the number of valid reference points is insufficient, the output prompt message will be displayed. The implementer can choose to retain the existing valid reference points for auxiliary positioning or terminate the positioning process according to the actual scenario; in response to the number of valid reference points being greater than or equal to The candidate with the highest score Valid reference points as The center of the circle is a reference point. The number of preset reference points can be set by the implementer according to the PCB design specifications. The value of , score threshold The empirical value of is 0.7. In other embodiments, it can also be set by the implementer according to the actual implementation situation. However, it should be noted that the candidate score range is [0,1], so the score threshold This range cannot be exceeded. Figure 6 The detection result of the valid reference point.
Claims
1. A positioning method for PCB circuit board processing based on image processing, characterized in that: include: Perform edge detection on the grayscale image of the PCB circuit board to extract edge pixels; Constructing two sampling areas along the gradient direction and the reverse direction of the edge pixel point, and determining the radial structural contrast of the edge pixel point based on the grayscale mean difference of the two sampling areas and the variance of each sampling area; The angle between the gradient directions is not equal to as well as Any two edge pixels constitute an edge point pair, and the intersection of the gradient extension lines of the two edge pixels is used as the gradient intersection of the edge point pair. According to the angle between the gradient directions of the edge pixels in the edge point pair and the radial structural contrast of the edge pixels, vote for the gradient intersection, and accumulate the voting values at the same position in the grayscale image to obtain the gradient convergence strength. The gradient convergence strengths of all positions constitute the gradient convergence field; A peak point is selected in the gradient convergence field as a candidate point for the circle center, and the associated edge pixels of the candidate point are obtained. The associated edge pixels are divided into two categories, and a candidate score of the candidate point for the circle center is determined based on the gradient convergence strength of the candidate point, the standard deviation of the distance from each category of associated edge pixels to the candidate point, and the mean radial structural contrast of all associated edge pixels. The center of the reference point is determined according to the candidate score to achieve PCB circuit board positioning.
2. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: The two sampling areas are both rectangular areas of 3×5 pixels, and the edge pixels are located on the extension line of the line connecting the midpoints of the two short sides of the rectangle.
3. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: The radial structure contrast satisfies the expression: ; Where, Indicates edge pixels Radial structure contrast; Indicates edge pixels The first sampling area The mean of the grayscale values of all pixels in ; Indicates edge pixels The second sampling area The mean of the grayscale values of all pixels in ; Indicates edge pixels The first sampling area The variance of the grayscale values of all pixels in ; Indicates edge pixels The second sampling area The variance of the grayscale values of all pixels in ; Indicates the absolute value symbol; Indicates normalization.
4. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: The step of voting for the gradient intersection point based on the angle between the gradient directions of the edge pixels in the edge point pair and the radial structural contrast of the edge pixels includes: The voting value for the gradient intersection satisfies the expression: ; Where, Represents edge point pairs The voting value to the corresponding gradient intersection; Indicates edge pixels Radial structure contrast; Indicates edge pixels Radial structure contrast; Indicates edge pixels and edge pixels The angle between the gradient directions of Represents the angle weight.
5. The PCB circuit board processing positioning method based on image processing according to claim 4, characterized in that: The angle weight satisfies the expression: ; Where, represents the standard deviation parameter.
6. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: The step of selecting a peak point in the gradient convergence field as a candidate circle center point includes: Get the maximum gradient convergence intensity in the gradient convergence field Peak points are used as candidate points for the center of the circle; wherein the gradient convergence intensity of the peak point is greater than that of all points in its 8 neighborhoods, and the local maximum detection algorithm is used to obtain the points. The number of preset peak points.
7. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: The step of obtaining the associated edge pixels of the candidate circle center point and dividing the associated edge pixels into two categories includes: For the candidate point of the circle center , if the edge point pair The intersection of the gradients falls on is the center of the circle and the radius is If the edge pixel is within the circle and edge pixels Candidate point for the center of the circle The associated edge pixel points; according to the candidate points of each associated edge pixel point to the center of the circle The distance between all the associated edge pixels is clustered into two categories, where is the preset radius threshold.
8. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: The candidate score of the center candidate point satisfies the expression: ; Where, Represents the candidate point of the circle center Candidate score; Represents the candidate point of the circle center Gradient convergence strength; Represents the candidate point of the circle center The set of associated edge pixels; Represents the candidate point of the circle center The mean of the radial structural contrast of all associated edge pixels; Indicates the first type of associated edge pixel to the center candidate point The standard deviation of the distance; Indicates the second category of associated edge pixels to the candidate center points The standard deviation of the distance; Indicates normalization.
9. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: Determining the center of the reference point according to the candidate scores includes: The candidate score is greater than or equal to the score threshold The candidate center point of the circle is taken as the valid reference point; In response to the absence of valid reference points, output a positioning failure result and prompt to re-capture the PCB circuit board image; in response to the insufficient number of valid reference points In response to the number of valid reference points being greater than or equal to The candidate with the highest score Valid reference points as The center of the circle is a reference point, The preset number of reference points.
10. The PCB circuit board processing positioning method based on image processing according to claim 1, characterized in that: Also includes: The angle between the gradient directions is not equal to as well as , and any two edge pixel points whose spatial distance is less than the distance threshold constitute an edge point pair.
Citation Information
Patent Citations
Datum point positioning method based on machine vision
CN103235939A
Traffic sign recognition method and device, and vehicle
CN105740877A
Printed circuit board (PCB) positioning and multifunctional testing integrated device based on visual identification
CN120510108A
Self-adaptive alignment method of chip substrate
CN120563794A
Heterogeneous image registration method and system
WO2021248270A1
Cited By
Pole adaptive positioning method and system based on image processing
CN121414848A
An image processing-based polar adaptive localization method and system
CN121414848B