A target localization method based on Zernike moments and geometric constraints

By using an adaptive Zernike moment edge parameter threshold and target geometric constraints, the positioning error problem of traditional Zernike moment edge detection in different scenarios is solved, achieving high-precision target positioning and meeting the accuracy requirements of long-distance, large field-of-view measurements.

CN117218206BActive Publication Date: 2026-01-06HANGZHOU URBAN CONSTR & INVESTMENT GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311184350.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-14
Publication Date
2026-01-06
Estimated Expiration
2043-09-14

AI Technical Summary

Technical Problem

Traditional Zernike moment edge detection algorithms require continuous adjustment of edge parameter thresholds in different scenarios, resulting in the loss of false edges and target edges, which cannot meet the requirements of high-precision target positioning, especially in long-distance, large field-of-view measurement scenarios where the positioning error is large.

Method used

An adaptive Zernike moment edge parameter thresholding and target geometric constraint method is adopted. By image interpolation, edge parameter calculation and iterative threshold determination, and target geometric information is combined to optimize the edge judgment conditions, thereby improving the edge detection accuracy and robustness.

Benefits of technology

It achieves finer target edges and more precise positioning, meeting the high-precision target positioning requirements in different environments, with a positioning accuracy of ±0.01mm. It simplifies the detection process and improves detection efficiency and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117218206B_ABST
    Figure CN117218206B_ABST
Patent Text Reader

Abstract

The application discloses a target positioning method based on Zernike moments and geometric constraints, which comprises the following steps: collecting images, and performing interpolation after cutting out the area where the target is located; adopting an improved Zernike moment sub-pixel edge detection algorithm, and utilizing the geometric relationship of the target pattern to adaptively adjust the background gray threshold value in the Zernike moment, so as to realize edge extraction of the target object; and utilizing the edge coordinates of the target pattern to perform target positioning. The application can solve the problems of edge positioning deviation and pseudo edge of the traditional Zernike moment sub-pixel edge detection method, can adaptively adjust the edge parameter threshold value of the Zernike moment sub-pixel detection, has better robustness, and improves the accuracy of edge extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine vision measurement, and specifically relates to a target localization method based on adaptive Zernike moment edge parameter threshold and target geometric constraints. Background Technology

[0002] The method of using target features for localization can measure the vibration and subsidence of large buildings at long distances. Compared with traditional methods such as fiber optic sensing, total station, and GPS, this method has a significantly lower cost and a wider range of applications.

[0003] As detection accuracy requirements increase, traditional edge extraction algorithms are unable to meet these demands. Zernike moments are a sub-pixel edge detection algorithm known for their strong noise resistance, high detection accuracy, and good stability. However, because Zernike moments require continuous adjustment of three edge parameter thresholds under different scenarios, excessively large or small values ​​can easily lead to numerous false edges and the loss of many target edges. Traditional Zernike moment edge determination methods only utilize two thresholds: the distance from the center of the circle to the edge pixel and the edge step intensity. Traditional edge determination methods are unsuitable for measurement scenarios with long distances and large fields of view. Due to the limited pixel information in the target image, changes in lighting or weather conditions can result in numerous false edges or inaccurate edge localization. Errors in edge localization will lead to target localization deviations. Summary of the Invention

[0004] To address the shortcomings of existing target localization methods, this invention proposes an adaptive Zernike moment edge parameter threshold and target geometric constraints target localization method. By using target geometric information to adaptively set the Zernike moment edge parameter threshold, the method solves the problem of edge localization deviation in traditional Zernike moments, resulting in finer, more accurate target edges with better robustness.

[0005] The present invention adopts the following technical solution:

[0006] This invention provides a target localization method based on Zernike moments and geometric constraints, comprising the following steps:

[0007] 1) Image acquisition: Images are acquired using an industrial camera, and the area of ​​interest is cropped out.

[0008] 2) Image interpolation: The region of interest image is interpolated by a factor of three to obtain the target image;

[0009] 3) Edge parameter calculation: Use Zernike moments to calculate edge parameters for the target image: edge step intensity k, background gray level h, vertical distance l from the center of the unit circle to the edge, and the angle θ between the line connecting the edge position point (x,y) and the center of the unit circle and the x-axis.

[0010] 4) Edge parameter threshold determination: The edge parameter threshold is calculated iteratively based on the geometric information on the target image;

