Method and device for positioning Mark point in printed circuit board and related medium

By preprocessing the printed circuit board image and determining the contour type, and using the minimum circumcircle method and the least squares method for fitting, the problem of inaccurate positioning caused by incomplete or convex Mark point contours was solved, and high-precision Mark point positioning was achieved.

CN121660973APending Publication Date: 2026-03-13DALIAN CHONGDA CIRCUIT
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Traditional printed circuit board positioning methods are prone to low recognition accuracy and low positioning precision in complex backgrounds, especially when the outline of the Mark point is incomplete or protruding.

Method used

By acquiring printed circuit board images, preprocessing them, identifying the contours of Mark points, using the least circumscribed circle method to determine the contour type, and then selecting either the least squares method or the least circumscribed circle method for fitting based on the type, to obtain accurate Mark point positioning results.

Benefits of technology

It improves the positioning accuracy of Mark points, overcomes interference caused by incomplete contours and outward protrusions, and enhances the accuracy and precision of positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121660973A_ABST
    Figure CN121660973A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for positioning a Mark point in a printed circuit board and a related medium, and the method comprises the steps: collecting an image of the printed circuit board, carrying out the preprocessing of the image, and recognizing and screening out the contour of the Mark point in the image; obtaining the radius of the contour of the Mark point by adopting a minimum circumcircle method, comparing the obtained radius of the contour of the Mark point with an expected radius, and judging the contour type of the Mark point according to a comparison result; when the contour type of the Mark point is a convex type, fitting the contour of the Mark point through a least square method to obtain a positioning result of the Mark point; and when the contour type of the Mark point is a non-convex type, using a parameter obtained by a minimum circumcircle method as a positioning result of the Mark point. According to the invention, the interference caused by the incomplete and convex circular contour of the Mark point can be overcome, and the positioning accuracy of the Mark point is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of circuit board manufacturing technology, and in particular to a method, apparatus and related medium for locating Mark points in a printed circuit board. Background Technology

[0002] Printed circuit boards (PCBs) provide fundamental support for various industries, and are gradually evolving towards higher precision, higher density, and higher integration. Achieving high-precision PCB positioning is a prerequisite for realizing high-precision surface mounting technology (SMT) and high-precision contact inspection. Traditional PCB positioning methods include mechanical positioning and machine vision positioning.

[0003] Mechanical positioning is further divided into edge positioning and hole positioning. Edge positioning fixes the PCB in a fixture by pressing down on its two edges; while hole positioning uses positioning pins to pass through positioning holes on the PCB for positioning and fixation. Mechanical positioning is a contact-based method, which is cumbersome and inconvenient. Machine vision positioning, on the other hand, uses a non-contact method. It constructs a planar coordinate system on the PCB by identifying multiple (usually three) optical calibration points (also known as reference points, usually circular, or simply mark points) on the PCB, thereby determining the position of other components relative to the mark points and achieving positioning. Due to its high accuracy, machine vision positioning is widely used in SMT (Surface Mount Technology). However, machine vision positioning is prone to mismatches in complex backgrounds or when the outline of the circular mark points is incomplete or convex.

[0004] In summary, traditional mechanical positioning methods are cumbersome and inconvenient to operate, while machine vision positioning methods may mismatch in complex backgrounds or when the outline of the circular mark point is incomplete or convex, resulting in low positioning accuracy and precision. Summary of the Invention

[0005] This invention provides a method, apparatus, and related medium for locating Mark points in printed circuit boards, aiming to solve the problems of low recognition accuracy and low positioning precision of circular Mark points in actual positioning processes due to incomplete contours and outward protrusions.

[0006] In a first aspect, embodiments of the present invention provide a method for locating Mark points in a printed circuit board, comprising: Images of printed circuit boards are acquired, the images are preprocessed, and the outlines of Mark points in the images are identified and filtered out. The radius of the Mark point's contour is obtained using the minimum circumcircle method. The obtained radius of the Mark point's contour is compared with the expected radius, and the contour type of the Mark point is determined based on the comparison result. When the contour type of the Mark point is convex, the contour of the Mark point is fitted by the least squares method to obtain the positioning result of the Mark point. When the contour type of the Mark point is non-convex, the parameters obtained by the minimum circumcircle method are used as the positioning result of the Mark point.

