High-precision line repositioning method based on hough transform result and image sub-pixel edge point regression

By integrating Hough transform and subpixel edge point regression, the problem of low accuracy and efficiency of Hough transform is solved, achieving improved high-precision linear positioning and part size measurement, which is suitable for industrial inspection and positioning of linear highway signs.

CN120765745BActive Publication Date: 2026-02-27南宁桂电电子科技研究院有限公司 +3
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510898476.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2026-02-27
Estimated Expiration
2045-07-01

AI Technical Summary

Technical Problem

In industrial inspection and linear traffic sign positioning, existing technologies suffer from limitations in straight-line positioning accuracy and low computational efficiency due to the Hough transform, while sub-pixel edge detection technology lacks global straight-line model constraints, resulting in insufficient measurement accuracy and low efficiency.

Method used

By fusing the coarse localization results of Hough transform with the local regression optimization of sub-pixel edge points, accurate fitting of line parameters is achieved. Gradient calculation, sub-pixel edge point selection, cubic spline interpolation, Hough space accumulator, and least squares fitting are employed to improve edge point localization accuracy and computational efficiency.

Benefits of technology

It achieves high-precision linear positioning, improves the efficiency and accuracy of part size measurement, avoids the omission of key indicators, and is suitable for industrial inspection and positioning of linear highway signs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120765745B_ABST
    Figure CN120765745B_ABST
Patent Text Reader

Abstract

The application provides a high-precision linear repositioning method based on Hough transform and sub-pixel edge point regression, which is suitable for industrial detection, part measurement, linear highway sign positioning and the like. The method first extracts sub-pixel edge point coordinates through gradient calculation and cubic spline interpolation, and significantly improves the edge positioning precision; then, the linear parameters are optimized by combining the coarse positioning of Hough transform and the least square method fitting, and the precision deficiency problem caused by the quantization error and noise in the traditional method is solved. The technical scheme comprises the steps of gradient modulus calculation, sub-pixel point offset correction, Hough transform (Hough transform) accumulator matrix voting and linear fitting optimization, and finally realizes the sub-pixel level measurement of the geometric features of parts and the like. In the industrial detection, the high-precision linear positioning is realized, and compared with the manual measurement and the traditional algorithm, the efficiency and accuracy of the part positioning and size measurement are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer vision and image processing, in particular to a high-precision line repositioning method based on Hough transform and sub-pixel edge point regression, which is especially suitable for precision size calculation in industrial detection and part measurement, and positioning of linear highway signs and other related industries. BACKGROUND

[0002] In the field of industrial detection and linear traffic sign positioning, the image size measurement of parts (such as common nuts, bolts, etc.) requires sub-pixel level precision to ensure product quality. Traditional manual measurement or detection methods based on integer pixels are susceptible to quantization errors and noise interference, making it difficult to meet high-precision requirements. In addition, geometric parameters such as edge-to-edge distance and thickness often need to be extracted in part measurement, and existing Hough transform has a straight line positioning deviation due to parameter space discretization. Although sub-pixel technology can improve edge precision, it lacks global straight line model constraints and has low computational efficiency.

[0003] As a classic line detection method, Hough transform has quantization errors due to parameter space discretization, which limits the precision of line positioning and makes it susceptible to noise interference. Sub-pixel edge detection techniques (such as the moment method and gradient optimization) can further improve edge positioning accuracy, but have high global computational complexity and lack straight line model constraints. Traditional line fitting methods (such as the least squares method) are sensitive to outliers and cannot effectively integrate sub-pixel information to optimize global parameters. Existing improved solutions (such as the two-stage method and parameter space interpolation) combine Hough transform with sub-pixel points, but are still constrained by initial parameter bias and computational efficiency. The urgent need for sub-pixel level high-precision lines in industrial detection and three-dimensional reconstruction has driven the development of new methods based on Hough coarse positioning and local sub-pixel point iterative regression, which balance precision and efficiency through error compensation models and robust optimization. SUMMARY

