A method for evaluating precision of sub-pixel edge detection algorithm

By constructing edge models and function models that conform to real-world scenarios to generate standard test images, the accuracy and universality issues of sub-pixel level edge detection algorithm accuracy evaluation in existing technologies are solved, and efficient accuracy evaluation is achieved in various scenarios.

CN119762516BActive Publication Date: 2026-07-03EASY THINKING HANGZHOU TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
EASY THINKING HANGZHOU TECH CO LTD
Filing Date
2024-12-27
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing methods for evaluating the accuracy of sub-pixel-level edge detection algorithms are greatly affected by subjective human factors and cannot reflect application performance in real-world scenarios, resulting in evaluation results that lack practical significance.

Method used

By constructing an edge model that conforms to the real scene, a standard test image is generated using a function model, and the deviation between the detected value and the ideal edge is calculated to obtain the algorithm accuracy.

Benefits of technology

It enables the evaluation of the accuracy of sub-pixel-level edge detection algorithms in various scenarios, avoids the influence of human factors, and improves the accuracy and universality of the evaluation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762516B_ABST
    Figure CN119762516B_ABST
Patent Text Reader

Abstract

The application discloses an evaluation method for precision of a sub-pixel level edge detection algorithm, comprising the following steps: S1, simulating an edge as a straight line or a curve equation, and recording the straight line or the curve equation as an edge line A; presetting a minimum value G1 and a maximum value G2 of gray scales on two sides of the edge line A; establishing an image coordinate system, and recording a distance from a center of an i-th row and j-th column pixel to the edge line A as d ij ; S2, taking the d ij as an independent variable, taking a gray scale value of each pixel point as a dependent variable, constructing a function model, obtaining the gray scale values of different pixel points in the image, and generating a standard test image; the gray scale values of the different pixel points are between the minimum value G1 and the maximum value G2; S3, detecting the standard test image by using the sub-pixel level edge detection algorithm to be evaluated, and obtaining detection values of each point on the edge line A in a real test image coordinate system; and S4, calculating deviations of the detection values from the edge line A in the standard test image, and taking the deviations as the precision of the sub-pixel level edge detection algorithm to be evaluated. The method can construct an edge conforming to a real scene, and is more practical.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and more specifically to a method for evaluating the accuracy of sub-pixel level edge detection algorithms. Background Technology

[0002] Image edge detection is fundamental to computer vision and image processing. Its core purpose is to identify the contours and structural information of objects in an image. Image edges refer to areas in an image where the local grayscale changes significantly. They contain image features and planar geometric parameters. Therefore, the accuracy of image edge detection directly affects the accuracy of subsequent image processing. As the requirements for image edge detection accuracy continue to increase in practical applications, more and more sub-pixel-level edge detection algorithms have emerged.

[0003] Currently, there are two main methods for evaluating the accuracy of sub-pixel level edge detection algorithms: manual annotation and evaluation methods based on ideal edges.

[0004] Manual annotation involves manually annotating the real edges in an image and then comparing the edges extracted by the algorithm with the manually annotated edges. This method is time-consuming and labor-intensive, and human subjective factors may affect the annotation results. Especially when dealing with large-scale datasets, it is difficult to guarantee the consistency and accuracy of the annotations.

[0005] Evaluation methods based on ideal edges generate ideal edge images through theoretical models or specific algorithms, and then compare the ideal edges with the edges extracted by the algorithm being evaluated. While this method avoids the influence of human factors, existing methods for constructing ideal edges simply transform the grayscale changes of the ideal edges into neat, abrupt edges. This simplifies the processing of edges in real-world scenes and fails to simulate the complexity and diversity of image edges in real-world scenarios. Consequently, the accuracy obtained by the algorithm being evaluated using this method cannot reflect its performance in real-world applications, thus exhibiting limitations. Summary of the Invention