[0007] Secondly, embodiments of the present invention provide a positioning device for Mark points in a printed circuit board, comprising: The filtering unit is used to acquire images of printed circuit boards, preprocess the images, identify and filter the outlines of Mark points in the images; The type determination unit is used to obtain the radius of the Mark point's contour using the minimum circumcircle method, compare the obtained radius of the Mark point's contour with the expected radius, and determine the contour type of the Mark point based on the comparison result. The convex positioning unit is used to fit the contour of the Mark point using the least squares method when the contour type of the Mark point is convex, so as to obtain the positioning result of the Mark point. The non-convex positioning unit is used to fit the contour of the Mark point by the minimum circumcircle method when the contour type of the Mark point is non-convex, so as to obtain the positioning result of the Mark point.

[0008] Thirdly, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for locating Mark points in a printed circuit board as described in the first aspect.

[0009] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for locating Mark points in a printed circuit board as described in the first aspect.

[0010] This invention provides a method, apparatus, computer device, and storage medium for locating Mark points in a printed circuit board. The method includes: acquiring an image of the printed circuit board; preprocessing the image; identifying and filtering the contours of Mark points in the image; obtaining the radius of the Mark point contour using the least circumscribed circle method; comparing the obtained radius of the Mark point contour with a desired radius; and determining the contour type of the Mark point based on the comparison result. When the contour type of the Mark point is convex, the contour is fitted using the least squares method to obtain the positioning result of the Mark point. When the contour type of the Mark point is non-convex, the contour is fitted using the least circumscribed circle method to obtain the positioning result of the Mark point. This invention, by identifying and filtering the contours of Mark points, determining whether the contour type is convex, and using either the least circumscribed circle method or the least squares method for fitting different contour types, accurately obtains the positioning result of the Mark points, overcoming interference caused by incomplete circular contours and convexity of the Mark points, and improving the accuracy of Mark point positioning. Attached Figure Description

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

[0012] Figure 1 This is a flowchart illustrating a method for locating Mark points in a printed circuit board according to an embodiment of the present invention. Figure 2 The original image acquired for a method of locating Mark points in a printed circuit board according to an embodiment of the present invention; Figure 3 A grayscale image of a method for locating Mark points in a printed circuit board, provided in an embodiment of the present invention; Figure 4 The Mark point annotation diagram to be identified is provided in the embodiment of the present invention for a method of locating Mark points in a printed circuit board; Figure 5 The image after median filtering for a method of locating Mark points in a printed circuit board provided in an embodiment of the present invention; Figure 6 The binarized image of a method for locating Mark points in a printed circuit board provided in an embodiment of the present invention when the threshold is 80; Figure 7A binarized image with a threshold of 120 for a method of locating Mark points in a printed circuit board provided in an embodiment of the present invention; Figure 8 A binarized image with a threshold of 170 provided for a method of locating Mark points in a printed circuit board according to an embodiment of the present invention; Figure 9 A preliminary contour image extracted for a method of locating Mark points in a printed circuit board according to an embodiment of the present invention; Figure 10 The remaining contour image obtained by filtering the Mark point positioning method in a printed circuit board provided in this embodiment of the invention; Figure 11 The method for locating Mark points in a printed circuit board according to an embodiment of the present invention provides a method for filtering the outline image of Mark points; Figure 12 The least squares fitting result of the Mark point profile of the convex type provided by the embodiment of the present invention is shown in the figure. Figure 13 The method for locating Mark points in a printed circuit board provided in this embodiment of the invention requires fitting a profile of the incomplete circular Mark point; Figure 14 The fitting result of the minimum circumcircle method of the incomplete circular Mark point contour in a Mark point positioning method in a printed circuit board provided by an embodiment of the present invention is shown in the figure. Figure 15 This is a comparison diagram of fitting the contour of the Mark point of the convex type using the first least squares method, the second least squares method, and the proportional least circumcircle method according to an embodiment of the present invention. Figure 16 This is a diagram showing the least squares fitting effect of Comparative Example 1 on the Mark point profile of the convex type. Figure 17 This is a diagram showing the least squares fitting effect of Comparative Example 2 on the Mark point contour of the incomplete circle. Figure 18 This is a schematic block diagram of a positioning device for Mark points in a printed circuit board, provided as an embodiment of the present invention. Detailed Implementation