[0004] The present application aims to provide a high-precision line repositioning method based on Hough transform results and sub-pixel edge point regression for measuring part sizes or positioning linear highway signs in an image. By integrating the coarse positioning results of Hough transform with local regression optimization of sub-pixel edge points, the method achieves accurate fitting of line parameters, solving the problems of insufficient part size measurement precision and low efficiency in industrial detection.

[0005] The technical solution to achieve the present application is as follows:

[0006] A high-precision line repositioning method based on Hough transform results and image sub-pixel edge point regression, comprising the following steps:

[0007] 1) Perform gradient calculation on the original image. Calculate the gradients in the horizontal and vertical directions, as shown in equations (1) and (2), and calculate the gradient magnitude to obtain the edge intensity, as shown in equation (3):

[0008] (1)

[0009] (2)

[0010] (3)

[0011] Where x and y represent the pixel coordinates in the image, g x and g y These are the gradient components in the x and y directions, where I(x, y) represents the gray value of the image at pixel (x, y), and g represents the gradient magnitude; subsequently, sub-pixel edge points are selected.

[0012] In the x or y direction, three sampling points will be formed, such as g1(x1,y), g2(x2,y), g3(x3,y) in the x direction and g1(x,y1), g2(x,y2), g3(x,y3) in the y direction; the coordinates of the sub-pixel edge points are calculated by cubic spline interpolation, and the interpolation formula is shown in the following formula (4):

[0013] (4)

[0014] Where g1 and g3 are the gradient magnitudes of adjacent integer edge points, and g2 is the gradient magnitude of the current integer edge point. This represents the offset of the current pixel relative to an integer coordinate. and It is the offset in the x and y directions, and... With the values ​​equal, the precise sub-pixel coordinates in the x-direction are obtained based on the calculated offset. and sub-pixel coordinates in the y direction , Indicates the coordinates of the center point;

[0015] 2) Define a two-dimensional accumulator matrix, which stores the integer pixel edge points (x, y, z) in a matrix. I i , y I i ), calculate the distance at different angles. The calculation formula is shown in formula (5):

[0016] (5)

[0017] in, It is the perpendicular distance from the origin to the line in Hough space. It is the angle between the perpendicular line and the positive x-axis; by using the method of finding the current maximum value and the non-maximum suppression method, the most significant line can be obtained in sequence. and The parameter k represents the total number of lines to be detected;

[0018] from Polar coordinate system to Cartesian coordinate system The conversion formula is shown in formula (6), where x and y represent the abscissa x and ordinate y in the Cartesian coordinate system, respectively:

[0019] (6)

[0020] After obtaining the initial straight line parameters, given According to equation (7), from the set of all sub-pixel points of the image Extract the set of sub-image edge points that satisfy the following conditions :

[0021] (7)

[0022] For the extracted sub-pixel edge point set Perform a least squares linear fit, as shown in formula (8):

[0023] (8)

[0024] in, The coordinates of the sub-pixel edge points, based on integer edge points. It is concluded that The predicted value of the fitted line; n represents the number of sub-pixel edge points used for fitting; the error function is... In order to minimize the sum of squared errors, i.e. ,tidy and As shown in formulas (9) and (10) respectively:

[0025] (9)

[0026] (10)

[0027] The beneficial effects of the present application are: the present application realizes accurate fitting of straight line parameters by fusing the coarse positioning of Hough transform and the local regression optimization of sub-pixel edge points, solves the problems of insufficient part size measurement accuracy, low efficiency and missing key indicators in industrial detection, realizes high-precision straight line positioning in industrial detection, and greatly improves the efficiency and accuracy of nut size measurement and avoids missing key indicators compared with manual measurement and traditional algorithms. BRIEF DESCRIPTION OF DRAWINGS

[0028] Figure 1 For the photoelectric experiment platform.

[0029] Figure 2 (b) and Figure 2 (c) are shown, respectively calculating the horizontal and vertical gradients of the image, and fusing the results of the two by formula (6) to obtain Figure 2 (c), the true edge points are retained by the center pixel edge point screening method. Figure 2 (c) and Figure 2 The comparison of the magnified results of (c) and (d) can be seen that the edge line after screening is narrower, and can more accurately reflect the geometric contour in the image. Only the edge points with a gradient amplitude greater than the threshold value of 40 are retained, and finally the image as shown in Figure 2 (e) is generated.