[0006] To address the aforementioned technical problems, this invention provides a method for evaluating the accuracy of sub-pixel-level edge detection algorithms. This method can construct edges that conform to real-world scenarios and can generate a variety of complex edges for evaluation within a single model, thereby making the evaluation more practically meaningful.

[0007] Therefore, the technical solution is as follows:

[0008] A method for evaluating the accuracy of sub-pixel level edge detection algorithms includes the following steps:

[0009] S1. Simulate the edge using a straight line equation or a curve equation, and denote it as edge line A; preset the minimum gray value on both sides of edge line A to be G1 and the maximum gray value to be G2; establish an image coordinate system, with i as the row label and j as the column label, and denote one side of edge line A as positive and the other side as negative.

[0010] Remember, d ij = The distance from the center of the pixel in the i-th row and j-th column to the edge line A; its positive or negative value is determined based on the position of the pixel in the i-th row and j-th column relative to the edge line A;

[0011] S2, with d ij With the grayscale value of each pixel as the independent variable and the grayscale value of each pixel as the dependent variable, a function model is constructed to obtain the grayscale value of different pixels in the image and generate a standard test image.

[0012] The function model is a monotonic function, and its derivative has a unique maximum value;

[0013] The grayscale values ​​of the different pixels are between G1 and G2;

[0014] S3. The sub-pixel-level edge detection algorithm to be evaluated is used to detect the standard test image, and the coordinates of each point on the edge line A in the actual image coordinate system are obtained and recorded as the detection value.

[0015] S4. Calculate the deviation between the detected value and the edge line A in the standard test image, and use it as the accuracy of the sub-pixel level edge detection algorithm to be evaluated.

[0016] Furthermore, the evaluation method also includes the following steps:

[0017] S5. Adjust the coefficients of the independent variables, G1 and G2, in the function model of step S2, and repeat steps S2 to S4 to obtain the accuracy evaluation results of the sub-pixel level edge detection algorithm to be evaluated in different transition band widths and different grayscale upper and lower bounds.

[0018] Furthermore, the function model in step S2 is the Sigmoid function, specifically;

[0019]

[0020] Wherein, y(d) ij ) represents the gray value of the pixel in the i-th row and j-th column of the standard test image, and e is a natural constant.

[0021] Furthermore, the function model in step S2 is a hyperbolic tangent function, specifically:

[0022]

[0023] Wherein, y(d) ij) represents the gray value of the pixel in the i-th row and j-th column of the standard test image, and tanh() represents the hyperbolic tangent function operation.

[0024] Furthermore, the function model in S2 is the arctangent function; specifically:

[0025]

[0026] Wherein, y(d) ij ) represents the grayscale value of the pixel in the i-th row and j-th column of the standard test image, and arctan() represents the arctangent function operation.

[0027] Furthermore, the method for calculating the deviation between the detected value and the edge line A in the standard test image in step S4 is as follows:

[0028] 1) Calculate the distance from the detected value to edge line A;

[0029] 2) Calculate the variance of all distance values ​​obtained in 1), and then calculate the root mean square error.

[0030] Furthermore, the method for calculating the deviation between the detected value and the edge line A in the standard test image in step S4 is as follows: calculate the distance from the detected value to the edge line A, determine the positive and negative signs based on the position of the detected value relative to the edge line A, and record the final determined positive and negative signs and distance value as numerical value B;

[0031] Based on the numerical value B, calculate any one of the following: range, sum of squares of deviations from the mean, variance, standard deviation, and coefficient of variation, and use it as the deviation.

