Machine Vision-Based Method and System for Measuring Circular Thread Dimensions

By using multi-view image stitching and sub-pixel edge detection, combined with equilateral triangles and least squares optimization, the problem of multi-view stitching error was solved, achieving high-precision measurement of circular thread parameters and improving the robustness and adaptability of the measurement.

CN120274635BActive Publication Date: 2026-03-06ACADEMY OF PUBLIC SECURITY TECH HEFEI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

The cumulative error caused by stitching together different map sheets in existing multi-field collaborative measurements leads to the problem of decreased accuracy of long-range parameters.

Method used

By acquiring multiple viewpoint images, the contour points of each image are corrected to sub-pixels. Thread contour feature points are constructed based on equilateral triangles. The feature points are judged using Euclidean distance and preset thresholds. The images are then stitched together, and the position is optimized using the least squares method. Finally, the standard deviation of the tooth profile parameters is calculated to determine whether the thread size is abnormal.

Benefits of technology

It achieves complete coverage of the entire thread profile, reduces errors caused by geometric mismatch and angular deviation, improves measurement accuracy and reliability, and significantly enhances the overall accuracy and adaptability of thread measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120274635B_ABST
    Figure CN120274635B_ABST
Patent Text Reader

Abstract

This invention provides a machine vision-based method and system for measuring the dimensions of circular threads. First, it achieves complete coverage of the entire thread profile by acquiring multiple local images, overcoming the limitation of a single field of view in capturing the entire thread. Second, it extracts the contours of each image frame through sub-pixel edge detection and performs in-depth analysis of feature points within each frame. Subsequently, a feature-constrained stitching model is established to achieve precise alignment and global optimization of data from different fields of view, reducing the error amplification effect caused by geometric mismatch and viewing angle deviation, and suppressing nonlinear errors in parameter accuracy within the measurement range. This method can comprehensively and accurately measure key parameters of circular threads (such as taper, pitch, thread profile variation, and minimum effective connection length). This method not only significantly improves the overall accuracy and reliability of thread measurement but also provides a solid technical guarantee for the safety and durability of oil well pipeline connections, and has important reference value for research and application in related fields.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of thread measurement technology, specifically a method and system for calculating the dimensional parameters of circular threads based on machine vision. Background Technology

[0002] Circular threads, widely used in industrial mechanical structures, require strict adherence to industry standards in their design and manufacturing to ensure the sealing, mechanical strength, and durability of connections between different components. This guarantees the safe operation and long-term use of industrial facilities under complex conditions. Precise measurement of the geometric parameters of circular threads is crucial for ensuring their performance, safety, and reliability. Parameter deviations can lead to connection failures, resulting in leaks, fractures, and other consequences that can cause significant economic losses. While non-contact measurement technology is widely used in thread measurement due to its high efficiency and non-destructive nature, when the thread length is long, a single image frame often cannot completely cover the entire thread profile due to limitations in camera field of view and CMOS target size. Therefore, a multi-field collaborative measurement strategy is used to acquire multiple local images and perform high-precision stitching to achieve full thread profile coverage. This enables comprehensive analysis of key thread parameters (such as taper, pitch, thread profile variation, and minimum effective connection length), revealing potential defects during manufacturing or use. However, geometric mismatches and viewing angle deviations exist between multi-field images. If the stitching accuracy is insufficient, errors will be amplified, affecting the final measurement accuracy. Therefore, subpixel-level registration of multi-field and different map sheet data overcomes the limitations of single-field measurement. While improving the overall measurement accuracy, it not only reflects the thread processing error in the production process, but also provides reliable data for effectively capturing the progressive wear and stress concentration phenomena in the thread meshing area, which has important theoretical significance and practical application value.

[0003] Bai Xiaoliang et al. [1] used the Harris operator to construct an autocorrelation matrix at each pixel of the image to calculate and extract the corner points of the external thread. However, since the extraction result only has pixel-level accuracy and the computational load required in high-resolution images is large, the real-time performance is insufficient. They rely on the original sub-pixel contour points for further refinement. Niu Sentao et al. [2] obtained the sub-pixel edge of the thread image by quadratic curve fitting based on the pixel-level edge extracted by the Canny algorithm, and then used cubic spline curves to fit it. They also detected the corner points based on the curvature of the fitted curve. However, the selection of curvature threshold and spline fitting parameters in their method need to be carefully adjusted according to the specific image characteristics. Jiang Tao et al. [3] improved the Canny operator by using bilateral filtering and iterative thresholding, and combined the double threshold DP algorithm and Hough transform to perform segmented fitting of the contour. Finally, they used the CTAR algorithm to extract the corner points of the thread crest and root. Although the method improved the accuracy, the overall process was more complicated and the computational efficiency still needs to be improved. Overall, current research methods generally suffer from insufficient real-time performance, low adaptability, and inadequate handling of splicing different map sheets. This provides a direction for future improvements that balance real-time performance and versatility while enhancing the accuracy of corner point extraction.