[0030] Figure 3 The point in (a) is the integer type edge point coordinate after segmentation, and the offset of the direction can be determined by . The offset of the direction can be determined by . . Figure 3 The white in (b) represents the integer type edge point, and the red represents the sub-pixel edge point, which can be seen that the red point has an offset ( ) from the white point.

[0031] Figure 4 (a) and (b) are respectively schematic diagrams of Hough straight line detection using integer type pixel points and Hough transform straight line detection using sub-pixel points, which can be seen that Figure 4 is closer to the outer contour of the edge, significantly improving the accuracy of straight line detection.

[0032] Figure 5 (a) is a schematic diagram of high-precision measurement of the distance between the nut part and the edge and the thickness by using image processing technology, which is a usable case of the present application. DETAILED DESCRIPTION

[0033] Example 1 first obtains the original image through an optoelectronic platform. The physical resolution of the optoelectronic platform is determined by the field of view and the width or height of the image captured by the camera. An industrial camera with the MV-HP500GM specification is used to capture images with a width of 2448 pixels and a height of 2048 pixels, for a total of 5 million pixels. The physical width of the chip target surface is 47.83 mm. Therefore, the physical resolution of the optoelectronic platform is approximately 47.83 mm / 2448 pixels = 0.0195 mm / pixel. Figure 1 As shown, gradient calculations are then performed on the original image, calculating the gradients in both the horizontal and vertical directions, and calculating the gradient magnitude to determine the edge intensity. The center point of the maximum gradient value is located using the fusion result. The width of the edge pixels is gradually reduced, and invalid edge points are filtered out using the center-maximum principle to obtain accurate integer edges. Finally, the coordinates of sub-pixel level edge points are precisely located using the cubic spline gradient maximum criterion. To further filter out image noise, a threshold is applied to retain only edge points with gradient magnitudes exceeding a threshold greater than 40 (a common selection method), ultimately generating an image as shown below. Figure 2 The edge point extraction results shown in (e) are consistent with... Figure 2 (c) and Figure 2 (d) Compared to, Figure 2 (e) The edge line occupies only 1 pixel, which is beneficial for subsequent line detection and high-precision positioning.

[0034] Example 2 involves sub-pixel edge point extraction starting from the image. direction or The direction will create 3 sampling points, such as Direction and Direction The coordinates of sub-pixel edge points are calculated using cubic spline interpolation, with the interpolation formula being (6). Based on the calculated offset, the accurate coordinates are obtained. Sub-pixel coordinates in the y-direction and y-direction, such as Figure 3 Points in Let be the integer coordinates of the edge points after the segmentation in the previous section, then... It can be confirmed directional offset ,Depend on It can be confirmed directional offset .exist Figure 3 As can be seen, the sub-pixel edge points (red dots) are offset compared to the integer edge points.