[0011] 5) Edge extraction: Edge detection in the target image is achieved based on the edge parameter thresholds obtained in step 4);

[0012] 6) Target positioning: Calculate the target center position based on the edge obtained in step 5);

[0013] Step 4) is as follows:

[0014] The Zernike rectangular edge determination criteria are designed as follows:

[0015] l≥l t ∩k≤k t ∩h t ≤h≤h t +β (1)

[0016] Among them, l t The threshold value is the vertical distance from the center of the inscribed circle of the template to the edge. An N×N template is used to convolve the pixel grayscale matrix of the target image, and then... Edge step intensity threshold G max The maximum grayscale value of a pixel in the target image of step 2); β is the grayscale value range coefficient, which takes a value between 15 and 30; the background grayscale threshold h t The optimal straight-line fit is obtained through bisection iteration, as detailed below:

[0017] Step 1: The four straight lines at the top, bottom, left, and right of the sector boundary of the target image are denoted as l1, l2, l3, and l4, respectively.

[0018] Step 2: Calculate the average gray value Gm of the pixels in the target image. Use the average gray value Gm to set the upper bound Gm+γ and the lower bound Gm-γ of the bisection method. Generally, γ is taken as 40.

[0019] Step 3: Define the loss function Ep. The line L is fitted using the least squares method from each edge point on line l1 and l2. m The degree of fit R sm And the line L fitted by the least squares method at each edge point on lines l3 and l4. n The degree of fit R sn Adding them together, we get:

[0020] Ep = R sm +R sn (2)

[0021] Step 4: Using the binary search method, find the background grayscale threshold h in the interval [Gm-γ, Gm+γ] where the loss function Ep is less than the loss function threshold. t If the search results for a loss function Ep less than the loss function threshold are empty within the interval [Gm-γ, Gm+γ], then increase the value of γ or the loss function threshold, and re-search for a background grayscale threshold h where the loss function Ep is less than the loss function threshold. t Until it is found.

[0022] Preferably, in step 2), the Lanczos method is used to perform triple interpolation on the region of interest image;

[0023] The formula for calculating the Lanczos kernel is:

[0024]

[0025] Where d represents the distance between the current center pixel and the 9 neighboring pixels, and r represents the interpolation radius, with a value of 4.

[0026] Preferably, the calculation of edge parameters using Zernike moments in step 3) specifically involves:

[0027] Step 1: Calculate the Zernike moments of the target image. The nth-order m-th Zernike moment of the target image f(x,y) is defined as follows:

[0028]

[0029] In the formula, ρ is the distance from the edge point (x, y) to the center of the unit circle.

[0030] in With the integral kernel function V inside the unit circle nm (ρ,θ) conjugate, integral kernel function V nm (ρ,θ) is represented as:

[0031] V nm (ρ,θ)=R nm e jmθ =V nm (x,y) (5)

[0032] R nm For Zernike polynomials, the expression is as follows:

[0033]

[0034] Step 2: Based on the rotational invariance of Zernike moments, obtain the Zernike moment Z before rotation. nm and the rotated Zernike moment Z' nm Relationship:

[0035] Z′ nm =Z nm e -jmθ (7)

[0036] Step 3, via Z 00 Z 11 Z 20 The edge parameters are calculated using three Zernike moments, Z 00 Z 11 Z 20 The corresponding complex numbers are V 00 =1, V 11 =x+jy、V 20 =2x 2 +2y 2 -1; Due to rotation invariance, according to equation (7), we get:

[0037]

[0038] Based on these three Zernike moments, four edge parameters are obtained:

[0039]

[0040] Preferably, R sm The definition of is:

[0041]

[0042] in Let N1 be the coordinates of the i-th edge point on lines l1 and l2, where the edge point is the pixel whose edge parameters k, h, and l satisfy the condition in equation (1); N1 is the total number of edge points on lines l1 and l2; a m For line L m The slope, b m For line L m The intercept, This represents the average y-value of each edge point on lines l1 and l2;

[0043] R sn The definition of is:

[0044]

[0045] in Let N1 be the coordinates of the i-th edge point on lines l3 and l4, and N2 be the total number of edge point coordinates on lines l3 and l4.n For the line L n The slope, b n For line L n The intercept, This represents the average y-value of each edge point on lines l3 and l4.

[0046] Preferably, in step 5), the edge points in the target image are detected using equation (1), and the pixels that satisfy the determination condition of equation (1) are the edge points.