[0004] References

[0005] [1] Bai Xiaoliang, Yan Hong, Liu Qing, et al. Development of a fully automatic measurement system for external threads of oil pipes [J]. Petroleum Pipes & Instruments, 2020, 6(03): 6-10.

[0006] [2] Niu Sentao, Zhao Fengxia, Jiang Feifei, et al. Online thread detection method based on machine vision [J]. Mechanical Design and Research, 2021, 37(06):170-173+183.

[0007] [3] Jiang Tao, Li Yuan, He Chenlong. Visual measurement method for key parameters of thread based on contour corner detection [J]. Journal of Electronic Measurement and Instrumentation, 2022, 36(07):54-61. Summary of the Invention

[0008] The technical problem to be solved by this invention is the problem of long-range parameter accuracy decay caused by the cumulative error caused by the splicing of different map sheets in the existing multi-field collaborative measurement process.

[0009] The present invention solves the above-mentioned technical problems through the following technical means:

[0010] Machine vision-based methods for measuring the dimensions of circular threads include:

[0011] S1. Obtain multi-view map sheets with overlapping areas between adjacent map sheets;

[0012] S2. Correct the outline points of each image frame to sub-pixel level;

[0013] S3. Extraction of thread contour feature points based on equilateral triangles: The obtained and corrected sub-pixel contour points are sorted according to the thread contour direction. Along the contour traversal direction, equilateral triangles are constructed based on the Euclidean distance between two adjacent sub-pixel points, and the included angle θ between two adjacent equilateral triangles is calculated. i If θ i Greater than the preset threshold θ t , and determine them as the corresponding feature points;

[0014] S4. Stitch together the map sheets guided by feature points;

[0015] S5. Based on the spliced ​​drawing, calculate the simulated height and the measured height of the thread profile respectively. Calculate the standard deviation of the thread profile parameters based on the simulated height and the measured height, and then determine whether the thread size is abnormal based on the standard deviation of the thread profile parameters.

[0016] Furthermore, step S1 specifically involves: driving a monocular camera to perform equidistant stepping motion along the thread axis using a translation stage, and acquiring sequential images of adjacent fields of view through a time-triggered image acquisition method; wherein, image frame F A With F B Complementary fields of view are formed along the thread axis, with map width and height w and h respectively. To ensure sufficient overlap between adjacent map sheets to completely cover the thread, the axial step distance L satisfies:

[0017] L <min(w,h)

[0018] To avoid misalignment or breakage between map sheets due to errors, the forward motion error ε must be controlled within half of the pitch p, i.e.:

[0019] ε<0.5*p.

[0020] Furthermore, step S2 specifically involves: for different thread profiles, firstly, using the Canny operator to perform pixel-level edge detection on the binarized profile to extract the thread contour.