[0035] Example 3 defines a two-dimensional accumulator matrix AC, whose directional variables take values ​​within the range of... This matrix is ​​used to store each of the Hough space. The corresponding count. For each integer pixel edge point (x I i , y I i ), calculate at different angles The corresponding distance below The corresponding element AC in the accumulator matrix Increment by 1 to complete the voting statistics for all edge points. A non-maximum suppression method is used in the cumulative matrix to progressively extract line parameters. To avoid duplicate detection, positions with obvious maxima are found from the cumulative matrix each time. Suppress the neighborhood range. After obtaining the line parameters using formula (8), and given the initial line parameters, the following steps are performed: Under normal circumstances Extract a set of sub-image edge points Q from the entire set of sub-pixel points P of the image that satisfies the following conditions. For the extracted set of sub-pixel edge points Q={( , ),( , ), ,…,( , Using formula (10) for least squares line fitting, in order to minimize the sum of squared errors, we rearrange a S and b S As in equations (11) and (12), the returned parameter (a) of the linear equation S , b S And by using a threshold, the starting coordinates of the line segments contained in the straight line are found. and endpoint coordinates ,as follows Figure 4 The diagrams shown illustrate Hough line detection using integer pixels (green line) and Hough transform line detection using sub-pixel points (blue line), respectively. It can be seen that the line obtained by Hough transform line detection using sub-pixel points is closer to the outer contour of the edge than the line obtained by Hough line detection using integer pixels, thus significantly improving the accuracy of line detection.

[0036] Example 4 uses a sub-pixel line fitting algorithm based on Hough transform to measure the distance between the opposite sides of the nut. The fitted opposite side segments are named as follows: , Line segment The starting point coordinates and the ending point coordinates can be represented as , Similarly, line segments The starting point coordinates and the ending point coordinates can be represented as , The center point coordinates of each straight line are calculated first and are represented as , wherein, and are the center point coordinates of line segments and respectively. Next, the distance of each center point to another line segment is calculated. The distance of center point to straight line is represented as and the distance of center point to straight line is represented as . The final opposite side distance is the average of these two distances. The measurement schematic is Figure 5 .

[0037] The details of the present application are known in the art.

[0038] The above examples are only to illustrate the technical concept and characteristics of the present application, and the purpose is to enable those skilled in the art to understand the content of the present application and to implement it, and cannot limit the protection scope of the present application. Any equivalent changes or modifications made in accordance with the spirit and essence of the present application shall be covered within the protection scope of the present application.

Claims

1. A high-precision line repositioning method based on Hough transform results and image sub-pixel edge point regression, characterized in that: The method comprises: 1) performing gradient calculation on the original image to calculate the gradients in horizontal and vertical directions respectively, as in formula (1) and formula (2), and calculating the gradient modulus to obtain the edge intensity, as in formula (3): (1); (2); (3); where x and y represent the pixel coordinates in the image, g x and g y are the gradient components in the x and y directions, I(x, y) represents the gray value of the image at the pixel point (x, y), and g represents the gradient amplitude; subsequently, sub-pixel edge points are selected; 2) define a two-dimensional accumulator matrix, which will be filled with the number of integer pixel edge points (x I i , y I i ) at each point, and calculate the corresponding distance at different angles; the formula is as formula (5): (5); wherein, is the perpendicular distance from the origin to the line in the Hough space, is the angle between the perpendicular line and the positive direction of the x-axis; the most significant line parameters and can be obtained by using the look-up sub-maximum method and the non-maximum suppression method, respectively. and The parameter k represents the total number of the lines to be detected. From polar coordinates to Cartesian coordinates The conversion formula from the polar coordinate system to the Cartesian coordinate system is given by equation (6), where x and y in equation (6) represent the horizontal coordinate x and the vertical coordinate y in the Cartesian coordinate system, respectively: (6); After obtaining the preliminary straight line parameters, the given From the entire set of sub-pixel points of the image The set of sub-pixel edge points satisfying the following conditions is extracted from the entire set of sub-pixel points of the image : (7); For the extracted sub-pixel edge point set Least square linear fitting is performed, as shown in equation (8): (8); wherein, is the coordinate of a sub-pixel edge point, according to an integer type edge point is derived, is the predicted value of the fitting straight line; n represents the number of sub-pixel edge points used for fitting; the error function is , in order to minimize the error sum of squares, that is, , the arrangement and , respectively as formula (9) and formula (10): (9) (10)。 2. The method of claim 1, wherein: The sub-pixel edge point is selected in step (1): in the x direction or the y direction, three sampling points are formed: g1(x1, y), g2(x2, y), g3(x3, y) in the x direction and g1(x, y1), g2(x, y2), g3(x, y3) in the y direction; the coordinates of the sub-pixel edge point are calculated by a cubic spline interpolation method, and the interpolation formula is shown in the following formula (4): (4); wherein g1 and g3 are the gradient amplitudes of adjacent integer edge points, g2 is the gradient amplitude of the current integer edge point, is the offset of the current pixel relative to the integer coordinates; and is the offset of the current pixel relative to the integer coordinates; the values are equal, and the precise x-direction sub-pixel coordinates and the y-direction sub-pixel coordinates are obtained from the calculated offset; denote the center point coordinates.

Citation Information

Patent Citations

  • Workpiece linear edge positioning method for machine vision

    CN108416787A

  • Complex-shape guide rail sliding block size measurement method based on intelligent vision

    CN119984033A