[0032] This method acquires the pixel image of the ideal edge ground truth by pre-setting an edge equation. Based on the characteristic that the grayscale changes of pixels on both sides of the edge conform to a monotonic function trend, a function model is constructed to convert pixel values ​​into grayscale values. A standard test image is generated using this function model. The sub-pixel-level edge detection algorithm to be evaluated is then used to detect the standard test image, thus obtaining the detection value of the ideal edge image. The deviation between the detected value and the pre-set edge ground truth is calculated to obtain the detection accuracy data of the algorithm. This method, by pre-setting an edge equation to acquire the ideal edge ground truth and introducing a function model to generate the standard test image, makes the generation process of the ideal edge test image more consistent with the edge grayscale change characteristics. The test image is more closely related to the actual scene, avoiding the influence of human subjectivity caused by manual annotation in existing technologies and overcoming the problem of discrepancies between ideal and actual edges in existing methods, making the algorithm evaluation more practically meaningful.

[0033] Meanwhile, this method provides a way to obtain multiple sets of ideal edge images with different gray-level differences and different transition band widths under a single function model. This can simulate edge features under different scenarios, thereby obtaining the performance of the sub-pixel-level edge extraction algorithm under various scenarios. This avoids the problem in existing technologies where the evaluation results cannot reflect its application performance in complex and ever-changing real-world scenarios, making this method more universal and valuable for practical applications. Attached Figure Description

[0034] Figure 1 This is a schematic diagram of the evaluation method for the accuracy of the sub-pixel level edge detection algorithm of the present invention;

[0035] Figure 2 This is a schematic diagram illustrating the correspondence between edge grayscale images and pixel grayscale value curves.

[0036] Figure 3a This is a schematic diagram illustrating the process of constructing a function model using the Sigmoid function;

[0037] Figure 3b This is a schematic diagram illustrating the distance from the pixel center to the edge line when constructing the function model. Detailed Implementation

[0038] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and embodiments.

[0039] A method for evaluating the accuracy of sub-pixel level edge detection algorithms, such as Figure 1 As shown, it includes the following steps:

[0040] S1. Simulate the edge using a straight line equation or a curve equation, and denote it as edge line A; preset the minimum gray value on both sides of edge line A to be G1 and the maximum gray value to be G2; establish an image coordinate system, with i as the row label and j as the column label, and denote one side of edge line A as positive and the other side as negative.

[0041] Remember, d ij = The distance from the center of the pixel in the i-th row and j-th column to the edge line A; its positive or negative value is determined based on the position of the pixel in the i-th row and j-th column relative to the edge line A;

[0042] S2, with d ij With the grayscale value of each pixel as the independent variable and the grayscale value of each pixel as the dependent variable, a function model is constructed to obtain the grayscale value of different pixels in the image and generate a standard test image.

[0043] The function model is a monotonic function, and its derivative has a unique maximum value;

[0044] The grayscale values ​​of different pixels are between G1 and G2;

[0045] S3. The sub-pixel-level edge detection algorithm to be evaluated is used to detect the standard test image, and the coordinates of each point on the edge line A in the coordinate system of the actual test image are obtained and recorded as the detection value.

[0046] S4. Calculate the deviation between the detected value and the edge line A in the standard test image, and use it as the accuracy of the sub-pixel level edge detection algorithm to be evaluated.

[0047] Furthermore, in order to obtain edges with different transition band widths and different grayscale upper and lower bounds for evaluation, the evaluation method also includes the following steps:

[0048] S5. Adjust the coefficients of the independent variables, G1 and G2, in the function model of step S2, and repeat steps S2 to S4 to obtain the accuracy evaluation results of the sub-pixel level edge detection algorithm to be evaluated in different transition band widths and different grayscale upper and lower bounds.

[0049] In practice, the width of the edge transition band can be adjusted by adjusting the coefficients of the independent variables in the function model; by adjusting G1 and G2, standard test images with different grayscale upper and lower bounds can be obtained, that is, the grayscale on both sides of the edge line can be adjusted as needed; by adjusting the width of the edge transition band and the grayscale values ​​on both sides of the edge line, the edge line under various actual conditions can be simulated; the value range of G1 and G2 is 0 to 255.

[0050] like Figure 2 As shown, along the normal direction of edge line A on a grayscale image, the grayscale value curve g(d) of each pixel follows a monotonically increasing or monotonically decreasing pattern. The image edge is located in the region where the curve changes most steeply. That is, the position where the first derivative g'(d) of the grayscale value curve is the largest is the theoretical position of the edge.