[0013] 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, not all, of the embodiments of the present invention. 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.

[0014] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0015] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0016] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0017] Please see below. Figure 1 , Figure 1 The flowchart of a method for locating Mark points in a printed circuit board provided by an embodiment of the present invention specifically includes steps S101 to S104.

[0018] S101. Acquire an image of the printed circuit board, preprocess the image, and identify and filter out the outlines of the Mark points in the image; S102. The radius of the Mark point's contour is obtained using the minimum circumcircle method. The radius of the obtained Mark point's contour is compared with the expected radius. The contour type of the Mark point is determined based on the comparison result. S103. When the contour type of the Mark point is convex, the contour of the Mark point is fitted by the least squares method to obtain the positioning result of the Mark point. S104. When the contour type of the Mark point is non-convex, the parameters obtained by the minimum circumcircle method are used as the positioning result of the Mark point.

[0019] In this embodiment, the image of the printed circuit board is first acquired and then preprocessed; then the outline points of the Mark are identified and screened, and the radius of the outline of the Mark point is obtained by using the minimum circumscribed circle method. Thus, the outline type of the Mark point is determined by using prior conditions, and then different methods are used to fit the outline type of the Mark point. This solves the problem of low recognition accuracy and low positioning precision of circular Mark points in actual positioning process due to incomplete outlines and protrusions.

[0020] For example, the images used in this embodiment are all acquired by an industrial camera. The industrial camera used in this embodiment is model OPT-CM200-GM-04, with a resolution of 1920×1200 (approximately 2.3 million pixels), a working distance of 0-1000mm, a field of view of 0-366.7mm, and a lens with a focal length of 75mm. The single pixel accuracy of the camera can be calculated according to formula (1).

[0021] (1).

[0022] In theory, pixel precision should be consistent along both the x and y directions. However, due to manufacturing errors, consistency in both directions cannot be guaranteed. This embodiment uses the pixel precision of the lower of the two directions.

[0023] In one embodiment, step S101, the preprocessing of the image, includes: The image is then subjected to grayscale conversion, filtering, and binarization.

[0024] Noise is generated during image acquisition and transmission. Image preprocessing aims to minimize the impact of this noise on the image, filter out useless information, and reduce the computational load during image processing.

[0025] For example, the image captured by the camera in this embodiment is a black and white image, but it is essentially still a 3-channel image containing RGB. In order to simplify the operation matrix, the image needs to be grayscaled to change it from 3 channels to a single channel. There are component method, maximum value method, average value method and weighted average method for image grayscale processing. The weighted average method is a method that assigns different weights to the three RGB channels according to the sensitivity of the human eye to different colors, thereby obtaining a grayscale image. The grayscale processing method used in this embodiment is the weighted average method. Its calculation formula (2) is as follows: Gray =0.299× R +0.578× G +0.114× B (2).

[0026] in, Gray This represents the calculated grayscale value; R This represents the brightness value of the red channel of the current pixel in the original color image; G This represents the brightness value of the green channel of the current pixel in the original color image; B This represents the brightness value of the blue channel of the current pixel in the original color image.

[0027] Figure 2 and Figure 3 These are the original image captured by the camera and the image after grayscale processing, respectively. Figure 4 The area marked with the identification target, i.e., the Mark point region, in this embodiment is shown in the figure.

[0028] Image filtering is an effective way to remove noise signals introduced during image acquisition and transmission. Commonly used filtering methods include median filtering, mean filtering, and Gaussian filtering. For all three methods, the size of the filter kernel must first be determined. Commonly used filter kernel sizes include 3×3, 5×5, and 7×7.

[0029] Taking a 3×3 filter kernel as an example, median filtering calculates the median of the nine pixel values ​​within the kernel's coverage area and replaces the target pixel value with this median. This filtering method effectively removes salt-and-pepper noise while preserving image detail and maintaining the thickness of edge lines. Mean filtering is similar to median filtering; it uses the mean of the nine pixel values ​​within the kernel's coverage area to replace the target pixel value. While removing noise, this method can blur the image. Gaussian filtering uses a Gaussian filter kernel, assigning different weights to the nine pixel values ​​within the kernel's coverage area according to a Gaussian distribution, and using their sum to replace the target pixel value. This effectively removes Gaussian noise but also introduces some blurring to the image.

