A sub-pixel extraction method based on function fitting

By using a function fitting method to calculate image gradient and orientation, and combining the Gauss-Newton method to fit the function, the problems of noise sensitivity and model complexity in existing technologies are solved, and high-precision sub-pixel edge detection is achieved.

CN114663455BActive Publication Date: 2026-05-15JUSHILINGZHEN TECH (ZHEJIANG) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JUSHILINGZHEN TECH (ZHEJIANG) CO LTD
Filing Date
2022-03-22
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing subpixel edge detection fitting algorithms suffer from noise sensitivity and model complexity, making it difficult to achieve high-precision and efficient edge detection.

Method used

A function-fitting approach is adopted. By obtaining the region of interest in the image, calculating the gradient and gradient direction, and using the fitting function, sub-pixel edge points are extracted. The Gauss-Newton method is then used to fit the expression of the fitting function to locate the sub-pixel points.

Benefits of technology

It improves the accuracy and robustness of edge detection, reduces noise sensitivity, simplifies model complexity, and achieves more efficient sub-pixel level detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114663455B_ABST
    Figure CN114663455B_ABST
Patent Text Reader

Abstract

The application discloses a sub-pixel extraction method based on function fitting, which comprises the following main steps: acquiring an image, positioning a region of interest (ROI), extracting a pixel-level edge feature point in the region of interest (ROI), and extracting a sub-pixel edge point at the pixel-level edge feature point extracted in step two by means of function fitting. A new function is used to fit the pixel value at the edge of an object on the image, and the function has better fitting effect for a step edge, is more resistant to noise, and has better robustness. For a line edge, the function can still be well fitted, and a point at the sub-pixel level of the line edge is obtained by solving a point at which the derivative near an extreme value is 0, so that an optimized fitting algorithm solution is provided for sub-pixel extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of high-precision dimension detection technology, specifically a sub-pixel extraction method based on function fitting. Background Technology

[0002] With the rapid development of precision manufacturing, the measurement accuracy of precision parts has also increased. High-precision, high-efficiency, non-contact, full-field-of-view, and highly automated dimensional measurement has become a development trend. Industries such as precision ceramics manufacturing, precision electronics manufacturing, and precision mold making have increasingly higher requirements for dimensional measurement accuracy. Among these, edge feature point extraction from images is an important technology, its working principle being the detection of discontinuities in brightness. Higher edge detection accuracy leads to more precise measurement of object dimensions. Furthermore, sub-pixel edge detection algorithms outperform traditional pixel-level edge detection algorithms, improving edge localization accuracy without increasing camera resolution, thus saving hardware costs.

[0003] Many types of algorithms have emerged for sub-pixel edge detection, mainly including three categories: moment methods, fitting methods, and interpolation methods. The basic idea of ​​the fitting method is to assume that the gray-level distribution near the edge point follows a certain function curve, generally called an edge model. The assumed edge model is then used to fit these pixels to obtain the edge position parameters. However, commonly used fitting algorithms have drawbacks such as sensitivity to noise and relatively complex models.

[0004] Chinese invention patent application CN202110832560.3 discloses a sub-pixel edge detection method, system, and medium. The method includes: Step S1: performing pixel-level edge detection using the Canny operator; Step S2: based on the Canny edge detection, using both an Arctan function-based fitting algorithm and a Zernike moment estimation algorithm, and combining the results of the two methods to reduce errors. This invention improves the sub-pixel edge detection method, thereby achieving comprehensive, fast, and accurate sub-pixel-level detection. However, this algorithm does not effectively address the noise sensitivity problem and still suffers from model complexity. Summary of the Invention

[0005] The purpose of this invention is to provide a sub-pixel extraction method based on function fitting, so as to solve the problems of noise sensitivity and complex models in the existing sub-pixel edge detection fitting algorithms mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a sub-pixel extraction method based on function fitting, characterized by comprising the following steps:

[0007] Step 1: Acquire the image and locate the Region of Interest (ROI);

[0008] Step 2: Extract pixel-level edge feature points within the region of interest (ROI);

[0009] Step 3: At the pixel-level edge feature points extracted in Step 2, sub-pixel edge points are extracted using function fitting; the function expression of the fitting function is:

[0010]

[0011] Where x is the current pixel position, f(x) is the pixel value at the current position, and a, b, c, d, and f are the parameters obtained during fitting.

