Polygonal marker point rapid identification and positioning method and system, and storage medium
By extracting and filtering the outlines of polygon marking points, using gradient information and rotation projection statistics to estimate and correct positions, the problem of rapid and accurate identification of polygon marking points is solved, and efficient and stable positioning effect is achieved.
Patent Information
- Application Number
- CN202510020256.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-01-07
AI Technical Summary
It is difficult to achieve rapid and accurate identification of polygon marking points in the prior art, especially in the presence of glitches, flashes or contamination, boundary fitting, template matching, feature point registration and deep learning methods all have problems of insufficient stability and accuracy.
By extracting the outline of the polygon marking point image, filtering the target outline, using the gradient information of the strong edge contour point for coarse positioning, correcting the rotation angle with the rotation projection statistical method, and finally registering with the corrected result as the initial value to achieve the precise positioning of the polygon marking point.
This method can quickly and accurately realize the position estimation of polygon marking points, and has the advantages of strong anti-interference ability, fast detection speed and high positioning accuracy. It is suitable for high-speed and stable detection scenarios of polygon marking points.
Smart Images

Figure CN119418027B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of marker point recognition and positioning, and in particular to a polygonal marker point rapid recognition and positioning method and system, and a storage medium. Background Art
[0002] Marker point recognition technology is a common but very important computer vision technology. Due to its good adaptability, convenient operation and recognition stability, it is widely used in manufacturing, engineering measurement, machine vision positioning, medical imaging and other fields. It is often used in target positioning, target segmentation, target measurement, target pose estimation and other aspects. Therefore, how to quickly and accurately detect marker points is very important.
[0003] Marking points are usually some specific simple geometric shapes, such as circles, triangles, rectangles, regular pentagons, crosses, etc. Among them, polygonal marking points such as triangles, rectangles, regular pentagons, etc. except circles cannot be directly described by simple mathematical formulas, which makes it difficult to quickly and accurately identify and locate them.
[0004] Currently, there are four common solutions to the problem of difficult polygonal marker point recognition, including boundary fitting, template matching, feature point registration and deep learning.
[0005] The boundary fitting method mainly uses boundary straight line fitting and then combines the fitting straight lines to achieve the final positioning. Although this method has a fast detection speed, it has problems with insufficient stability and accuracy. For example, when there are burrs, flash or pollution on the edges of some marking points, the fitting results often have deviations and are difficult to meet the requirements of high precision.
[0006] Template matching-based methods are often implemented by scanning the entire image. When the angle and scale of the detection target need to be considered, the detection process consumes a lot of resources and the detection speed is slow. Although acceleration can be achieved through the pyramid method, it is difficult to grasp the scanning range and step length of each layer of the pyramid, resulting in unstable results. Therefore, the template matching method is not suitable for high-speed and stable detection scenarios of polygonal markers.
[0007] Although the algorithm based on feature point matching has solved the problem of poor adaptability of template matching algorithm in angle and scaling to a certain extent, the traditional feature point matching algorithm still has problems such as unstable recognition results and insufficient accuracy. Most traditional feature point matching algorithms use corner points or boundary contour points as feature points. When corner points are used as feature points, the corner points in the actual image are often in arc shape and the corner point positions are unstable, resulting in fluctuations in the matching results. In addition, when there is background pollution, it is often impossible to extract accurate corner points, and there is a large deviation in the recognition results. When the boundary contour is used as the feature point, since the point set registration process requires continuous iteration and looping, when there are many feature points, the method has a large amount of calculation and is time-consuming without certain optimization. It is difficult to meet the real-time requirements of marker point recognition and has limitations in application scenarios. Therefore, the simple use of traditional point set matching methods cannot meet the high precision, high speed and high stability requirements of polygon marker point recognition.
[0008] The method of using deep learning network is a target detection method that has been used more frequently in recent years. However, there are still the following shortcomings: first, deep learning methods are sensitive to changes in illumination, and if the amount of training is insufficient, it is easy to make false detections or missed detections; second, deep learning methods often require a large number of feature images for training, and the accuracy of the training results depends on the labeled data, the operation is complex and the results are dependent; finally, the model trained by the deep learning method has certain requirements for the operating environment, and the use scenarios are limited. Therefore, the deep learning method is not suitable for the rapid and accurate detection of polygonal markers.
[0009] In summary, it is difficult for existing methods to achieve fast and accurate recognition of polygonal markers. Summary of the invention
[0010] The purpose of the present invention is to overcome the problems existing in the prior art and to provide a method and system for quickly identifying and locating polygonal marker points, as well as a storage medium, which can quickly and accurately realize the position and posture estimation of polygonal marker points.
[0011] In order to achieve the above object, the present invention provides a method for quickly identifying and locating polygonal markers, comprising the following steps:
[0012] Extract the contour of the polygonal marker image and filter out the target contour;
[0013] The gradient amplitude of the target contour points is used to filter out the weak edge contour points and retain the strong edge contour points. The gradient direction of the strong edge contour points is used to estimate the rotation angle of the target contour. The coordinate mean of the strong edge contour points is used to estimate the center of the target contour to complete the rough positioning.
[0014] The rotation angle is corrected by using the rotation projection statistics method with the estimated center as the rotation center to complete the correction of the rough positioning result;
[0015] The corrected coarse positioning result is used as the initial value for registration to obtain the precise positioning result of the polygonal marker point.
[0016] A second aspect of the present invention provides a polygonal marker point rapid identification and positioning system, comprising the following steps:
[0017] The target contour extraction module is used to extract the contour of the polygonal marker image and filter out the target contour;
[0018] A coarse positioning module is used to filter out weak edge contour points by using the gradient amplitude of the edge contour points of the target contour, retain the strong edge contour points, estimate the rotation angle of the target contour by using the gradient direction of the strong edge contour points, and estimate the center of the target contour by using the coordinate mean of the strong edge contour points to complete the coarse positioning;
[0019] A coarse positioning result correction module is used to correct the rotation angle using the estimated center point as the rotation center using the rotation projection statistical method to complete the correction of the coarse positioning result;
[0020] The fine positioning module is used to obtain the fine positioning result of the polygonal marker point by using the corrected coarse positioning result as the initial value for registration.
[0021] A third aspect of the present invention provides a computer storage medium, comprising:
[0022] a memory having a computer program stored thereon;
[0023] A processor is used to execute the computer program in the memory to implement the steps of the above-mentioned polygonal marker point rapid identification and positioning method.
[0024] Through the above technical solution, the gradient information of the edge contour points is used to screen out weak edges, and then the gradient direction information and coordinate information of the retained strong edges are used to quickly estimate the rotation angle and center of the polygonal marker to be detected. This method has a small amount of calculation and is simple to operate. It can quickly obtain the approximate posture information of the polygonal marker to be detected; further, the estimated angle is corrected in a small range by using the rotation projection method to reduce the deviation between the estimated value and the true value, and provide a more accurate initial value for subsequent registration; finally, the corrected coarse positioning result is used as the initial value for registration, which can speed up the convergence speed and reduce the number of iterations. At the same time, it can reduce the probability of the iteration falling into a local extreme value, which not only improves the running speed but also increases the accuracy. Therefore, the technical solution proposed by the present invention has the advantages of strong anti-interference ability, fast detection speed, and high positioning accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of the process of rapid identification and positioning of polygonal marking points disclosed in the present invention;
[0026] Figure 2 The polygonal marker point 1 image in the embodiment and test example disclosed in the present invention;
[0027] Figure 3 It is the original contour map extracted from the polygonal marker point 1 image in the embodiment disclosed in the present invention;
[0028] Figure 4 It is a contour image after the polygonal marker point 1 image is filtered in the embodiment disclosed in the present invention;
[0029] Figure 5 It is a gradient magnitude map of the target contour point set after the polygonal marker point 1 is screened in the embodiment disclosed in the present invention;
[0030] Figure 6 It is a gradient direction distribution histogram of the target contour point set after the polygonal marker point 1 is screened in the embodiment disclosed in the present invention;
[0031] Figure 7 It is a horizontal and vertical projection histogram of the number of projection extreme value points and the maximum angle of the target contour after the polygonal marker point 1 is screened in the embodiment disclosed in the present invention in the angle correction stage;
[0032] Figure 8 The polygonal marker point 2 image in the test example disclosed in the present invention; DETAILED DESCRIPTION
[0033] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0034] Taking the identification of rectangular marker points in a marker point identification neighborhood as an example, the technical solution and specific implementation methods of the method for rapid identification and positioning of polygonal marker points of the present invention are described in detail below.
[0035] Based on the above concept, the first aspect of the embodiment of the present invention proposes a method for quickly identifying and locating polygonal markers. Figure 1 As shown, the following steps are included:
[0036] S1. Target contour point set extraction: Extract the contour of the grayscale image containing the polygonal marker points to be detected, and then filter out the target contour by area, perimeter, convexity and shape features.
[0037] Furthermore, step S1 includes the following process:
[0038] S11, image preprocessing, that is, extracting the region of interest and filtering the region of interest. Generally speaking, the target to be detected only occupies part of the entire image and is near the center of the image. Therefore, the size information of the target to be detected itself and the fixed fluctuation range can be used to extract the region of interest to reduce unnecessary waste of resources while speeding up the processing speed. The region of interest is centered on the center of the image, and the size of the circumscribed rectangle of the polygonal marker point target to be detected plus the fixed fluctuation range or multiple times the size of the circumscribed rectangle of the target to be detected. The length and width of the region of interest are calculated as follows:
[0039] ROIW = ( BRw + Sw ) *1000 / ScaleX (1)
[0040] ROIH = ( BRh + Sh )*1000 / ScaleY (2)
[0041] in, ROIW , ROIH Respectively represent the length and width of the region of interest, in pixels; BR , BnB They represent the theoretical length and width of the smallest circumscribed rectangle of the polygonal marker to be detected when it is placed horizontally, in mm. Sw , Sh Indicates the set detection range, which can be a fixed value given according to the fluctuation range of the target to be detected, or a multiple of the minimum circumscribed rectangular size of the target to be detected, in mm; ScaleX and ScaleY represent the horizontal and vertical pixel sizes of the camera, that is, the actual length represented by a pixel in the horizontal and vertical directions, in μm / pixel.
[0042] The filtering process of the region of interest is performed using bilateral filtering, which can remove some interference while ensuring the clarity of the boundary and improve the accuracy of the results.
[0043] S12, candidate contour extraction. The Canny algorithm is used to extract the edge of the filtered image of interest, and then the connected domain method is used to obtain one or more connected candidate contours. Figure 3 .
[0044] S13, contour screening. The candidate contours are preliminarily screened using area, perimeter, convexity and shape features, and the contour evaluation values of the nested contours with similar centers are calculated according to formula (5). The contour with the smallest evaluation value is retained and the other contours are removed. Further screening is completed to obtain the final target contour. Figure 4 Taking the rectangular marker detection as an example, the theoretical area S of the rectangular marker is first calculated by theoretical parameters and pixel size. 0, perimeter C 0 Then, the area of the candidate contour is between 0.7 and 1.3 times S 0 , the circumference is 0.5~1.5 times C 0 , the contours with rectangularity above 0.65 and convexity above 0.8 are retained as the initial screening contours. Then the coordinate mean of the contour point set after the preliminary screening is calculated as its estimated center, and the two contours with estimated center distance less than the threshold are regarded as nested contours and placed in a candidate group. Finally, for the candidate group with multiple contours, the evaluation values of all contours in the candidate group are calculated according to formula (5), and the contour with the smallest evaluation value is retained and other contours are removed to complete further screening and obtain the final target contour. The calculation formulas for rectangularity and convexity are as follows:
[0045] Rr = S real / S MER (3)
[0046] Rc = S real / S Hullarea (4)
[0047] in, Rr and Rc They represent rectangularity and convexity respectively, and their values are between (0,1]. S real Indicates the actual closed area of the currently detected connected contour. S MER Indicates the area of the minimum enclosing rectangle of the currently detected connected contour. S Hullarea Represents the area of the convex hull of the currently detected connected contour,
[0048] (5)
[0049] Among them, Radio is the contour evaluation value, the smaller it is, the closer the current contour is to the ideal contour. C real Indicates the actual perimeter of the currently detected connected contour. α, β, and γ are weight coefficients, α+β+γ=1. Generally speaking, the weights of α and γ are set slightly larger than β.
[0050] S2, coarse positioning: First, use the gradient amplitude information of the boundary contour points to filter out some weak edge contour points and retain the strong edge contour points; then use the gradient direction information of the strong edge contour points to estimate the rotation angle of the polygon marker to be detected; finally, use the coordinate mean of the strong edge contour points to obtain the estimated center of the polygon marker to be detected. Figure 2Taking the polygon marker point 1 shown in the figure as an example, the gradient amplitude diagram of the filtered target contour point set is as follows Figure 5 shown.
[0051] Further, step S2 includes the following process:
[0052] S21, edge contour point gradient calculation and weak edge contour point screening. First, two Sobel operators of 3*3 in horizontal and vertical directions are used to calculate the horizontal and vertical gradient changes of each point in the filtered image of interest. Then, the gradient amplitude and gradient direction of each point in the filtered contour point set are calculated using formula (6) and formula (7). Finally, the weak edge points in the target contour point set whose gradient amplitude is less than the threshold are screened out, and the strong edge points are retained.
[0053]
[0054] in, G (x,y) represents the gradient magnitude of point (x,y); G x (x,y) represents the magnitude of the horizontal component of the gradient obtained by convolution of the horizontal Sobel operator at the point (x,y); G y (x,y) represents the magnitude of the vertical component of the gradient obtained by convolution of the point (x,y) using the vertical Sobel operator; R (x,y) represents the gradient direction of the point (x,y), in degrees.
[0055] S22, estimating the center point of the polygonal marker to be detected: For a single connected target contour, the coordinate mean of the strong edge points retained after screening is used as the estimated value of the center point.
[0056] S23, estimation of the rotation angle of the polygonal marker to be detected. For a single connected target contour, firstly, the gradient direction of the strong edge points retained after the target contour is screened is unified to (0°, 360°] according to formula (8); then, the gradient direction of the processed strong edge points is rounded off to remove the decimal places and retain the integer places; then, the frequency of occurrence is counted according to the angle value to obtain the angle statistical histogram, where the angle value statistical interval is set to 1°, reference Figure 6; Then divide the angle statistics histogram into multiple intervals according to the number of edges of the polygon marker points, and find the angle value corresponding to the maximum point of the histogram in each interval, where the interval length is divided according to the proportional relationship of the internal angles of the polygon marker points. For the special rectangular and regular polygon marker points, the equal division principle is adopted, and the number and the number of the three neighborhoods of the search location are used as the statistical value of this location when searching for the maximum point; Finally, integrate the angle values corresponding to the maximum points of the histogram of each interval to obtain the rotation angle estimate of the current single connected target contour, where the integration of the angle values corresponding to the maximum points of the histogram in each interval is based on the angle value closest to 0° or 360°, and convert other angle values to close to 0° or 360° according to the angle relationship between each side and the adjacent side, and remove the abnormal angles that deviate greatly from the mean in the converted angle set, and use the mean of the remaining angles as the rotation angle estimate of the current single connected target contour. Special rectangular and regular polygon marker points can use the following rules for angle integration:
[0057] According to formula (9), the inner angle of the polygonal marker to be detected in the theoretical case is calculated: θ c ;
[0058] According to formula (10), perform n-1 angle conversions on the angle values corresponding to each maximum point;
[0059] If the internal angle is less than or equal to 90 degrees, perform an angle conversion on the angle values corresponding to each maximum point after conversion according to formula (11); otherwise, perform an angle conversion on the angle values corresponding to each maximum point after conversion according to formula (12);
[0060] R' (x,y) = R (x,y)%360 (8)
[0061] in, R' (x,y) represents the angle value corresponding to the gradient direction of the point (x,y) unified to (0°,360°]; R (x,y) represents the angle value corresponding to the initial gradient direction of the point (x,y); % represents the remainder operation.
[0062] θ c = (n-1) *180 / n (9)
[0063] in, θ c is the theoretical internal angle of the rectangle or regular polygon. n is the number of sides of the rectangle or regular polygon.
[0064] (10)
[0065] i =1,2,...,n-1, where i Indicates the number of angle conversions, 1≤ i ≤ n -1.
[0066] (11)
[0067] (12)
[0068] in, θ i and θ i 'Represents the angle value of the gradient direction corresponding to each maximum point before and after the transformation.
[0069] Taking a rectangle as an example, the gradient direction is first divided into four intervals at 90-degree intervals, (0,45] and (315-360] are the first interval, (45-135] is the second interval, (135-225] is the third interval, and (225,315] is the fourth interval; then the directions corresponding to the maximum points of the four intervals are found with a neighborhood size of 3 to obtain four candidate angles; then the candidate angles are normalized, first three cycles are performed to subtract 90° from the angles greater than 90° in the candidate angles, then 90° is subtracted from the angles greater than or equal to 45° in the processed candidate angles, and 90° is added to the angles less than or equal to -45°; then the outliers in the candidate angles are removed, the mean of the four candidate angles is calculated first, and then the deviation of each candidate angle from the mean is calculated. If the maximum deviation exceeds the threshold of 10, the candidate angle corresponding to the maximum deviation is removed; finally, the mean of the remaining candidate angles after removing the outliers is used as the final rotation angle estimation of the rectangular target to be detected.
[0070] S3, coarse positioning result correction. The estimated rotation angle is corrected by using the rotation projection statistics. Specifically, first, the rotation angle estimated in S2 is taken as the middle value, and the angle range of the rotation projection is determined within a small neighborhood. Generally, the fluctuation range is ±5°, and the step size is less than 1° as the rotation projection angle step size, which is generally 0.5°; then, the center estimated in S2 is taken as the rotation center, and within the determined rotation projection angle range, the strong edge points retained in S21 are subjected to coordinate rotation transformation according to formula (13) at each angle according to the angle step size to obtain multiple rotation point sets; then, each rotation point set is projected in the horizontal and vertical directions to obtain the horizontal and vertical projection histograms, refer to Figure 7 , count the number and the projections corresponding to the projection extreme points in the horizontal and vertical projection histograms corresponding to each rotation angle; finally, take the maximum angle value of the projection number and the maximum angle value as the angle estimation correction value of the polygon marker to be detected.
[0071] (13)
[0072] in, P x , P y Represents the original horizontal and vertical coordinates of the point to be transformed. P x '、 P y ' indicates point ( P x , P y ) The horizontal and vertical coordinates of the point after the rotation transformation. P cx , P cy Represents the horizontal and vertical coordinates of the rotation center, that is, the horizontal and vertical coordinates of the center point estimated in S2. ω Indicates the rotation angle in radians.
[0073] S4, sub-pixel contour extraction. Based on the strong edge obtained in S2, the 7*7 Zernike matrix is used to obtain the corresponding sub-pixel contour points.
[0074] S5. Creation of template point set. First, the theoretical pixel length of each side of the polygonal marker to be detected is calculated according to formula (14) using the size parameters of the polygonal marker to be detected and the pixel size information of the camera. Then, the origin is used as the center point of the template to be constructed, and the coordinate values of each vertex of the polygonal marker template to be constructed at 0° are calculated. Then, the number of strong edge points of the single connected target contour to be detected is used as the total number of template points to be constructed, and the number of template points corresponding to each side is determined according to the ratio of the length of each side to the perimeter. Finally, the number of strong edge points of the single connected target contour to be detected is used as the total number of template points to be constructed to obtain the final template point set.
[0075] (14)
[0076] Where L is the side length of the polygonal marker to be detected, in mm. l It is the theoretical pixel length of the side length of the polygon marker point to be detected, in pixels. ScaleX, ScaleY is the pixel size of the camera in the X and Y directions, in μm / Pixel. λ is the angle between the side L of the polygonal marker to be detected and the X direction, in radians, which is calculated from the estimated rotation angle of the polygonal marker to be detected and the internal angles of the polygonal marker to be detected.
[0077] S6. Obtaining the precise positioning result based on point set registration. Using the corrected rough positioning result as the initial value, the template point set and the sub-pixel contour point set are registered between point sets to obtain the precise positioning result of the polygonal marker point to be detected. In the implementation of the present invention, a 2D CPD algorithm is used to achieve point set registration.
[0078] Based on the same inventive concept, a second aspect of an embodiment of the present invention provides a polygonal marker point rapid identification and positioning system, comprising:
[0079] The target contour extraction module is used to extract the contour of the polygonal marker image and filter out the target contour;
[0080] A coarse positioning module is used to filter out weak edge contour points by using the gradient amplitude of the edge contour points of the target contour, retain the strong edge contour points, estimate the rotation angle of the target contour by using the gradient direction of the strong edge contour points, and estimate the center of the target contour by using the coordinate mean of the strong edge contour points to complete the coarse positioning;
[0081] A coarse positioning result correction module is used to correct the rotation angle using the estimated center point as the rotation center using the rotation projection statistical method to complete the correction of the coarse positioning result;
[0082] The fine positioning module is used to obtain the fine positioning result of the polygonal marker point by using the corrected coarse positioning result as the initial value for registration.
[0083] Based on the same inventive concept, a third aspect of an embodiment of the present invention provides a computer storage medium, including:
[0084] a memory having a computer program stored thereon;
[0085] A processor is used to execute the computer program in the memory to implement the steps of the above-mentioned polygonal marker point rapid identification and positioning method.
[0086] In summary, the technical solution of the present invention uses the gradient information of edge contour points to screen out weak edges, and then uses the gradient direction information and coordinate information of the retained strong edges to quickly estimate the rotation angle and center of the polygonal marker to be detected. This method has a small amount of calculation and is simple to operate. It can quickly obtain the approximate posture information of the polygonal marker to be detected; further, the estimated angle is corrected in a small range by using a rotation projection method to reduce the deviation between the estimated value and the true value, and provide a more accurate initial value for subsequent alignment; finally, the corrected coarse positioning result is used as the initial value for alignment, which can speed up the convergence speed and reduce the number of iterations, and at the same time reduce the probability of the iteration falling into a local extreme value, which not only improves the running speed but also increases the accuracy. Therefore, the technical solution proposed by the present invention has the advantages of strong anti-interference ability, fast detection speed, and high positioning accuracy.
[0087] Test example:
[0088] Reliability, effectiveness verification and experimental analysis of the method for fast and accurate positioning and recognition of polygonal markers.
[0089] In order to verify the reliability and effectiveness of the method proposed in this invention, the following verification experiment is designed:
[0090] The experiment uses the polygonal mark point image on the PCB board taken by the YAMAHA brand YS12 placement machine as the sample image, and the recognition result of the YAMAHA brand YS12 placement machine as the standard value. The sample image is recognized using the algorithm flow proposed in the present invention, and the difference between the recognition result of the algorithm proposed in the present invention and the standard value is used as the evaluation value of the experimental result.
[0091] The experiment uses two different shapes of polygonal markers for testing. Figure 2 As shown in the figure, it is a rectangle with a length and width of 1.0mm*1.2mm. Figure 8 As shown in the figure, it is an equilateral triangle with a side length of 2.8 mm. During the experiment, 50 images were collected for each marker point, where the image size of marker point 1 was 480 pixels * 512 pixels, and the image size of marker point 2 was 1936 pixels * 1216 pixels. The algorithm proposed in the present invention was used to identify the 50 images of marker point 1 and the 50 images of marker point 2.
[0092] The experimental test results are shown in Tables 1 and 2 below. As can be seen from Table 1, for mark point 1, the maximum deviation of the center point of the recognition result of the algorithm proposed by the present invention is no more than 0.29 pixels, and the maximum angle deviation is no more than 0.17° compared with the standard result. As can be seen from Table 2, for mark point 2, the maximum deviation of the center point of the recognition result of the algorithm proposed by the present invention is no more than 0.30 pixels, and the maximum angle deviation is no more than 0.15° compared with the standard result. The above shows that the recognition result of the algorithm proposed by the present invention is highly accurate. It can be found from Tables 1 and 2 that the standard deviation of the center point deviation and the angle deviation for the recognition of mark point 1 and mark point 2 by the algorithm proposed by the present invention does not exceed 0.1, indicating that the recognition result of the algorithm proposed by the present invention is highly stable. In addition, it can be seen from Tables 1 and 2 that the average time consumed by the algorithm proposed by the present invention for the recognition of mark point 1 is only 10.53ms, and the average time consumed for the recognition of mark point 2 is only 13.23ms, indicating that the algorithm proposed by the present invention has a fast recognition speed and good real-time performance.
[0093] Table 1 Statistics of recognition results of marker 1
[0094]
[0095] Table 2 Statistics of recognition results of marker 2
[0096]
[0097] In Table 1 and Table 2, ΔX, ΔY, and ΔR respectively represent the differences between the center point x, center point y, and rotation angle R of the algorithm recognition results and the reference standard values.
[0098] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited thereto. Within the technical concept of the present invention, the technical solution of the present invention can be subjected to a variety of simple modifications, including the combination of various specific technical features in any suitable manner. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations. However, these simple modifications and combinations should also be regarded as the contents disclosed by the present invention and belong to the protection scope of the present invention.
Claims
1. A method for quickly identifying and locating polygonal markers, characterized in that: The following steps are involved: Extract the contour of the polygonal marker image and filter out the target contour; The gradient amplitude of the target contour points is used to filter out the weak edge contour points and retain the strong edge contour points. The gradient direction of the strong edge contour points is used to estimate the rotation angle of the target contour. The coordinate mean of the strong edge contour points is used to estimate the center of the target contour to complete the rough positioning. The rotation angle is corrected by taking the estimated center as the rotation center using the rotation projection statistics method to complete the correction of the rough positioning result, including the following processes: taking the rotation angle as the intermediate value, determining the rotation projection angle range within a preset small neighborhood; taking the estimated center as the rotation center, within the determined rotation projection angle range, performing coordinate rotation transformation on the retained strong edge contour points at various angles according to the angle step, to obtain multiple rotation point sets; performing horizontal and vertical projections on each rotation point set to obtain horizontal and vertical projection histograms, and counting the sum of projection numbers corresponding to the projection extreme value points in the horizontal and vertical projection histograms corresponding to each rotation angle; finally taking the angle value corresponding to the case where the sum of the projection numbers is the largest as the rotation angle correction value of the polygon to be detected; The corrected coarse positioning result is used as the initial value for registration to obtain the precise positioning result of the polygonal marker point.
2. The method according to claim 1, characterized in that The contour of the polygonal marker image is extracted and the target contour is screened out. The process includes: Extract the region of interest of the polygonal marker image. The formula is as follows: ROIW = ( BRw + Sw ) * 1000 / ScaleX, ROIH = ( BRh + Sh )*1000 / ScaleY, where ROIW , ROIH Respectively represent the length and width of the region of interest, in pixels; BR , BnB They represent the theoretical length and width of the smallest circumscribed rectangle of the polygonal marker to be detected when it is placed horizontally, in mm. Sw , Sh They represent the set detection range, in mm; ScaleX and ScaleY represent the horizontal and vertical pixel sizes of the camera, in μm / pixel; The Canny algorithm is used to extract the edge of the region of interest, and then the connected domain method is used to obtain one or more connected candidate contours; The candidate contours are preliminarily screened using area, perimeter, convexity or shape features, and then contour evaluation values are calculated for nested contours with similar centers. The contour with the smallest evaluation value is retained and other contours are removed to screen out the target contour.
3. The method according to claim 2, characterized in that The calculation of the contour evaluation value for the nested contours with similar centers refers to calculating the coordinate mean of each contour point set as the estimated center of the current contour after the preliminary screening, and putting two contours with an estimated center distance less than a threshold into a candidate group as nested contours. Finally, the evaluation value is calculated for multiple contours in the candidate group with a nested relationship. The formula is as follows: Among them, Radio is the contour evaluation value. The smaller it is, the closer the current contour is to the ideal contour. C real represents the actual perimeter of the candidate contour currently detected, C0 represents the theoretical perimeter of the current detection mark point calculated by theoretical parameters and pixel size, S real represents the actual closed area of the candidate contour currently detected, S0 represents the theoretical area of the current detection mark point calculated by theoretical parameters and pixel size, α, β, γ are weight coefficients, α+β+γ=1, Rc Represents the profile convexity.
4. The method according to claim 1, characterized in that The method uses the gradient amplitude of the target contour points to filter out weak edge contour points, retains strong edge contour points, estimates the rotation angle of the target contour using the gradient direction of the strong edge contour points, and estimates the center of the target contour using the coordinate mean of the strong edge contour points. The specific process is as follows: The Sobel operator is used to calculate the gradient information of all target contour points, including gradient amplitude and gradient direction, and the weak edge points with gradient amplitude less than the threshold in the target contour point set are screened out, and the strong edge points are retained; For a single connected target contour, the mean of the retained strong edge points is used as the estimated value of the target contour center; The gradient direction of the strong edge points of a single connected target contour is unified to (0°, 360°] and rounded. The frequency of occurrence of different angle values is counted to obtain an angle statistical histogram. The angle statistical histogram is divided into multiple intervals according to the number of edges of the polygon marker points. The interval length is divided according to the proportional relationship of the internal angles of the polygon marker points. The angle value corresponding to the maximum point of the histogram in each interval is found. When searching for the maximum point, the sum of the number in the three neighborhoods of the search position is used as the statistical value of this position. The angle value corresponding to the maximum point of the histogram in each interval is converted to close to 0° or 360° according to the angle relationship between each edge and the adjacent edge. After eliminating the abnormal angles that deviate from the mean in the angle set after conversion, the mean of the remaining angles is used as the rotation angle estimate of the current polygon marker point.
5. The method according to claim 4, characterized in that When the polygonal marker is a rectangular or regular polygonal marker, the rotation angle estimation process is as follows: (1) Unify the gradient direction of the strong edge points of a single connected target contour to (0°, 360°] and round it; (2) Count the frequencies of different angle values to obtain the angle statistical histogram; (3) Divide the angle statistics histogram into n intervals evenly, where n is the number of edges of the polygonal markers to be detected; (4) Find the angle value corresponding to the maximum point of the histogram in each interval; (5) Calculate the internal angle of the polygonal marker to be detected in the theoretical case θ c ; (6) Perform n-1 angle conversions on the angle values corresponding to each maximum point according to the following formula: ; i =1,2,...,n-1, where i Indicates the number of angle conversions, 1≤ i ≤ n -1 ,θ i and θ i 'represents the gradient direction corresponding to each maximum point in the i The angle values before and after the conversion; (7) If the internal angle is less than or equal to 90 degrees, perform an angle conversion on the angle values corresponding to each maximum point after conversion according to the following formula: ; Otherwise, perform an angle conversion on the angle values corresponding to each maximum point after conversion according to the following formula: in, θ and θ i 'Represents the angle value of the gradient direction corresponding to each maximum point before and after the conversion; Calculate the mean of the angle values corresponding to each maximum point after conversion, and remove the maximum abnormal angle value that deviates from the mean; Calculate the mean of the remaining angle values as the rotation angle estimate of the current polygon to be detected.
6. The method according to claim 1, characterized in that The transformation formula of the multiple rotation point sets is as follows: ,in, P x , P y Respectively represent the original horizontal and vertical coordinates of the point to be transformed, P x '、 P y 'respectively represent the horizontal and vertical coordinates of the point to be transformed after rotation transformation, P cx , P cy Respectively represent the horizontal and vertical coordinates of the rotation center, ω Indicates the rotation angle.
7. The method according to any one of claims 1 to 6, characterized in that: The method of using the corrected rough positioning result as the initial value to perform registration to obtain the precise positioning result of the polygonal marker point includes the following process: Obtaining corresponding sub-pixel contour points based on the retained strong edge contour points; Creating a template point set based on the size parameters of the polygonal marker points to be detected and the pixel size information of the camera; The corrected coarse positioning result is used as the initial value, and the sub-pixel contour points and the template point set are registered between the point sets to obtain the precise positioning result of the polygonal marker point to be detected.
8. The method according to claim 7, characterized in that The template point set is created based on the size parameters of the polygonal marker points to be detected and the pixel size information of the camera, specifically: The theoretical pixel length of each side of the polygonal marker to be detected is calculated using the size parameters of the polygonal marker to be detected and the pixel size information of the camera. The formula is as follows: , where L is the side length of the polygonal marker to be detected, l is the theoretical pixel length of the edge length of the polygon marker to be detected. ScaleX, ScaleY are the pixel sizes of the camera in the X and Y directions respectively, λ is the angle between the side L of the polygonal marker to be detected and the X direction, in radians, which is calculated by the estimated rotation angle of the polygonal marker to be detected and the internal angles of the polygonal marker to be detected; Taking the origin as the center point of the template to be built, calculate the coordinate values of each vertex of the polygonal marking template to be built at 0°; The number of strong edge points of the single connected target contour to be detected is used as the total number of template point sets to be constructed. The number of template points corresponding to each edge is determined according to the ratio of the length of each edge to the perimeter. The coordinate values of the two vertices corresponding to each edge are used to determine the coordinates of the template contour points of each edge by equally spaced sampling to obtain the final template point set.
9. A polygonal marker point rapid identification and positioning system, characterized in that: The following steps are involved: The target contour extraction module is used to extract the contour of the polygonal marker image and filter out the target contour; A coarse positioning module is used to filter out weak edge contour points by using the gradient amplitude of the edge contour points of the target contour, retain the strong edge contour points, estimate the rotation angle of the target contour by using the gradient direction of the strong edge contour points, and estimate the center of the target contour by using the coordinate mean of the strong edge contour points to complete the coarse positioning; The rough positioning result correction module is used to correct the rotation angle with the estimated center point as the rotation center by using the rotation projection statistics method to complete the correction of the rough positioning result, including the following processes: taking the rotation angle as the intermediate value, determining the rotation projection angle range within a preset small neighborhood; taking the estimated center as the rotation center, within the determined rotation projection angle range, performing coordinate rotation transformation on the retained strong edge contour points at various angles according to the angle step length to obtain multiple rotation point sets; performing horizontal and vertical projections on each rotation point set to obtain horizontal and vertical projection histograms, and counting the sum of the projection numbers corresponding to the projection extreme value points in the horizontal and vertical projection histograms corresponding to each rotation angle; and finally taking the angle value corresponding to the maximum sum of the projection numbers as the rotation angle correction value of the polygon to be detected; The fine positioning module is used to obtain the fine positioning result of the polygonal marker point by using the corrected coarse positioning result as the initial value for registration.
10. A machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the method for rapid identification and positioning of polygonal marker points as described in any one of claims 1-8.
Citation Information
Patent Citations
Lane line extraction method and device and computer equipment
CN111080662A
BGA element rapid identification and positioning method and system, and storage medium
CN117392211A