[0030] Considering the contour extraction operation to be performed later, this embodiment requires high detail in line detail during filtering. Therefore, median filtering is used to process the image. The size of the filter kernel used in the filtering is 3×3. Figure 5 This is the image after median filtering.

[0031] Image binarization is a method that further simplifies the image matrix based on a grayscale image, while preserving the region of interest to the maximum extent possible. Pixel values ​​in the grayscale matrix are classified according to a certain threshold: pixels greater than the threshold are set to 255, and pixels less than the threshold are set to 0. When the selected threshold is too small, binarization filters out less information, and a large amount of useless information remains in the image; when the selected threshold is too large, although more useless information is filtered out, information around the marker points is also lost.

[0032] Analyzing the distribution of pixel values ​​around the Mark point, it's easy to see that there's a significant contrast between the Mark point area and its surrounding area. Therefore, a higher threshold can be used to filter out most of the information. Figures 6-8 These are the binarized images with thresholds of 80, 120, and 170, respectively. Figure 6As shown, when the threshold is 80, the image still contains a lot of contour information, which makes subsequent contour filtering more difficult. Figure 8 As shown, when the threshold is 170, although it filters out most contours, there is a pixel loss problem at the edges of the Mark points. After parameter adjustment, the binarization threshold selected in this embodiment is 120, and the obtained image is as follows. Figure 7 As shown. In other embodiments, the binarization threshold may also fluctuate around 120, for example, the binarization threshold may be in the range of 100-140.

[0033] In one embodiment, step S101, identifying and filtering the contours of Mark points in the image, includes: S1011. Extract all contours from the image as preliminary contours; S1012. Calculate the area of ​​each preliminary contour, compare the area of ​​each preliminary contour with a preset area range and perform a first screening to obtain contours within the area range as remaining contours. S1013. Draw the minimum circumcircle of each of the remaining contours, and obtain the center coordinates and radius of each of the minimum circumcircles; S1014. Calculate the distance between each point on each remaining contour and the corresponding center coordinate, and calculate the square of the difference between the distance and the radius of the corresponding smallest circumcircle to obtain the error of each remaining contour. S1015. Based on the error, the remaining contours are filtered a second time, and the remaining contour with the smallest error is taken as the contour of the Mark point.

[0034] For example, Figure 9 The image shown is the preliminary contour image (referred to as the preliminary contour image) extracted when the binarization threshold is 120, including all preliminary contours. The red lines represent the extracted preliminary contours. Figure 9 As can be seen, the extracted preliminary contours vary in size and shape. In addition to the circular contours of the Mark points, the image also contains very small circular contours. Therefore, to filter out the contours of the Mark points, some prior conditions are needed, such as the area and shape of the Mark point contours.

[0035] Furthermore, the actual measured diameter of the Mark point was 1.016 mm, and the area was approximately 0.785 mm². 2 The camera used in this embodiment has a pixel resolution of 0.012 mm / pixel, which translates to 5451 pixels for the area of ​​the Mark point. The pixel area of ​​the Mark point is then used to... Figure 9The obtained contours are first filtered. The parameters used in the filtering include the minimum and maximum pixel areas of the selected contours. Considering that the image is a pixel image, there will be a certain amount of pixel loss at the edges, and the contours may have bumps and incompleteness. Therefore, the minimum pixel area is set to 4000 pixels, and the maximum pixel area is set to 7000 pixels, which together form the preset area range. Figure 9 The remaining contours are obtained by filtering out contours with a pixel area between 4000 pixels and 7000 pixels. The image containing all remaining contours after the first filtering is called the remaining contour image. Figure 10 As shown. Figure 10 and Figure 9 In comparison, the number of outlines is significantly reduced.

[0036] Since this embodiment uses circular Mark points, the circular contours of the Mark points need to be selected from the remaining contours. This embodiment performs a second contour selection based on the shape of the remaining contours. First, the minimum circumcircle of the remaining contours is calculated and drawn, obtaining the center coordinates and radius of the minimum circumcircle. Second, the distance between each point on each remaining contour (each contour consists of multiple points, referred to as contour points, and these multiple contour points constitute the point set of the contour) and the center coordinates is calculated, and the square of the difference between this distance and the minimum circumcircle radius is calculated, denoted as error e. Since the contour shape of the Mark point is circular, its error e is much smaller than the error of irregular shapes. The remaining contour with the smallest error e is selected as the contour of the Mark point.