[0012] Preferably, step two specifically includes the following steps:

[0013] a) Calculate the gradient gra and gradient direction α for each pixel in the region of interest (ROI);

[0014] b) Calculate the x-axis gradient gra_x and y-axis gradient gra_y at each pixel in the region of interest (ROI) using the Sobel operator, and then calculate the gradient gra and its direction α. ​​The calculation formula is as follows.

[0015]

[0016] α=arctan(gra_y / gra_x) (3)

[0017] c) Iterate through the gradients at all pixels of the region of interest (ROI) and take the one with the largest gradient as the feature point at the edge.

[0018] Preferably, step three also includes the following steps:

[0019] d) Based on the pixel-level feature edges, along the gradient direction and the opposite direction of the gradient, according to the step size step, the pixel values ​​at the corresponding positions are obtained by bilinear interpolation, and a total of N pixel values ​​are obtained;

[0020] e) Sort the pixels and pixel values ​​at N positions, and fit the function (1) using the Gauss-Newton method; where x is the current pixel position, f(x) is the pixel value at the current position, and a, b, and c are the parameters to be obtained during fitting.

[0021] f) For step edges, find the second derivative of formula (1) and make the second derivative 0. The solution obtained is the sub-pixel position. For line edges, find the first derivative near the extreme value of formula (1) and make the first derivative 0. The solution obtained is the sub-pixel position.

[0022] Preferably, step f) includes the following steps:

[0023] 1) Given an initial value x0, with an allowable error ε > 0, set k = 0;

[0024] 2) When f(x) k+1 )-f(x k If the value is less than the threshold ε, the algorithm exits; otherwise, 1).

[0025] 3)x k+1 =x k +Δ, substitute into f(x), and return 1).

[0026] Compared with the prior art, the beneficial effects of the present invention are:

[0027] This method provides a novel fitting function for extracting sub-pixel edge points. For step edges, the function better matches the changing trends of various gradient edges, resulting in a better fitting effect. For fitting step edges, the function is more robust against noise and has better robustness. For line edges, the function can still fit well. By solving for points where the derivative is 0 near the extreme value, sub-pixel level points at line edges are obtained, providing a new approach for sub-pixel extraction. Attached Figure Description

[0028] Figure 1 This is a flowchart of a sub-pixel extraction method based on function fitting according to the present invention;

[0029] Figure 2 This is a schematic diagram of a step-shaped edge in an embodiment of the present invention;

[0030] Figure 3 This is a function image of the step edge in an embodiment of the present invention;

[0031] Figure 4 This is a schematic diagram of a linear edge in an embodiment of the present invention;

[0032] Figure 5 This is a function image of the linear edge in an embodiment of the present invention. Detailed Implementation

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

[0034] Please see Figure 1 This invention provides a technical solution: a method based on function fitting, wherein the proposed function expression is:

[0035]

[0036] For subpixel edge point extraction using the fitting method, since pixels exhibit a step change at image edges (see...), Figure 2 Therefore, a function that can grow in a stepwise manner is needed for fitting, and formula (1) can satisfy this condition. Figure 3 The graph shows the function's values: a = 16.9446, b = 15.7822, c = 9.2869e-05, d = 0.7636, and f = 0.8343. The function exhibits a step-like increase near x = 0.2, similar to pixel changes at image edges. Therefore, this function can be used to better fit the grayscale changes of pixel values ​​at image edges.

[0037] For linear edges (see) Figure 4 This function can still fit the trend of function value changes. For example... Figure 5 As shown, the function exhibits a trend of first increasing in a step and then decreasing in a step near x = 1.0. The sub-pixel level line center can be obtained by finding the extreme points of the function.

[0038] The method includes the following steps:

[0039] Step 1: Pixel-level edge feature point extraction within the region of interest. This method includes the following steps:

[0040] a) Calculate the gradient and direction of each pixel in the region of interest;

[0041] The Sobel operator is used to obtain the x-axis gradient gra_x and y-axis gradient gra_y at each pixel in the region of interest, and the gradient gra and gradient direction α are calculated.

[0042]

[0043] α=arctan(gra_y / gra_x) (3)

[0044] b) Iterate through the gradients at all pixels in the region of interest and find the feature point with the largest gradient at the edge.

[0045] Step 2: At the extracted pixel-level edge feature points, sub-pixel edge points are extracted using function fitting (1). This method includes the following steps:

[0046] a) Based on the pixel-level feature edges, along the gradient direction and the opposite direction of the gradient, according to the step size step, the pixel values ​​at the corresponding positions are obtained by bilinear interpolation, and a total of N pixel values ​​are obtained;

[0047] The pixels and pixel values ​​at N locations are sorted in order, and the function (1) is fitted using the Gauss-Newton method.

[0048] Where x is the current pixel position, f(x) is the pixel value at the current position, and a, b, and c are the parameters obtained during fitting.

[0049] b) For step edges, find the second derivative of formula (1) and make the second derivative 0. The solution obtained is the sub-pixel position. For line edges, find the first derivative near the extreme value of formula (1) and make the first derivative 0. The solution obtained is the sub-pixel position.

[0050] For step b) in step two of this invention, the operation steps are as follows:

[0051] 1) Given an initial value x0, with an allowable error ε > 0, set k = 0;

[0052] 2) When f(x) k+1 )-f(x k If the value is less than the threshold ε, the algorithm exits; otherwise, 1).

[0053] 3)x k+1 =x k +Δ, substitute into f(x), and return 1).

[0054] To verify the performance of this invention, experiments were conducted on two standard blocks in this embodiment, and comparative analyses were performed with methods such as Sobel operator feature extraction, quadratic function-based fitting, and sigmoid function-based fitting. The widths of the two standard blocks were 10.0 mm and 15.0 mm, respectively, and the camera resolution was calibrated to 0.0152427 mm.

[0055] Table 1 records the actual measurement values ​​and errors of four methods for measuring a standard block with a width of 10mm. Sub-pixel feature point extraction based on fitting methods all improve measurement accuracy, but the measurement error is minimized by using the sub-pixel feature points obtained through the method presented in this paper. Table 2 records the actual measurement values ​​and errors of four methods for measuring a standard block with a width of 15mm. Again, the measurement error obtained by the method presented in this paper is the smallest. Therefore, in terms of effectiveness, this invention is more advantageous.

[0056] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. The present invention also includes technical solutions composed of any combination of the above technical features.

[0057] Table 1. Experimental comparison of measurements using different feature point extraction methods.

[0058] Subpixel extraction method Actual distance (mm) Measured distance (mm) Measurement error (mm) Sobel operator feature extraction 10.0 9.938 0.062 Based on quadratic function fitting 10.0 9.954 0.046 Fitting based on sigmoid function 10.0 9.951 0.049 This solution method 10.0 9.970 0.030

[0059] Table 2. Experimental comparison of measurements using different feature point extraction methods.

[0060]

[0061]

[0062] The above verification scheme perfectly demonstrates the superiority of this algorithm and is worthy of widespread promotion.

[0063] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A sub-pixel extraction method based on function fitting, characterized in that, Includes the following steps: Step 1: Acquire the image and locate the Region of Interest (ROI); Step 2: Extract pixel-level edge feature points within the Region of Interest (ROI); Step 3: At the pixel-level edge feature points extracted in Step 2, sub-pixel edge points are extracted using function fitting; the extraction method includes the following steps: a) Based on the pixel-level feature edges, along the gradient direction and the opposite direction of the gradient, according to the step size step, the corresponding pixel values ​​are obtained by bilinear interpolation, and a total of N pixel values ​​are obtained; the N pixels and pixel values ​​are sorted in order, and the formula (1) is fitted by the Gauss-Newton method. b) For step edges, find the second derivative of formula (1) and make the second derivative 0. The solution obtained is the sub-pixel position. For line edges, find the first derivative near the extreme value of formula (1) and make the first derivative 0. The solution obtained is the sub-pixel position. The function expression of the fitting function is: (1) Where x is the current pixel position, f(x) is the pixel value at the current position, and a, b, c, d, and f are the parameters obtained during fitting.

2. The sub-pixel extraction method based on function fitting according to claim 1, characterized in that, Step two specifically includes the following steps: a) Calculate the gradient gra and gradient direction α for each pixel in the region of interest (ROI); b) Calculate the x-axis gradient gra_x and y-axis gradient gra_y at each pixel in the region of interest (ROI) using the Sobel operator, and then calculate the gradient gra and its direction α. ​​The calculation formula is as follows: (2) (3) c) Iterate through the gradients at all pixels of the region of interest (ROI) and take the one with the largest gradient as the feature point at the edge.