[0047] Preferably, step 6) is as follows:

[0048] Step 1: Substitute the edge point coordinates (x, y) into equation (13) to obtain the subpixel coordinates (x', y');

[0049]

[0050] Hough detection is used to perform rectangle detection on sub-pixel coordinates, and the centroid O1 of the rectangle is obtained based on the four vertices of one of the rectangles.

[0051] Step 2: Use Hough detection to perform circular detection on sub-pixel coordinates and obtain the center O2 of the circle;

[0052] Step 3: Refit the subpixel coordinates on the two mutually perpendicular straight lines inside the circle, and calculate the intersection point O3 of the two fitted lines.

[0053] Step 4: Calculate the average coordinates of O1, O2, and O3 to obtain the target center coordinates O in the current target image. o .

[0054] The beneficial effects of this invention are:

[0055] 1) This invention uses machine vision to locate the specific position of the current target, which simplifies the steps and improves detection accuracy and efficiency;

[0056] 2) This invention improves upon the traditional Zernike moment edge extraction algorithm by adding a background grayscale threshold h to the edge determination criteria. t Background grayscale threshold h t This method utilizes the geometric information of the target to find the optimal threshold within the grayscale range using a bisection method. This is more efficient than traditional manual methods based on experience or trial and error. It also surpasses the traditional method of using only the vertical distance from the center to the edge for thresholding. t and edge step intensity threshold k t As an edge detection criterion, finer edges result in higher positioning accuracy and better robustness, meeting the target positioning needs in different environments. Attached Figure Description

[0057] Figure 1 This is a flowchart of the method of the present invention.

[0058] Figure 2 These are images acquired from a target.

[0059] Figure 3 It is a target subpixel edge image.

[0060] Figure 4 It is a target edge image obtained using the traditional Zernike moment method.

[0061] Figure 5 It is a target edge image obtained using the method of the present invention. Detailed Implementation

[0062] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0063] like Figure 1 As shown, a target localization method based on Zernike moments and geometric constraints includes the following steps:

[0064] 1. After the industrial camera is calibrated, images are acquired, and the region of interest containing only the target pattern is cropped. If the acquired image is a color RGB image, it needs to be converted to a grayscale image.

[0065] 2. The cropped region of interest is interpolated threefold using the Lanczos method to obtain the target image, such as... Figure 2 .

[0066] 3. Use Zernike moments to calculate edge parameters pixel by pixel: edge step intensity k, background gray level h, vertical distance l from the center of the unit circle to the edge, and the angle θ between the line connecting the edge position point and the center of the unit circle and the x-axis.

[0067] 4. The Zernike rectangular edge determination condition of the present invention is as follows:

[0068] l≥l t ∩k≤k t ∩h t ≤h≤h t +β (1)

[0069] Among them l t The threshold value is the vertical distance from the center of the inscribed circle of the template to the edge. In this embodiment, the template is N×N, l t Pick k t k is the threshold for edge step intensity. t Based on the maximum gray value G of the pixels in the target image max One-tenth of it is determined, that is, k t Pick

[0070] Where β is the grayscale value range, and in this embodiment, β is taken as 15. Background grayscale threshold h t The optimal straight-line fit is obtained through bisection iteration, as detailed below:

[0071] Step 1: The four straight lines at the intersection of the fan-shaped target pattern are l1, l2, l3, and l4, corresponding to the top, bottom, left, and right respectively, as shown below. Figure 2 .

[0072] Step 2: Calculate the average gray value Gm of the pixels in the target image. Use the average gray value Gm to set the upper and lower bounds of the bisection method Gm-γ and Gm+γ, where γ is set to 40.

[0073] The average gray value Gm is calculated using the following formula:

[0074]

[0075] Where G(x,y) is the gray value of the current pixel, and M is the number of all pixels.

[0076] Step 3: Define the loss function Ep, where Ep is a vertical line L formed by two straight lines l1 and l2. m The degree of fit R sm And the horizontal line L formed by the two straight lines l3 and l4 on the left and right. n The degree of fit R sn Adding them together, we get:

[0077] Ep = R sm +R sn (3)

[0078] When the straight line L m and line L n The better the fit, the higher the R value. s The closer it is to 0, the smaller the loss function Ep is.