[0037] Figure 11 The image obtained after the second filtering, containing the outline of the Mark point (referred to as the Mark point outline image), shows the radius of the Mark point outline as 40 pixels. The actual radius of the Mark point is 0.508 mm = 42.3 pixels, with an error of 2.3 pixels and a geometric error of 0.0276 mm. Algorithm 1 provides the pseudocode for the outline filtering and minimum circumscribed circle algorithm.

[0038] Algorithm 1. Contour Filtering and Minimum Circumcircle Algorithm Input: Binary image matrix img, minimum area of ​​the target contour minArea, maximum area maxArea Output: Mark points locate the center and radius of the circle. 1. Extract the outline of the image and save it as contours. 2. Initialize the list of contours that meet the area requirements: contour_better ← None 3. FOR contours / / Iterate through all contours 4. IF minArea < area of ​​contour <maxArea 5. Add contour to contour_beter 6. END FOR 7. FOR contour_beter / / Iterate through contours that meet the area requirements 8. Calculate the center (a, b) and radius r of the smallest circumcircle of the profile. 9. Calculate the error E of the profile. 10. END FOR 11. Mcontour ← The contour with the smallest error E 12. Calculate the minimum circumcenter and radius of Mcontour. 13. Output the center and radius of the circle.

[0039] In Algorithm 1 above, the input includes the binarized image matrix `img` and the preset area range `minArea-maxArea`. First, all contours in `img` are extracted and saved to `contours`. Then, the contour list `contour_better` is initialized to 0. Next, each contour in `contours` is traversed, and it is determined whether it falls within the area range. If so, it is added to the contour list `contour_better`. After traversal, the contours in `contour_better` represent all remaining contours that meet the area requirement. Then, the contour list `contour_better` is traversed again, and the center (a, b) and radius `r` of the minimum circumcircle of each contour are calculated. The error `E` is also calculated, and the contour `Mcontour` with the smallest error `E` is selected. This contour `Mcontour` is the contour of the Mark point, and its corresponding center and radius can be output. However, the output center and radius are only temporary positioning results; their adoption depends on the contour type of the Mark point.

[0040] In one embodiment, step S102, determining the contour type of the Mark point based on the comparison result, includes: S1021. When the radius of the Mark point contour is greater than the expected radius, the contour type of the Mark point is determined to be convex. S1022. When the radius of the Mark point contour is less than or equal to the expected radius, the contour type of the Mark point is determined to be non-convex.

[0041] For example, based on the prior conditions, the radius of the Mark point is 42.3 pixels. A circle with a radius in the range of 39 to 45 pixels is set as a circle within the normal error range. This range of radii (39 to 45 pixels) is the range of the expected radius. In specific implementation, a suitable specific value can be selected from this range of radii as the expected radius, such as 44 pixels or directly selecting the upper limit value such as 45 pixels as the expected radius. The following embodiments will use an expected radius of 44 pixels as an example for illustration. Calculate the minimum circumcircle of the contour. If the radius of the minimum circumcircle exceeds the expected radius, the contour type is determined to be convex; otherwise, it is non-convex.

[0042] For example, Figure 12 The least squares algorithm fitting result for Mark points of the convex type has a fitting radius of 40.8 pixels, an error of 1.5 pixels, and a geometric error of 0.018 mm.

[0043] In one embodiment, the non-convex type includes a partially circular shape.

[0044] For Mark points with a non-convex contour type, the parameters obtained by fitting the minimum circumcircle method are directly used as the positioning information. In other words, the center and radius of the circle output by Algorithm 1 can be used as the positioning result.

[0045] For example, such as Figure 13 The image shows the outline of an incomplete circle. The minimum circumcircle algorithm was used for positioning and fitting, and the result is as follows. Figure 14 As shown, the fitting radius is 41.2 pixels, the error is 1.1 pixels, and the geometric error is 0.0132 mm.