[0021] C={(x i ,y i |i=1,2,…n}

[0022] Where (x) i ,y i() represents the coordinates of the i-th contour point, and n is the total number of contour edge sampling points. The neighborhood information of the edge is obtained using the first and second gradients of the contour edge C. To provide an unbiased and high-precision numerical approximation for the differentiation of discrete pixels, the 7-tap interpolator and its differential kernel proposed by Farid and Simoncelli are used in the gradient calculation to calculate the first gradient g of the contour edge in the x and y directions. x g y With the second gradient g xx g yy g xy Finally, Steger unbiased curve structure detection is used to eliminate systematic bias caused by discrete sampling, utilizing edge c i (x i ,y i Construct the Hessian matrix using the first and second derivatives of the neighborhood:

[0023]

[0024] By analyzing H i Perform singular value decomposition and select the eigenvector corresponding to the largest eigenvalue. This vector represents a unit vector along the direction perpendicular to the edge; calculate the contour edge c. i Correction amount t along the normal direction i for:

[0025]

[0026] Update edge contour pixels c i The position is obtained by sub-pixel coordinates:

[0027]

[0028] Furthermore, step S3 specifically involves: firstly, sorting the acquired corrected sub-pixel contour points according to the contour direction of the thread, c i ∈C{i=1,2,…n} are sub-pixel edge points. Along the contour traversal direction, an equilateral triangle is constructed using two adjacent sub-pixel edge points, v i With v i+1 These are the vertices of two adjacent equilateral triangles. i For c i Around c i+1 The rotation matrix obtained by rotating by an angle α is expressed as:

[0029]

[0030] Where α is the rotation angle; the same method can be used to calculate v. i+1 Coordinates; the angle θ between two adjacent equilateral trianglesi It can be calculated using the following formula:

[0031]

[0032] Then, θ1 is compared with the preset threshold θ t Comparison, if greater than θ t The corresponding feature points are identified; the entire contour is traversed sequentially according to this method.

[0033] Furthermore, step S4 specifically involves: assuming two map sheets F A With F B Furthermore, there exists a known fixed moving distance L between them, and the feature point set F extracted from the two map sheets. A ={f A1 ,f A2 ,…,f An} and F B ={f B1 ,f B2 ,…,f Bn}, where f Ai =(x Ai ,y Ai ), f Bi =(x Bi ,y Bi ) represent map sheet F respectively A and map sheet F B The coordinates of the feature points in the image;

[0034] First, based on the given movement distance L, the map sheet F is... B Perform translation:

[0035] B′=B+L

[0036] For F B Feature point f in Bi =(x Bi ,y Bi Translate by a fixed distance:

[0037] (x B′ ,y B′ )=(x B +L,y B +L)

[0038] Map F after preliminary translation B The matching error between feature points is calculated, and the position is further optimized using the least squares method; the transformation matrix T is represented as a two-dimensional affine transformation matrix:

[0039]

[0040] Among them, a11 ,a 12 ,a 21 ,a 22 These are the coefficients of the affine transformation, t x and t y It is the translation amount; the translation amount t x and t y This refers to map sheet F after the initial translation. B Adjustments are made; the cost function E(T) represents the map size F. B Feature points and map size F A The sum of squares of the coordinate errors between corresponding feature points:

[0041]

[0042] Among them, (x B′i ,y B′i () represents the coordinates of the translated feature points. By minimizing the cost function, the transformation matrix T is optimized to make the map area F... B Feature points and map size F A The feature points in the image are better aligned; to minimize the cost function, the least squares method is used to obtain the optimal transformation matrix T; the image size F B The transformation matrix optimized by the initial translation and least squares method will be used in conjunction with the map size F. A Precise alignment enables the splicing of map sheets.

[0043] Furthermore, step S5 specifically involves: after completing the spatial stitching of multiple map images, using the least squares method to perform parametric modeling of the tooth profile feature point set, and establishing the best-fit line equations for the contours on both sides of l3 and l4 respectively:

[0044]

[0045] Where A1, B1, and C1 are the line parameters of line l3, and A2, B2, and C2 are the line parameters of line l4; assuming the coordinates of the sphere's center are... The perpendicular distance from c2 to l3 and l4 is expressed as:

[0046]

[0047] The coordinates can be obtained from the above formula. The measured height h of the thread profile can then be calculated, and then the thread axial distribution function can be constructed:

[0048]

[0049] In the above formula, h k This represents the measured height value at the k-th sampling location. These are theoretical nominal values. Spatial domain analysis is performed on the tooth profile parameters, and the standard deviation of the tooth profile parameters is calculated:

[0050]

[0051] It can quantitatively assess the dispersion of thread processing quality, effectively identify gradual errors caused by tool wear or clamping deformation during thread manufacturing, and provide a quantitative basis for process optimization.

[0052] The present invention also provides a machine vision-based circular thread dimension measurement system, comprising:

[0053] Image acquisition module: Acquires multiple field-of-view images, with overlapping areas between adjacent images;

[0054] Correction module: Corrects the outline points of each image frame to sub-pixel level;

[0055] Thread contour feature point extraction module: The obtained and corrected sub-pixel contour points are sorted according to the thread contour direction. Along the contour traversal direction, equilateral triangles are constructed based on the Euclidean distance between two adjacent sub-pixel points, and the included angle θ between two adjacent equilateral triangles is calculated. i If θ i Greater than the preset threshold θ t , and determine them as the corresponding feature points;

[0056] Stitching module: Stitches together maps guided by feature points;

[0057] Model fitting module: Based on the spliced ​​image, calculate the simulated height and the measured height of the thread profile respectively. Calculate the standard deviation of the thread profile parameters based on the simulated height and the measured height, and then determine whether the thread size is abnormal based on the standard deviation of the thread profile parameters.

[0058] Furthermore, the correction module specifically involves: for different thread profiles, firstly, using the Canny operator to perform pixel-level edge detection on the binarized profile to extract the thread contour;

[0059] C={(x i ,y i |i=1,2,…n}

[0060] Where (x) i ,y i () represents the coordinates of the i-th contour point, and n is the total number of contour edge sampling points. The neighborhood information of the edge is obtained using the first and second gradients of the contour edge C. To provide an unbiased and high-precision numerical approximation for the differentiation of discrete pixels, the 7-tap interpolator and its differential kernel proposed by Farid and Simoncelli are used in the gradient calculation to calculate the first gradient g of the contour edge in the x and y directions. x g y With the second gradient g xx gyy g xy Finally, Steger unbiased curve structure detection is used to eliminate systematic bias caused by discrete sampling, utilizing edge c i (x i ,y i Construct the Hessian matrix using the first and second derivatives of the neighborhood:

[0061]

[0062] By analyzing H i Perform singular value decomposition and select the eigenvector corresponding to the largest eigenvalue. This vector represents a unit vector along the direction perpendicular to the edge; calculate the contour edge c. i Correction amount t along the normal direction i for:

[0063]

[0064] Update edge contour pixels c i The position is obtained by sub-pixel coordinates:

[0065]

[0066] Furthermore, the thread contour feature point extraction module specifically involves: firstly, sorting the acquired, corrected sub-pixel contour points according to the thread contour direction, c i ∈C{i=1,2,…n} are sub-pixel edge points. Along the contour traversal direction, an equilateral triangle is constructed using two adjacent sub-pixel edge points, v i With v i+1 These are the vertices of two adjacent equilateral triangles. i For c i Around c i+1 The rotation matrix obtained by rotating by an angle α is expressed as:

[0067]

[0068] Where α is the rotation angle; the same method can be used to calculate v. i+1 Coordinates; the angle θ between two adjacent equilateral triangles i It can be calculated using the following formula:

[0069]

[0070] Then, θ1 is compared with the preset threshold θ t Comparison, if greater than θ t The corresponding feature points are identified; the entire contour is traversed sequentially according to this method.

[0071] Furthermore, the splicing module specifically comprises: assuming two map sheets F A With F B Furthermore, there exists a known fixed moving distance L between them, and the feature point set F extracted from the two map sheets. A ={f A1 ,f A2 ,…,f An} and F B ={f B1 ,f B2 ,…,f Bn}, where f Ai =(x Ai ,y Ai ), f Bi =(x Bi ,y Bi ) represent map sheet F respectively A and map sheet F B The coordinates of the feature points in the image;

[0072] First, based on the given movement distance L, the map sheet F is... B Perform translation:

[0073] B′=B+L

[0074] For F B Feature point f in Bi =(x Bi ,y Bi Translate by a fixed distance:

[0075] (x B′ ,y B′ )=(x B +L,y B +L)

[0076] Map F after preliminary translation B The matching error between feature points is calculated, and the position is further optimized using the least squares method; the transformation matrix T is represented as a two-dimensional affine transformation matrix:

[0077]

[0078] Among them, a 11 ,a 12 ,a 21 ,a 22 These are the coefficients of the affine transformation, t x and t y It is the translation amount; the translation amount t x and t y This refers to map sheet F after the initial translation. B Adjustments are made; the cost function E(T) represents the map size F.B Feature points and map size F A The sum of squares of the coordinate errors between corresponding feature points:

[0079]

[0080] Among them, (x B′i ,y B′i () represents the coordinates of the translated feature points. By minimizing the cost function, the transformation matrix T is optimized to make the map area F... B Feature points and map size F A The feature points in the image are better aligned; to minimize the cost function, the least squares method is used to obtain the optimal transformation matrix T; the image size F B The transformation matrix optimized by the initial translation and least squares method will be used in conjunction with the map size F. A Precise alignment enables the splicing of map sheets;

[0081] The model fitting module specifically works as follows: After spatially stitching together multiple map images, the least squares method is used to parametrically model the tooth profile feature point set, establishing the optimal fitting line equations for the contours on both sides of l3 and l4 respectively:

[0082]

[0083] Where A1, B1, and C1 are the line parameters of line l3, and A2, B2, and C2 are the line parameters of line l4; assuming the coordinates of the sphere's center are... The perpendicular distance from c2 to l3 and l4 is expressed as:

[0084]

[0085] The coordinates can be obtained from the above formula. The measured height h of the thread profile can then be calculated, and then the thread axial distribution function can be constructed:

[0086]

[0087] In the above formula, h k This represents the measured height value at the k-th sampling location. These are theoretical nominal values. Spatial domain analysis is performed on the tooth profile parameters, and the standard deviation of the tooth profile parameters is calculated:

[0088]

[0089] It can quantitatively assess the dispersion of thread processing quality, effectively identify gradual errors caused by tool wear or clamping deformation during thread manufacturing, and provide a quantitative basis for process optimization.

[0090] The advantages of this invention are:

[0091] This invention first achieves complete coverage of the entire thread profile by acquiring multiple local images, thus overcoming the limitation of a single field of view in capturing the entire thread. Second, it extracts the contours of each image frame through sub-pixel edge detection and performs in-depth analysis of feature points within each frame. Subsequently, a feature-constrained stitching model is established to achieve precise alignment and global optimization of data from different fields of view, reducing the error amplification effect caused by geometric mismatch and viewing angle deviation, and suppressing nonlinear errors in parameter accuracy within the measurement range. This method can comprehensively and accurately measure key parameters of circular threads (such as taper, pitch, thread profile variation, and minimum effective connection length). This method not only significantly improves the overall accuracy and reliability of thread measurement but also provides a solid technical guarantee for the safety and durability of oil well pipeline connections, and has important reference value for research and application in related fields. Attached Figure Description

[0092] Figure 1 This is a flowchart illustrating the implementation of the method in this embodiment of the invention;

[0093] Figure 2 This is a schematic diagram of multi-view image acquisition in the method of this embodiment of the invention;

[0094] Figure 3 This is a schematic diagram illustrating the calculation of thread feature points in the method of this embodiment of the invention;

[0095] Figure 4 This is a schematic diagram of the measurement of the thread profile height in the method of this embodiment of the invention. Detailed Implementation

[0096] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, 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.

[0097] This embodiment discloses a machine vision-based method for measuring the dimensions of circular threads, the process of which is as follows: Figure 1 As shown, proceed as follows:

[0098] Step 1: Acquisition of multi-field image frames based on a monocular camera.

[0099] To meet the high-resolution requirements while ensuring complete acquisition of the 2D image of the thread projection, a multi-image collaborative acquisition method (such as...) is adopted. Figure 2(As shown). The image width and height are w and h, respectively. A monocular camera is driven by a translation stage to perform equidistant stepping motion along the thread axis, and sequential images of adjacent fields of view are acquired through a time-triggered image acquisition method. Among them, the image size F A With F B To create complementary fields of view along the thread axis, and to ensure sufficient overlap between adjacent drawing sheets to completely cover the thread, the axial step distance L satisfies the following:

[0100] L <min(w,h)

[0101] To avoid misalignment or breakage between map sheets due to errors, the forward motion error ε must be controlled within half of the pitch p, i.e.:

[0102] ε<0.5*p

[0103] Step 2: Subpixel correction of the outline points of each map sheet.

[0104] To accurately locate sub-pixel boundaries of the thread, the following steps are taken for different thread image sizes. First, the Canny operator is used to perform pixel-level edge detection on the binarized image to extract the thread contour:

[0105] C={(x i ,y i |i=1,2,…n}

[0106] Where (x) i ,y i () represents the coordinates of the i-th contour point, and n is the total number of contour edge sampling points. Next, the first and second gradients of the contour edge C are used to obtain the neighborhood information of the edge. To provide an unbiased and high-precision numerical approximation for the differentiation of discrete pixels, the 7-tap interpolator and its differential kernel proposed by Farid and Simoncelli are used to calculate the first gradient g of the contour edge in the x and y directions. x g y With the second gradient g xx g yy g xy Finally, Steger unbiased curve structure detection is used to eliminate systematic bias caused by discrete sampling, utilizing edge c i (x i ,y i Construct the Hessian matrix using the first and second derivatives of the neighborhood:

[0107]

[0108] By analyzing H i Perform singular value decomposition and select the eigenvector corresponding to the largest eigenvalue. This vector represents a unit vector along a direction perpendicular to the edge. Calculate the contour edge c. i Correction amount t along the normal direction i for:

[0109]

[0110] Update edge contour pixels c i The position is obtained by sub-pixel coordinates:

[0111]

[0112] Step 3: Extraction method of thread contour feature points based on equilateral triangle construction.

[0113] To extract feature points of the thread profile and better achieve stitching between image frames, the obtained corrected sub-pixel profile points are first sorted according to the profile direction of the thread. Figure 3 c i Let C{i=1,2,…n} be sub-pixel edge points, and let c1 and c2 be the Euclidean distances along the contour traversal direction. Construct an equilateral triangle c1c2v1, with the Euclidean distance between c2 and c3 as the boundary. Construct an equilateral triangle c2c3v2, where v1 and v2 are the vertices of triangles c1c2v1 and c2c3v2, respectively. v1 can be considered as obtained by rotating c1 around c2 by 60°, and the rotation matrix is ​​represented as:

[0114]

[0115] Where α is the rotation angle. The same method can be used to calculate the v2 coordinates. The angle θ1 can be calculated using the following formula:

[0116]

[0117] Then, θ1 is compared with the preset threshold θ t Comparison, if θ1 is greater than θ t If a feature point is found to be an accurate feature point, then the entire contour is traversed sequentially using this method to determine whether each point is a feature point. The feature point search process is shown in Table 1. Figure 3 In, θ i Greater than θ t The corresponding feature points are identified. The specific algorithm is shown in Table 1 below.

[0118] Table 1. Thread feature point extraction algorithm based on equilateral triangles

[0119]

[0120] Step 4: Feature point-guided image stitching.

[0121] When stitching map sheets together, feature points are used for registration and least squares method is used for optimization. Figure 2 There are two map sheets F A With F B Furthermore, there exists a known fixed moving distance L between them, and the feature point set F extracted from the two map sheets. A ={f A1 ,f A2 ,…,f An} and F B ={f B1 ,f B2 ,…,f Bn}, where f Ai =(x Ai ,y Ai ), f Bi =(x Bi ,y Bi ) represent map sheet F respectively A and map sheet F B The coordinates of the feature points in the image.

[0122] First, based on the given movement distance L, the map sheet F is... B Perform translation:

[0123] B′=B+L

[0124] For F B Feature point f in Bi =(x Bi ,y Bi Translate by a fixed distance:

[0125] (x B′ ,y B′ )=(x B +L,y B +L)

[0126] Map F after preliminary translation B The matching error between feature points is calculated, and the position is further optimized using the least squares method. The transformation matrix T is represented as a two-dimensional affine transformation matrix:

[0127]

[0128] Among them, a 11 ,a 12 ,a 21 ,a 22 These are the coefficients of the affine transformation, t x and t y It is the translation amount. Translation amount t x and t y This refers to map sheet F after the initial translation.B Adjustments are made. The cost function E(T) represents the map area F. B Feature points and map size F A The sum of squares of the coordinate errors between corresponding feature points:

[0129]

[0130] Among them, (x B′i ,y B′i () represents the coordinates of the translated feature points. By minimizing the cost function, the transformation matrix T is optimized to make the map area F... B Feature points and map size F A The feature points in the image are better aligned. To minimize the cost function, the least squares method is used to obtain the optimal transformation matrix T. (Image size F) B The transformation matrix optimized by the initial translation and least squares method will be used in conjunction with the map size F. A Precise alignment enables the splicing of map sheets.

[0131] Step 5: Parameter measurement and calculation.

[0132] After completing the image stitching in step 4, in order to accurately capture the changing trend of tooth height, a digital inspection method based on virtual measuring tools is used to measure the tooth height parameters using a simulated height gauge. For example... Figure 4 The diagram illustrates the principle of measuring the tooth profile height of a circular thread. This method constructs a spherical virtual probe with radius r, which contacts the right and left contact surfaces of adjacent thread profiles in space. The tooth profile height parameter h is derived by calculating the normal distance from the center of the sphere to the baseline b1_b3. After completing the spatial registration (i.e., multi-map stitching) of multi-map data, the least squares method is used to parametrically model the tooth profile feature point set, establishing... Figure 4 The best-fit line equations for the contours on both sides of l3 and l4 are:

[0133]

[0134] Where A1, B1, and C1 are the line parameters of line l3, and A2, B2, and C2 are the line parameters of line l4. Assume the coordinates of the sphere's center are... The perpendicular distance from c2 to l3 and l4 is expressed as:

[0135]

[0136] The coordinates can be obtained from the above formula. This allows us to calculate the actual tooth height h. Furthermore, based on... Figure 4 The digital inspection method for the virtual gauge shown is achieved by constructing a thread axial distribution function:

[0137]

[0138] In the above formula, h k This represents the measured height value at the k-th sampling location. These are theoretical nominal values. Spatial domain analysis is performed on the tooth profile parameters, and the standard deviation of the tooth profile parameters is calculated:

[0139]

[0140] It can quantitatively assess the dispersion of thread processing quality, effectively identify gradual errors caused by tool wear or clamping deformation during thread manufacturing, and provide a quantitative basis for process optimization.

[0141] This embodiment acquires discrete local images of the thread from a multi-field image acquisition system, extracts contour feature points using sub-pixel-level edge detection, and constructs a global registration model based on feature constraints. This maps the discrete images to a unified global coordinate system, achieving seamless reconstruction of the entire thread profile data. This enables continuous acquisition of the entire thread profile and accurate measurement of the tooth height parameters. While simplifying thread measurement, it improves measurement accuracy, reduces errors caused by geometric mismatch and viewing angle deviation, and enhances the robustness and adaptability of the vision-based approach in thread measurement.

[0142] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for measuring the dimensions of a round thread based on machine vision, characterized in that, Comprising: S1. Obtain multi-view field maps, adjacent maps have overlapping areas; S2. Correct the sub-pixel of the profile point of each map; S3. Feature point extraction of thread profile based on equilateral triangle: The sorted modified sub-pixel profile points are sorted according to the profile direction of the thread, and an equilateral triangle is constructed between two adjacent sub-pixel points in the profile traversal direction. The included angle between two adjacent equilateral triangles is calculated , if is greater than a preset threshold , the corresponding feature point is determined. S4. Splice the map guided by the feature points; S5. Based on the spliced map, respectively calculate the theoretical height and the measured height of the tooth profile, calculate the standard deviation of the tooth profile parameters based on the theoretical height and the measured height, and then judge whether the thread size is abnormal according to the standard deviation of the tooth profile parameters; The step S5 is specifically: after completing the spatial splicing of the multi-sheet data, the least square method is used to parameterize the modeling of the profile feature point set, and the best fitting straight line equation of the two side profiles is respectively established l 3 and l 4 are: wherein A 1, B 1, C 1 is l 3 straight line parameters, A 2, B 2, C 2 is l 4 straight line parameters; assuming the coordinates of the sphere center as , c 2 to l 3 and l 4 perpendicular distance is expressed as: From the above equation, the coordinates can be obtained, and then the measured profile height h can be obtained. Then, the axial distribution function of the thread is constructed as follows: In the above formula represents the measured height value at the k sampled position, is the theoretical nominal value; for the spatial domain analysis of the tooth profile parameters, the standard deviation of the tooth profile parameters is calculated: The discrete degree of the thread processing quality can be quantitatively evaluated, and the gradual error caused by tool wear or clamping deformation in the thread manufacturing process can be effectively identified, thereby providing a quantitative basis for process optimization.

2. The machine vision-based measurement method of the dimensions of a round thread according to claim 1, characterized in that, The specific process of the step S1 is: driving the monocular camera to move along the threaded axis by equal steps through a translation table, and acquiring the sequence images of the adjacent fields by a time triggered image acquisition mode; wherein the adjacent fields F A With F B The fields of view are formed in the threaded axial direction, and the width and height of the fields are w And h In order to ensure that the adjacent fields have sufficient overlapping areas, so as to completely cover the thread, the axial step distance L Satisfies: To avoid the misalignment or breakage of the splicing between different sheets due to errors, the forward motion error is required to be less than 0.1 mm Control the pitch p within half, that is: 。 3. The machine vision-based measurement method of the dimensions of a round thread according to claim 1, characterized in that, Step S2 specifically involves: for different thread pattern sizes, firstly, using the binarized pattern size... canny The operator performs pixel-level edge detection to extract the thread profile: in Indicates the first i Coordinates of the contour points n It is the total number of sampling points on the contour edge; using the contour edge The first and second gradients are used to obtain neighborhood information of the edge. To provide an unbiased and high-precision numerical approximation of the differential of discrete pixels, gradient calculation employs... 7-tap Interpolator and its differential kernel, calculate the contour edge at... x and y First gradient of direction , With second gradient , , Finally, adopt Steger Unbiased curve structure detection eliminates systematic biases caused by discrete sampling and utilizes edge detection. Construction of first and second derivatives in the neighborhood Hessian matrix: Through the Perform singular value decomposition and select the eigenvector corresponding to the largest eigenvalue. , This vector represents a unit vector along a direction perpendicular to the edge; calculate the contour edge. Correction amount along the normal direction for: Updating edge profile pixels The position gets subpixel coordinates: 。 4. The machine vision-based measurement method of the dimensions of a round thread according to claim 1, characterized in that, The step S3 specifically comprises: firstly, sorting the obtained modified sub-pixel contour points according to the contour direction of the thread, For the sub-pixel edge point, an equilateral triangle is constructed by the adjacent two sub-pixel edge points along the contour traversal direction, And Respectively, the vertices of the adjacent two equilateral triangles; For the sub-pixel edge point, an equilateral triangle is constructed by the adjacent two sub-pixel edge points along the contour traversal direction, Around Rotating The angle, and the rotation matrix is represented as: wherein, is the rotation angle; the same way can be used to calculate the coordinates; the angle between two adjacent equilateral triangles can be calculated by the following formula: Then, the comparison with a preset threshold is made, and if greater than , the corresponding feature point is determined; the entire contour is sequentially traversed according to this method.

5. The machine vision-based measurement method of the dimensions of a round thread according to claim 1, characterized in that, The step S4 is specifically: assuming two adjacent maps F A With F B , and there is a known fixed movement distance between them L , the feature point set extracted in the two maps And , wherein , represent the feature point coordinates in map F A and map F B ​ First, according to the given moving distance L to the map F B pan: For F B feature points in Translate by a fixed movement distance: by the initially translated map F B The matching error between the feature points is calculated and the position is further optimized using the least square method; the transformation matrix T is expressed as a two-dimensional affine transformation matrix: wherein , , , are coefficients of an affine transformation, and are translation amounts; the translation amounts and are adjusted for the map sheet F B ; the cost function represents the sum of squares of coordinate errors between the characteristic points of the map F B and the corresponding characteristic points in the map F A sheet. wherein, is the translated feature point coordinate, the transformation matrix is optimized by minimizing the cost function T so that the feature points in the map F B are better aligned with the feature points in the map F A ; to minimize the cost function, the least square method is used to obtain the optimal transformation matrix T ; the map F B is precisely aligned with the map F A according to the preliminary translation and the least square method optimized transformation matrix, and the map is spliced.

6. A machine vision based round thread dimensional measurement system characterized by, Comprising: An image acquisition module: obtaining multi-view field maps, adjacent maps have overlapping areas; A correction module: correcting the sub-pixel of the profile point of each map; Thread profile feature point extraction module: the modified sub-pixel profile points are sorted according to the profile direction of the thread, and the Euclidean distance between the adjacent two sub-pixel points is used to construct an equilateral triangle, and the included angle between the adjacent two equilateral triangles is calculated , if is greater than a predetermined threshold , the corresponding feature point is determined. A splicing module: splicing the map guided by the feature points; A model fitting module: based on the spliced map, respectively calculate the theoretical height and the measured height of the tooth profile, calculate the standard deviation of the tooth profile parameters based on the theoretical height and the measured height, and then judge whether the thread size is abnormal according to the standard deviation of the tooth profile parameters; The model fitting module specifically performs the process as follows: after completing the spatial splicing of the multi-sheet data, the least square method is used to parameterize the modeling of the tooth profile feature point set, and the best fitting straight line equation of the two side profiles is respectively established l 3 and l 4 are: wherein A 1, B 1, C 1 is l 3 straight line parameters, A 2, B 2, C 2 is l 4 straight line parameters; assuming the spherical center coordinates as , c 2 to l 3 and l 4 perpendicular distance is expressed as: From the above equation, the coordinates can be obtained, and the measured profile height h can be further obtained. Then, the axial distribution function of the thread is constructed as In the above formula represents the measured height value at the k sampled position, is the theoretical nominal value; for the spatial domain analysis of the dental profile parameters, the standard deviation of the dental profile parameters is calculated: The discrete degree of the thread processing quality can be quantitatively evaluated, and the gradual error caused by tool wear or clamping deformation in the thread manufacturing process can be effectively identified, thereby providing a quantitative basis for process optimization.

7. The machine vision-based round thread dimensional measurement system of claim 6, wherein, The correction module specifically works as follows: For different thread pattern sizes, firstly, it applies the correction to the binarized pattern size... canny The operator performs pixel-level edge detection to extract the thread profile: wherein represents the i profile point coordinates, n is the total number of profile edge sample points; Contour edges are obtained using first and second order gradients of the contour edges In order to make the derivative of a discrete pixel provide an unbiased, high-precision numerical approximation, interpolators and their differential kernels are used in the gradient calculation 7-tap The first order gradients x , y and the second order gradients , , , , of the contour edges in the Steger directions are calculated; finally, the unbiased curve structure detection eliminates systematic bias due to discrete sampling, using the first and second order derivatives of the edge neighborhood to construct Hessian matrices: Through the Perform singular value decomposition and select the eigenvector corresponding to the largest eigenvalue. , This vector represents a unit vector along a direction perpendicular to the edge; calculate the contour edge. Correction amount along the normal direction for: Updating edge profile pixels The position gets subpixel coordinates: 。 8. The machine vision-based round thread dimensional measurement system of claim 6, wherein, The thread profile feature point extraction module is specifically: first, the obtained modified sub-pixel contour points are sorted according to the contour direction of the thread, For the sub-pixel edge point, an equilateral triangle is constructed by the adjacent two sub-pixel edge points along the contour traversal direction, And Respectively, the vertices of the adjacent two equilateral triangles; For the sub-pixel edge point, an equilateral triangle is constructed by the adjacent two sub-pixel edge points along the contour traversal direction, Around Rotation Angle, and the rotation matrix is represented as: wherein, is the rotation angle; the same way can be used to calculate the coordinates; the angle between two adjacent equilateral triangles can be calculated by the following formula: Then, the comparison with a preset threshold is made, and if greater than , the corresponding feature point is determined; the entire contour is sequentially traversed according to this method.

9. The machine vision-based round thread dimensional measurement system of claim 6, wherein, The splicing module is specifically as follows: assuming two adjacent maps F A and F B , and there is a known fixed moving distance between them L , the feature point set extracted from the two maps and , wherein , respectively represent the feature point coordinates in the map F A and the map F B . First, according to the given moving distance L to the map F B pan: For F B feature points in Translate by a fixed movement distance: by the initially translated map F B The matching error between the feature points is calculated and the position is further optimized using the least square method; the transformation matrix T is expressed as a two-dimensional affine transformation matrix: wherein , , , are coefficients of an affine transformation, and are translation amounts; the translation amounts and are adjusted for the map sheet F B after the preliminary translation; the cost function represents the sum of squares of coordinate errors between the characteristic points of the map sheet F B and the corresponding characteristic points in the map sheet F A . wherein, is the translated feature point coordinate, the transformation matrix is optimized by minimizing the cost function T so that the feature points in the map F B are better aligned with the feature points in the map F A ; to minimize the cost function, the least square method is used to obtain the optimal transformation matrix T ; the map F B is accurately aligned with the map F A according to the preliminary translation and the least square optimized transformation matrix, and the map is spliced.

Citation Information

Patent Citations

  • Angle detection algorithm based on triangle similarity theorem

    CN107092909A

  • Thread parameter detection method based on machine vision

    CN111462066A

Cited By

  • Alloy die casting internal thread size detection method based on image processing

    CN122492788A