[0079] Step 4: Use the bisection method to find the threshold h in the interval [Gm-γ, Gm+γ] where the loss function Ep is less than the loss function threshold tar. t The specific steps are as follows:

[0080] ① Define the loss function threshold as tar = 0.01, the starting index as start = Gm - γ, and the ending index as end = Gm + γ.

[0081] ② If start > end, it means that the search results for loss function Ep less than loss function threshold tar in the interval [Gm-γ, Gm+γ] are empty, then proceed to step ⑥; otherwise, proceed to step ③.

[0082] ③ Calculate the intermediate index mid, at this time

[0083] ④ Substitute the start index start, end index end, and middle index mid into h in equation (1) respectively. t Edge detection is performed to obtain three different sets of edge point coordinates, which are then substituted into equation (3) to calculate the loss function value Ep. start Ep end and Ep mid .

[0084] ⑤ If Ep mid <tar> indicates that the target value of the loss function has been found and the calculation ends. If Ep mid If the value is greater than or equal to tar, then perform the following operations:

[0085] If Ep start <Ep mid <Ep end or Ep mid <Ep start <Ep end This indicates that the target value may be in the left half. Update the ending index to mid and return to step ②.

[0086] If Ep end <Ep mid <Ep start or Ep mid <Ep end <Ep start This indicates that the target value may be in the right half. Update the starting index to mid and return to step ②.

[0087] ⑥ Increase the value of γ or the threshold of the loss function, reset the starting index to start = Gm - γ, and the ending index to end = Gm + γ, and return to step ② until a loss function Ep less than the loss function threshold tar is found. mid The corresponding intermediate index is the threshold h. t .

[0088] 5. Detect edges in the target image using a determined Zernike threshold. That is, if the Zernike moment calculated for the current pixel satisfies the condition in equation (1), then the current pixel is an edge point. Figure 5 As shown.

[0089] 6. Calculate the target center position based on the edge obtained in step 5), as follows:

[0090] Substituting the current pixel coordinates (x, y) into equation (4) yields the subpixel coordinates (x', y'), as follows: Figure 3 As shown.

[0091]

[0092] Hough detection is used to perform rectangle detection on subpixel edges, and the centroid O1 of the rectangle is obtained based on the four vertices of one of the rectangles.

[0093] Hough detection is used to perform circular detection on sub-pixel edges, obtaining the center O2 of the circle and the radius r. The current pixel equivalent is obtained using the radius r and the actual physical radius.

[0094] The subpixel coordinates on two mutually perpendicular straight lines inside the circle are refitted to obtain the slopes a1 and a2 and the intercepts b1 and b2 of the two lines. The intersection point O3 of the two fitted lines is then calculated.

[0095] Calculate the average coordinates of O1, O2, and O3 to obtain the target center coordinates O in the current target image. o .

[0096] In this embodiment, Figure 4 It is an edge image obtained from traditional Zernike moments. Figure 5 The image shows the edge image obtained by this invention. As can be seen, the edge obtained by this invention is finer and more accurate, meeting the target positioning requirements in different environments. Furthermore, experimental verification shows that at a measurement distance of 1.4 meters, the target positioning accuracy reaches ±0.04 pixels, or ±0.01 mm, demonstrating good positioning performance and meeting the accuracy requirements in various environments.

Claims