[0051] Therefore, in practical implementation, the function model in step S2 can adopt the Sigmoid function as a specific implementation method, such as... Figure 3a , 3b As shown, according to step S1, the upper and lower bounds of the grayscale values ​​on both sides of edge line A are G1 and G2, respectively. When the distance d from the pixel to edge line A is... ij When the value is 0, meaning the independent variable of the Sigmoid function is 0, the curve slope is at its maximum, and the grayscale value changes most drastically, indicating that the pixel is located on the edge line; when the distance d from the pixel to the edge line A is... ij As the sigmoid function approaches positive or negative infinity, its dependent variable gradually approaches G2 or G1, indicating that the further a pixel is from the edge line, the smoother the change in gray value, which is consistent with the edge characteristics of the image. Therefore, a model based on the sigmoid function can be constructed to generate standard test images, specifically as follows:

[0052]

[0053] Wherein, y(d) ij Let represent the grayscale value of the pixel in the i-th row and j-th column of the standard test image, and e be a natural constant. Using this function model, each pixel in step S1 can be assigned a corresponding grayscale value, thereby converting the edge line A in step S1 from a pixel image to a grayscale image, i.e., generating the standard test image of the edge line A.

[0054] As a second implementation of constructing the function model in step S2, the function model in step S2 can also be a hyperbolic tangent function, specifically:

[0055]

[0056] Wherein, y(d) ij ) represents the gray value of the pixel in the i-th row and j-th column of the standard test image, and tanh() represents the hyperbolic tangent function operation.

[0057] Furthermore, as a third implementation of constructing the function model in step S2, the function model in step S2 can be the arctangent function; specifically:

[0058]

[0059] Wherein, y(d) ij ) represents the grayscale value of the pixel in the i-th row and j-th column of the standard test image, and arctan() represents the arctangent function operation.

[0060] Furthermore, step S4 calculates the deviation between the detected value and the edge line A in the standard test image as follows:

[0061] 1) Calculate the distance from the detected value to edge line A;

[0062] 2) Calculate the variance of all distance values ​​obtained in 1), and then calculate the root mean square error.

[0063] The smaller the root mean square error, the higher the detection accuracy of the sub-pixel level edge detection algorithm.

[0064] As another implementation method, step S4 calculates the deviation between the detected value and the edge line A in the standard test image by: calculating the distance from the detected value to the edge line A, determining the positive and negative signs based on the position of the detected value relative to the edge line A, and recording the final determined positive and negative signs and distance value as numerical value B;

[0065] The deviation is calculated based on the numerical value B, taking any one of the following: the range, the sum of squares of the deviations from the mean, the variance, the standard deviation, and the coefficient of variation. A smaller calculated deviation value indicates higher detection accuracy of the sub-pixel-level edge detection algorithm. Those skilled in the art can also choose other existing deviation calculation methods to suit their objectives.

[0066] This method acquires the pixel image of the ideal edge ground truth by pre-setting an edge equation. Based on the characteristic that the grayscale changes of pixels on both sides of the edge conform to a monotonic function trend, a function model is constructed to convert pixel values ​​into grayscale values. A standard test image is then generated using this function model. A sub-pixel-level edge detection algorithm to be evaluated is used to detect the standard test image, thus obtaining the detection value of the ideal edge image. Since the ideal edge ground truth is known through pre-setting, and the standard test image is generated based on the ideal edge ground truth, the deviation between the detection value and the pre-set edge ground truth can be directly calculated to obtain the detection accuracy of the algorithm. This method, by pre-setting an edge equation, acquires the edge line ground truth and introduces a function model to generate a standard test image of the edge line ground truth, achieving the acquisition of an ideal edge test image that fits the actual application scenario. It overcomes the problem of discrepancies between ideal and actual edges in existing methods.