[0046] In one embodiment, step S103, fitting the contour of the Mark point using the least squares method to obtain the positioning result of the Mark point, includes: S1031. The contour of the Mark point is fitted using the first least squares method to obtain the first fitting circle center and the first fitting radius. S1032. Compare the first fitted radius with the desired radius; S1033. If the first fitting radius is less than or equal to the expected radius, then the first fitting circle center and the first fitting radius are used as the positioning result. S1034. If the first fitting radius is greater than the expected radius, calculate the distance d from each point on the contour of the Mark point to the center of the first fitting circle. S1035. Determine whether the distance d is greater than the sum of the first fitting radius and the error threshold; S1036. If the distance d is greater than the sum of the first fitting radius and the error threshold, then the points corresponding to the contour of the Mark point are regarded as outliers and removed. S1037. If the distance d is less than or equal to the sum of the first fitting radius and the error threshold, then retain the points corresponding to the contour of the Mark point, and gather all the retained points as the new contour of the Mark point. S1038. Perform a second least squares fitting on the new contour of the Mark point to obtain the positioning result of the Mark point.

[0047] In another embodiment, in step S1037, the positioning result of the Mark point includes the second fitting circle center and the second fitting radius obtained by the second least squares fitting.

[0048] For example, since the least squares method fits all points on the contour, performing only one least squares fit on a circle with a convex contour often yields an inaccurate result. Therefore, it is advisable to first perform a least squares fit on the contour, eliminate outliers based on the fitting result, and then perform a second least squares fit. Theoretically, the resulting circle will be more accurate than the first result.

[0049] Practical verification shows that because the Mark points are relatively small and their raised contours occupy fewer pixels, a single fitting is usually sufficient, while a double fitting will reduce accuracy. Therefore, it is necessary to determine whether to perform a second fitting based on the fitting result of the first fitting. Algorithm 2 is the contour classification and least squares fitting algorithm used in this embodiment.

[0050] Algorithm 2. Contour Classification and Least Squares Fitting Algorithm Input: Mark point contour Mcontour, error threshold E Output: Fitting radius r 1. Calculate the minimum circumcircle of the profile. 2. Minimum circumcircle radius R of the profile 3.FR > 44 4. Use the least squares method for fitting to obtain the fitting radius r. 5. IF r > 44 / / After the first fitting, r does not meet the error requirements. 6. Calculate the distance d from each point on the contour to the center of the fitted circle. 7. Discard points where d > r + E 8. Perform least squares fitting on the new point set. 9. Output the fitting radius r 10. Else: 11. Output the minimum circumscribed circle radius R of the profile.

[0051] In Algorithm 2 above, the input includes the contour Mcontour of the Mark point and a preset error threshold E. First, the minimum circumcircle of the contour is calculated, thus obtaining its radius R, which can also be directly obtained from the output of Algorithm 1. Then, it is determined whether the radius R is greater than the expected radius 44. If the radius R is greater than 44, the contour type of the Mark point is determined to be convex, and the least squares method is used to fit the contour of the Mark point. If the radius R is less than or equal to 44, the radius R of the minimum circumcircle can be directly output.

[0052] The least squares fitting process can be divided into two steps: first, a first fitting is performed to obtain the first fitting radius *r*. Then, it is determined whether the first fitting radius *r* is greater than the expected radius of 44. If so, a second fitting is required. If it is less than or equal to the expected radius of 44, the first fitting circle center and the first fitting radius can be directly output as the positioning result. Before the second fitting, outliers are removed. The outlier removal process includes first calculating the distance *d* from each point on the Mark point's contour to the first fitting circle center; determining whether the distance *d* is greater than the sum of the first fitting radius and the error threshold; if the distance *d* is greater than the sum of the first fitting radius and the error threshold, it indicates that the point is far from the circle center, affecting the accuracy of the final calculation, and the corresponding point needs to be treated as an outlier and removed; if the distance *d* is less than or equal to the sum of the first fitting radius and the error threshold, the corresponding points on the Mark point's contour are retained, and all retained points are collected as the new contour of the Mark point. Then, a second least squares fitting is performed on the new contour to obtain the second fitting circle center and the second fitting radius, which are then output as the positioning result. The fitting result is as follows: Figure 15 As shown.

[0053] In other embodiments, if the second fitted radius is still larger than the desired radius, a third fitting can be performed, and so on, until the final positioning result is obtained.

[0054] Comparative Example 1 The contour of the convex Mark point was fitted using the minimum circumcircle method, and the result is as follows: Figure 16 As shown.