1. A target positioning method based on Zernike moments and geometric constraints, characterized in that: The method comprises the following steps: 1) image acquisition: using an industrial camera to acquire an image, and cropping a region of interest image; 2) image interpolation: tripling the region of interest image to obtain a target image; 3) edge parameter calculation: using Zernike moments to calculate edge parameters of the target image: edge step intensity k, background gray level h, vertical distance l from the center of the unit circle to the edge, edge position point (x, y), and the angle θ between the connecting line of the center of the unit circle and the x-axis; 4) edge parameter threshold determination: according to the geometric information on the target image, iteratively calculating the edge parameter threshold; 5) edge extraction: detecting the edge in the target image according to the edge parameter threshold obtained in step 4); 6) target positioning: calculating the target center position according to the edge obtained in step 5); In step 4), the edge determination condition of Zernike moments is designed as follows: Step one: the upper, lower, left and right four straight lines of the target image are respectively denoted as l1, l2, l3 and l4; l ≥ l t ∩k ≤ k t ∩h t ≤ h ≤ h t + β (1) wherein, l t is the vertical distance threshold from the center of the inscribed circle of the template to the edge, the pixel gray value matrix of the target image is convolved with a template of size N x N, and the maximum value is taken Edge step intensity threshold G max is the maximum gray value of the pixels in the target image of step 2); β is a gray value range coefficient, which is valued between 15 and 30; the background gray threshold h t is obtained by bisection iterative search for the best straight line fitting goodness, specifically as follows: Step two: the average gray value Gm of the pixels in the target image is calculated, and the upper limit Gm+γ and the lower limit Gm-γ of the bisection method are set according to the average gray value Gm, and γ is generally 40; In step 2), Lanczos method is used for tripling interpolation of the region of interest image; Step three, set the loss function Ep = R of the fitting degree of the straight line L fitted by the least square method for each edge point on the straight line l1, l2 m R sm of the fitting degree of the straight line L fitted by the least square method for each edge point on the straight line l3, l4 n R sn is added, that is: Ep = R sm +R sn (2) Step four, finding the background gray threshold h with loss function Ep less than the loss function threshold in the interval [Gm-γ, Gm+γ] by dichotomy t If the search result is empty, increase the value of γ or the loss function threshold, and find the background gray threshold h with loss function Ep less than the loss function threshold again t until the background gray threshold h with loss function Ep less than the loss function threshold is found. 2.The target positioning method based on Zernike moments and geometric constraints according to claim 1, characterized in that: The calculation formula of Lanczos kernel is as follows: Wherein, d represents the distance between the current center pixel point and the nearby 9 pixel points, and r represents the interpolation radius, and r takes the value of 4. In step 3), the Zernike moments are used to calculate the edge parameters, which are as follows: 3.The target positioning method based on Zernike moments and geometric constraints of claim 1, wherein: Step one: calculate the Zernike moments of the target image, and the n-order m-time Zernike moments of the target image f(x, y) are defined as follows: According to the three Zernike moments, four edge parameters are obtained: where p is the distance from the edge position point (x, y) to the center of the unit circle, wherein with the integral kernel function V nm (ρ,θ) are conjugate, the integral kernel function V nm (ρ,θ) is represented as: R nm Zernike polynomials, the expression is as follows: Step two, according to the Zernike moment rotation invariance, get the Zernike moment Z before rotation nm and the Zernike moment Z' after rotation nm relationship: Step three, by Z 00 , Z 11 , Z 20 Three Zernike moments calculate edge parameters, Z 00 , Z 11 , Z 20 The corresponding complex numbers are V 00 = 1, V 11 = x + jy, V 20 = 2x 2 + 2y 2 - 1; due to rotational invariance, according to equation (7): In step 5), the edge points in the target image are detected by using formula (1), and the pixel points satisfying the determination condition of formula (1) are the edge points.

4. The method of claim 1, wherein: R sm The definition of is: wherein is the i-th edge point coordinate on the straight line l1, l2, the edge point being a pixel point satisfying the determination condition of formula (1) for the edge parameters k, h and l; N1 is the total number of edge points on the straight line l1, l2; a m is the slope of the straight line L m , b m is the intercept of the straight line L m , is the average value of the y values of the edge points on the straight line l1, l2. R sn The definition of is: wherein is the i-th edge point coordinate on the straight line l3, l4, N2 is the total number of edge point coordinates on the straight line l3, l4, a n is the slope of the straight line L n , b n is the intercept of the straight line L n , is the average value of the y values of the edge points on the straight line l3, l4.

5. The method of claim 1, wherein: Step 6) is as follows:

6. The method of claim 1, wherein: Step one: substitute the edge point coordinates (x, y) into formula (13) to obtain the sub-pixel coordinates (x', y'); Use Hough detection to detect the sub-pixel coordinates, and obtain the centroid O1 of the rectangle according to the four vertices of one of the rectangles; Step two: use Hough detection to detect the sub-pixel coordinates, and obtain the center O2 of the circle; Step three: re-fit the sub-pixel coordinates on the two mutually perpendicular straight lines in the circle, and calculate the intersection point O3 of the two straight lines obtained by fitting. ​ Step four, calculate the average coordinates of O1, O2, O3, to obtain the target center coordinate point O of the current target image o .

Citation Information

Patent Citations

  • Improved Zernike moment edge detection method

    CN102637300A

  • Battery piece image sub-pixel edge detection method and device and storage medium

    CN116309275A