[0067] Meanwhile, a method is presented to obtain multiple sets of ideal edge images with different gray-level differences and different transition band widths under a single function model. Using this method, edge features under different scenarios can be simulated, thereby obtaining the performance of the sub-pixel-level edge extraction algorithm to be evaluated in various scenarios. This avoids the problem in existing technologies where the evaluation results cannot reflect its application performance in real scenarios, making this method more universal and practically valuable.

[0068] The foregoing description of specific exemplary embodiments of the present invention is for illustrative and descriptive purposes. It is not intended to be exhaustive, nor to limit the invention to the precise forms disclosed; obviously, many changes and variations are possible in accordance with the foregoing teachings. The exemplary embodiments were chosen and described to explain the specific principles of the invention and its practical application, thereby enabling others skilled in the art to implement and utilize various exemplary embodiments of the invention, as well as their different alternatives and modifications. The scope of the invention is intended to be defined by the appended claims and their equivalents.

Claims

1. A method for evaluating the accuracy of a sub-pixel edge detection algorithm, characterized in that: The evaluation method includes the following steps: S1. Simulate the edge using a straight line equation or a curve equation, and denote it as edge line A; preset the minimum gray value on both sides of edge line A to be G1 and the maximum gray value to be G2; establish an image coordinate system, with i as the row label and j as the column label, and denote one side of edge line A as positive and the other side as negative. Note, = distance of the center of the pixel in the ith row and jth column from the edge line A; positive or negative depending on the position of the pixel in the ith row and jth column relative to the edge line A; S2, with As the independent variable, the gray value of each pixel point is the dependent variable, a function model is constructed, the gray values of different pixel points in the image are obtained, and a standard test image is generated. The function model is a monotonic function, and its derivative has a unique maximum value; The grayscale values ​​of the different pixels are between G1 and G2; The function model is any one of the Sigmoid function, hyperbolic tangent function, and arctangent function; The Sigmoid function is specifically as follows: ; in, Let represent the gray value of the pixel in the i-th row and j-th column of the standard test image, where e is a natural constant; The hyperbolic tangent function is specifically: ; in, This represents the gray value of the pixel in the i-th row and j-th column of the standard test image, and tanh() represents the hyperbolic tangent function operation; The arctangent function is specifically: ; in, This represents the grayscale value of the pixel in the i-th row and j-th column of the standard test image, and arctan() represents the arctangent function operation; S3. The sub-pixel-level edge detection algorithm to be evaluated is used to detect the standard test image, and the coordinates of each point on the edge line A in the actual image coordinate system are obtained and recorded as the detection value. S4. Calculate the deviation between the detected value and the edge line A in the standard test image, and use it as the accuracy of the sub-pixel level edge detection algorithm to be evaluated.

2. The evaluation method as described in claim 1, characterized in that: It also includes the following steps: S5. Adjust the coefficients of the independent variables, G1 and G2, in the function model of step S2, and repeat steps S2 to S4 to obtain the accuracy evaluation results of the sub-pixel level edge detection algorithm to be evaluated in different transition band widths and different grayscale upper and lower bounds.

3. The evaluation method as described in claim 1 or 2, characterized in that: The method for calculating the deviation between the detected value and the edge line A in the standard test image in step S4 is as follows: 1) Calculate the distance from the detected value to edge line A; 2) Calculate the variance of all distance values ​​obtained in 1), and then calculate the root mean square error.

4. The evaluation method as described in claim 1 or 2, characterized in that: The method for calculating the deviation between the detected value and the edge line A in the standard test image in step S4 is as follows: calculate the distance from the detected value to the edge line A, determine the positive and negative signs based on the position of the detected value relative to the edge line A, and record the final determined positive and negative signs and distance value as numerical value B; Based on the numerical value B, calculate any one of the following: range, sum of squares of deviations from the mean, variance, standard deviation, and coefficient of variation, and use it as the deviation.