[0055] like Figure 16 As shown, the contour near the Mark point is convex. The minimum circumcircle algorithm is used for fitting, with a fitting radius of 46.7 pixels, an error of 4.4 pixels, and a geometric error of 0.0528 mm.

[0056] Depend on Figure 15 It can be seen that, after using the least squares method, the least squares method, or the least circumscribed circle method, the least squares method can better fit the contour of the Mark point, followed by the least squares method, and the least circumscribed circle method is the worst.

[0057] Comparative Example 2 The least squares method was used to fit the contour of the Mark points with incompleteness, and the results are as follows: Figure 17 As shown.

[0058] Depend on Figure 17 It is known that the fitting radius is 36.8 pixels, the error is 5.5 pixels, and the geometric error is 0.066 mm. Compared with the least squares method used in this embodiment to fit the incomplete Mark point contour in Comparative Example 2, as shown... Figure 14 As shown, the results obtained using the minimum circumcircle method have a fitting radius of 41.2 pixels, an error of 1.1 pixels, and a geometric error of 0.0132 mm. In this embodiment, the error of the results obtained by fitting the incomplete Mark point contour using the minimum circumcircle method is greatly reduced.

[0059] Figure 18 This is a schematic block diagram of a Mark point positioning device 400 in a printed circuit board according to an embodiment of the present invention. The device includes: The filtering unit 401 is used to acquire images of printed circuit boards, preprocess the images, and identify and filter the outlines of Mark points in the images. The type determination unit 402 is used to obtain the radius of the contour of the Mark point using the minimum circumscribed circle method, compare the obtained radius of the Mark point contour with the expected radius, and determine the contour type of the Mark point based on the comparison result. The convex positioning unit 403 is used to fit the contour of the Mark point using the least squares method when the contour type of the Mark point is convex, so as to obtain the positioning result of the Mark point. The non-convex positioning unit 404 is used to fit the contour of the Mark point by the minimum circumcircle method when the contour type of the Mark point is non-convex to obtain the positioning result of the Mark point.

[0060] In one embodiment, the filtering unit 401 is further configured to perform grayscale conversion, filtering, and binarization on the image.

[0061] In one embodiment, the filtering unit 401 is further configured to extract all contours in the image as preliminary contours; Calculate the area of ​​each preliminary contour, compare the area of ​​each preliminary contour with a preset area range and perform a first screening to obtain contours within the area range as the remaining contours. Draw the minimum circumcircle of each of the remaining contours, and obtain the center coordinates and radius of each minimum circumcircle; Calculate the distance between each point on each remaining contour and the corresponding center coordinates of the circle, and calculate the square of the difference between the distance and the radius of the corresponding smallest circumcircle to obtain the error of each remaining contour; The remaining contours are then filtered a second time based on the error, and the remaining contour with the smallest error is selected as the contour of the Mark point.

[0062] In one embodiment, the type determination unit 402 is used to determine the type of the Mark point by comparing the results. When the radius of the Mark point contour is greater than the expected radius, the Mark point is determined to be of the convex type. When the radius of the Mark point profile is less than or equal to the expected radius, the Mark point is determined to be of a non-convex type.

[0063] In one embodiment, the convex positioning unit 403 is used to perform a first least squares fitting on the contour of the Mark point to obtain a first fitting circle center and a first fitting radius; Compare the first fitted radius with the desired radius; If the first fitted radius is less than or equal to the expected radius, then the first fitted circle center and the first fitted radius are used as the positioning result; If the first fitted radius is greater than the expected radius, calculate the distance d from each point on the contour of the Mark point to the center of the first fitted circle; Determine whether the distance d is greater than the sum of the first fitting radius and the error threshold; If the distance d is greater than the sum of the first fitting radius and the error threshold, then the point corresponding to the contour of the Mark point is regarded as an outlier and removed. If the distance d is less than or equal to the sum of the first fitting radius and the error threshold, then the points corresponding to the contour of the Mark point are retained, and all the retained points are gathered as the new contour of the Mark point. A second least squares fitting is performed on the new contour of the Mark point to obtain the positioning result of the Mark point.

[0064] In one embodiment, the location result of the Mark point includes the second fitted circle center and the second fitted radius obtained by the second least squares fitting.

[0065] In one embodiment, the non-convex type includes a broken circle.

[0066] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.

[0067] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed, can perform the steps provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0068] This invention also provides a computer device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the steps provided in the above embodiments. Of course, the computer device may also include various network interfaces, power supplies, and other components.

[0069] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0070] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for locating Mark points in a printed circuit board, characterized in that, include: Images of printed circuit boards are acquired, the images are preprocessed, and the outlines of Mark points in the images are identified and filtered out. The radius of the Mark point's contour is obtained using the minimum circumcircle method. The obtained radius of the Mark point's contour is compared with the expected radius, and the contour type of the Mark point is determined based on the comparison result. When the contour type of the Mark point is convex, the contour of the Mark point is fitted by the least squares method to obtain the positioning result of the Mark point. When the contour type of the Mark point is non-convex, the parameters obtained by the minimum circumcircle method are used as the positioning result of the Mark point.

2. The method for locating Mark points in a printed circuit board according to claim 1, characterized in that, Determining the contour type of the Mark point based on the comparison result includes: When the radius of the Mark point's contour is greater than the expected radius, the contour type of the Mark point is determined to be convex. When the radius of the Mark point profile is less than or equal to the expected radius, the profile type of the Mark point is determined to be non-convex.

3. The method for locating Mark points in a printed circuit board according to claim 1, characterized in that, The process of identifying and filtering the contours of Mark points in the image includes: Extract all contours from the image as preliminary contours; Calculate the area of ​​each preliminary contour, compare the area of ​​each preliminary contour with a preset area range and perform a first screening to obtain contours within the area range as the remaining contours. Draw the minimum circumcircle of each of the remaining contours, and obtain the center coordinates and radius of each minimum circumcircle; Calculate the distance between each point on each remaining contour and the corresponding center coordinates of the circle, and calculate the square of the difference between the distance and the radius of the corresponding smallest circumcircle to obtain the error of each remaining contour; The remaining contours are then filtered a second time based on the error, and the remaining contour with the smallest error is selected as the contour of the Mark point.

4. The method for locating Mark points in a printed circuit board according to claim 1, characterized in that, The process of fitting the contour of the Mark point using the least squares method to obtain the positioning result of the Mark point includes: The contour of the Mark point is fitted using the first least squares method to obtain the first fitted circle center and the first fitted radius. Compare the first fitted radius with the desired radius; If the first fitted radius is less than or equal to the expected radius, then the first fitted circle center and the first fitted radius are used as the positioning result; If the first fitted radius is greater than the expected radius, calculate the distance d from each point on the contour of the Mark point to the center of the first fitted circle; Determine whether the distance d is greater than the sum of the first fitting radius and the error threshold; If the distance d is greater than the sum of the first fitting radius and the error threshold, then the point corresponding to the contour of the Mark point is regarded as an outlier and removed. If the distance d is less than or equal to the sum of the first fitting radius and the error threshold, then the points corresponding to the contour of the Mark point are retained, and all the retained points are gathered as the new contour of the Mark point. A second least squares fitting is performed on the new contour of the Mark point to obtain the positioning result of the Mark point.

5. The method for locating Mark points in a printed circuit board according to claim 4, characterized in that, The location result of the Mark point includes the second fitted circle center and the second fitted radius obtained by the second least squares fitting.

6. The method for locating Mark points in a printed circuit board according to claim 1, characterized in that, The preprocessing of the image includes: The image is then subjected to grayscale conversion, filtering, and binarization.

7. The method for locating Mark points in a printed circuit board according to claim 1, characterized in that, The non-convex type includes incomplete circles.

8. A positioning device for Mark points in a printed circuit board, characterized in that, include: The filtering unit is used to acquire images of printed circuit boards, preprocess the images, identify and filter the outlines of Mark points in the images; The type determination unit is used to obtain the radius of the Mark point's contour using the minimum circumcircle method, compare the obtained radius of the Mark point's contour with the expected radius, and determine the contour type of the Mark point based on the comparison result. The convex positioning unit is used to fit the contour of the Mark point using the least squares method when the contour type of the Mark point is convex, so as to obtain the positioning result of the Mark point. The non-convex positioning unit is used to fit the contour of the Mark point by the minimum circumcircle method when the contour type of the Mark point is non-convex, so as to obtain the positioning result of the Mark point.

9. A computer device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for locating Mark points in a printed circuit board as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the method for locating Mark points in a printed circuit board as described in any one of claims 1 to 7.