A method for measuring the lead of steel bars based on 3D vision

The 3D vision-based method for steel rebar pitch measurement automates the process, improving speed and accuracy while reducing human error and environmental sensitivity.

CN116309666BActive Publication Date: 2025-06-20JIANGSU RUNMO AUTOMOBILE TESTING EQUIP

Patent Information

Application Number
CN202310232830.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-13
Publication Date
2025-06-20
Estimated Expiration
2043-03-13

AI Technical Summary

Technical Problem

Existing steel rebar pitch measurement methods rely heavily on manual tools like calipers, leading to low efficiency, significant human error, difficulty in locating the start point, and sensitivity to lighting conditions.

Method used

A 3D vision-based method using a 3D camera to capture depth maps, apply threshold segmentation to extract the rebar outline, calculate the centerline, and utilize Python and Halcon algorithms to determine the pitch through extreme value points.

Benefits of technology

Enables fast, accurate, and automated rebar pitch measurement with reduced environmental sensitivity, avoiding errors associated with 2D vision methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116309666B_ABST
    Figure CN116309666B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for measuring the lead of steel bars based on 3D vision. First, a depth map of the steel bars is captured by a 3D camera, and then the threshold segmentation algorithm is used to extract the rectangular contour of the steel bars and extract the center line of the rectangle. Next, the depth values of all points on the center line are obtained and exported to an Excel table. Subsequently, based on the exported Excel table, Python is used to draw a function graph of the pixel coordinates and depth values of the points on the center line. Then, the filtering algorithm is used to optimize the function graph and find the maximum points. Finally, two maximum points between the specified pixel coordinate points are selected to calculate the lead of the steel bars. The present invention realizes the non-contact measurement function of the lead of steel bars with automation, and has a relatively fast measurement speed and good measurement effect for the lead of steel bars. It also avoids the large lead measurement error caused by the measurement method based on 2D vision. This measurement method has high measurement accuracy and is less affected by the environment, and is suitable for being widely promoted and used.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of steel bar lead measurement, and particularly relates to a method for measuring the lead of steel bars based on 3D vision. Background Art

[0002] The lead refers to the axial distance between adjacent corresponding points on the same helix in a thread or a worm; when the thread or the worm is formed by one helix, the lead is equal to the pitch; when the thread or the worm is formed by several helices, the lead is equal to the product of the pitch and the number of thread lines.

[0003] Currently, most of the existing methods for measuring the lead of steel bars use manual measurement with measuring devices such as vernier calipers, resulting in not only low efficiency, but also relatively large overall errors affected by the working state of workers, difficult positioning of the starting point of lead measurement, and relatively large influence of light; therefore, it is necessary to design a method for measuring the lead of steel bars based on 3D vision. Summary of the Invention

[0004] The purpose of the present invention is to overcome the deficiencies of the prior art. To better solve the problems that the existing methods for measuring the lead of steel bars mostly use manual measurement with measuring devices such as vernier calipers, resulting in not only low efficiency, but also relatively large overall errors affected by the working state of workers, difficult positioning of the starting point of lead measurement, and relatively large influence of light, a method for measuring the lead of steel bars based on 3D vision is provided. It realizes a non-contact function for measuring the lead of steel bars with automation, has a relatively fast speed and good effect in measuring the lead of steel bars, and also avoids the situation of relatively large lead measurement errors caused by using the measurement method based on 2D vision. This measurement method has a high measurement accuracy and is less affected by the environment.

[0005] In order to achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0006] A method for measuring the lead of steel bars based on 3D vision includes the following steps:

[0007] Step (A): Use a 3D camera to capture the depth map of the steel bar, then use the threshold segmentation algorithm to extract the rectangular contour of the steel bar, and extract the center line of the rectangle.

[0008] Step (B): Obtain the depth values of all points on the center line and export the depth values to an Excel table.

[0009] Step (C): Based on the exported Excel table, use Python to plot the function graph of the pixel coordinates and depth values of the points on the center line.

[0010] Step (D): Use a filtering algorithm to optimize the function graph and find the maximum value points.

[0011] Step (E): Select two maximum points between specified pixel coordinate points to calculate the steel bar lead.

[0012] For the aforementioned steel bar lead measurement method based on 3D vision, in step (A), use a 3D camera to capture the depth map of the steel bar, and then use a threshold segmentation algorithm to extract the rectangular contour of the steel bar and extract the center line of the rectangle. The specific steps are as follows:

[0013] Step (A1): Use a 3D camera to capture the depth map of the steel bar, where the 3D camera should be selected as structured light or based on the principle of laser triangulation.

[0014] Step (A2): Use a threshold segmentation algorithm to extract the rectangular contour of the steel bar. The specific steps are as follows:

[0015] Step (A21): Based on the Halcon algorithm library, use the threshold operator on the captured depth map of the steel bar for threshold segmentation.

[0016] Step (A22): Use the connection operator to connect a region and connect adjacent regions together, and then separate non-adjacent regions.

[0017] Step (A23): Use the selectshape operator to filter and obtain the ROI according to the area size of the region, and use the smallestrectangle2 operator to find the minimum circumscribed rectangle of the ROI.

[0018] Step (A3): Extract the center line of the rectangle, where the coordinate calculation formulas for the two endpoints of the rectangle center line are shown in formulas (1) and (2).

[0019] row1 := Row - (Length1) * sin(Phi)

[0020] col1 := Column + (Length1) * cos(Phi) (1)

[0021] row2 := Row + (Length1) * sin(Phi)

[0022] col2 := Column - (Length1) * cos(Phi) (2)

[0023] Among them, Row and Column are the coordinates of the rectangle center point, Phi is the inclination angle of the rectangle relative to the horizontal line, and Length1 is the length of one side of the rectangle; the origin of the entire image coordinate system is selected as the pixel point in the upper left corner of the image window.

[0024] The above-mentioned method for measuring the pitch of steel bars based on 3D vision, step (B), obtaining the depth values of all points on the center line and exporting the depth values to an Excel table, the specific steps are as follows:

[0025] Step (B1), using the operator get_region_points to obtain the row and column coordinates of all points on the line segment, and then using the tuple_number operator to sort the row and column coordinates of the points respectively;

[0026] Step (B2), creating an array, using the get_grayval operator to obtain the depth values of these points in sequence and adding them to this array one by one. At the same time, using the open_file operator to create an xls file and writing the data in the array.

[0027] The above-mentioned method for measuring the pitch of steel bars based on 3D vision, step (C), based on the exported Excel table, using Python to draw a function graph of the pixel coordinates and depth values of the points on the center line, the specific steps are as follows:

[0028] Step (C1), using the read_excel function of pandas to read the xls file written with depth values;

[0029] Step (C2), using the scipy algorithm package to provide smoothing and noise reduction for the depth values, and then using the matplotlib algorithm package to draw the depth function graph.

[0030] The above-mentioned method for measuring the pitch of steel bars based on 3D vision, step (D), using a filtering algorithm to optimize the function graph and find the maximum points. Specifically, using a loop statement to find the maximum points and the corresponding maximum values on the depth function graph, the specific steps are as follows:

[0031] Step (D1), determining the pixel range on the axial center line of the steel bar, that is, the x-axis range, and then determining the pixel length of a single thread of the steel bar, that is, a single peak interval on the depth function graph;

[0032] Step (D2), using the built-in max function of Python to traverse each peak interval and find the maximum value of each interval, and then counting all the maximum values and the corresponding pixel coordinate values.

[0033] The above-mentioned method for measuring the pitch of steel bars based on 3D vision, step (E), selecting two maximum points between specified pixel coordinate points to calculate the pitch of the steel bar. Specifically, calculating the pixel coordinate difference between the first and last groups of maximum values to obtain the pixel length of the pitch, and then obtaining the conversion matrix between pixel coordinates and world coordinates through the camera calibration of Halcon, the specific steps are as follows:

[0034] Step (E1): Use the gen_caltab operator to generate a calibration file, and then obtain the internal and external parameters of the current camera through the Halcon calibration assistant.

[0035] Step (E2): Convert the pixel coordinates of the points into world coordinates through image_points_to_world_plane, and then use the distance_pp operator to calculate the actual distance between two points, which is the actual length of the lead.

[0036] The beneficial effects of the present invention are as follows: A method for measuring the lead of steel bars based on 3D vision of the present invention first uses a 3D camera to capture the depth map of the steel bars, then uses a threshold segmentation algorithm to extract the rectangular contour of the steel bars and extract the center line of the rectangle. Next, obtain the depth values of all points on the center line and export the depth values to an Excel table. Subsequently, based on the exported Excel table, use Python to draw a function graph of the pixel coordinates and depth values of the points on the center line, then use a filtering algorithm to optimize the function graph and find the maximum value points. Finally, select two maximum value points between the specified pixel coordinate points to calculate the lead of the steel bars, effectively realizing that the measurement method has an automatic non-contact function for measuring the lead of steel bars, and the measurement speed of the lead of steel bars is relatively fast and the effect is good. It also avoids the situation where the measurement error of the lead is relatively large caused by the measurement method based on 2D vision. The measurement method has high measurement accuracy and is less affected by the environment. Description of the Drawings

[0037] Figure 1 is the overall flowchart of the present invention;

[0038] Figure 2 is the rectangular contour diagram of the steel bars extracted in the embodiment of the present invention;

[0039] Figure 3 is the depth data diagram corresponding to each pixel point on the center line in the embodiment of the present invention;

[0040] Figure 4 is the function graph drawn based on the exported depth values in the embodiment of the present invention;

[0041] Figure 5 is the function graph smoothed by using a filter in the embodiment of the present invention;

[0042] Figure 6 is the calculation process diagram of finding the maximum value points in the embodiment of the present invention;

[0043] Figure 7 is the measurement result diagram of the lead of the steel bars in the embodiment of the present invention. Detailed Embodiments

[0044] The following will further explain the present invention in conjunction with the drawings of the specification.

[0045] As Figure 1 shown, a method for measuring the pitch of steel bars based on 3D vision of the present invention includes the following steps:

[0046] Step (A): Use a 3D camera to capture the depth map of the steel bar, then use a threshold segmentation algorithm to extract the rectangular contour of the steel bar, and extract the center line of the rectangle. The specific steps are as follows:

[0047] Step (A1): Use a 3D camera to capture the depth map of the steel bar, where the 3D camera should be selected as structured light or based on the principle of laser triangulation;

[0048] Step (A2): Use a threshold segmentation algorithm to extract the rectangular contour of the steel bar. The specific steps are as follows:

[0049] Step (A21): Based on the Halcon algorithm library, use the threshold operator on the captured depth map of the steel bar for threshold segmentation;

[0050] Step (A22): Use the connection operator to connect a region and connect adjacent regions together, and then separate non-adjacent regions;

[0051] Step (A23): Use the selectshape operator to screen and obtain the ROI according to the area size of the region, and use the smallestrectangle2 operator to find the minimum circumscribed rectangle of the ROI;

[0052] Step (A3): Extract the center line of the rectangle, where the coordinate calculation formulas for the two endpoints of the rectangle center line are shown in Formulas (1) and (2):

[0053] row1: = Row - (Length1) * sin(Phi)

[0054] col1: = Column + (Length1) * cos(Phi) (1)

[0055] row2: = Row + (Length1) * sin(Phi)

[0056] col2: = Column - (Length1) * cos(Phi) (2)

[0057] Among them, Row and Column are the coordinates of the center point of the rectangle, Phi is the inclination angle of the rectangle relative to the horizontal line, and Length1 is the length of one side of the rectangle; the origin of the entire image coordinate system is selected as the pixel point in the upper left corner of the image window.

[0058] Step (B), obtain the depth values of all points on the center line and export the depth values to an excel table. The specific steps are as follows:

[0059] Step (B1), use the operator get_region_points to obtain the row and column coordinates of all points on the line segment, and then use the tuple_number operator to sort the row and column coordinates of the points respectively;

[0060] Step (B2), create an array, use the get_grayval operator to obtain the depth values of these points in sequence and add them to this array one by one. At the same time, use the open_file operator to create an xls file and write the data in the array.

[0061] Step (C), based on the exported excel table, use python to draw a function graph of the pixel coordinates and depth values of the points on the center line. The specific steps are as follows:

[0062] Step (C1), use the read_excel function of pandas to read the xls file written with depth values;

[0063] Step (C2), use the scipy algorithm package to provide smoothing and noise reduction of the depth values, and then use the matplotlib algorithm package to draw the depth function graph.

[0064] Step (D), use a filtering algorithm to optimize the function graph and find the maximum points. Specifically, use a loop statement to find the maximum points and the corresponding maximum values on the depth function graph. The specific steps are as follows:

[0065] Step (D1), determine the pixel range on the axial center line of the steel bar, that is, the x-axis range, and then determine the pixel length of a single thread of the steel bar, that is, the single peak interval on the depth function graph;

[0066] Step (D2), use the built-in max function of python to traverse each peak interval and find the maximum value of each interval, and then count all the maximum values and the corresponding pixel coordinate values.

[0067] Step (E), select two maximum points between the specified pixel coordinate points to calculate the lead of the steel bar. Specifically, calculate the pixel coordinate difference between the first and last groups of maximum values to obtain the pixel length of the lead, and then obtain the conversion matrix between pixel coordinates and world coordinates through the camera calibration of halcon. The specific steps are as follows:

[0068] Step (E1), use the gen_caltab operator to generate a calibration file, and then obtain the internal and external parameters of the current camera through the halcon calibration assistant;

[0069] Step (E2): Use the image_points_to_world_plane function to convert the pixel coordinates of the points into world coordinates, and then use the distance_pp operator to calculate the actual distance between two points, which is the actual length of the lead.

[0070] To better illustrate the usage effect of the present invention, a specific embodiment of the present invention is introduced below;

[0071] As Figure 2 shown, S1: Use a MekaMind uhp140 3D camera to capture steel bars to obtain a depth map, and then call the Halcon algorithm library to extract the rectangular contour of the steel bars;

[0072] As Figure 3 shown, S2: Obtain the depth values of all points on the center line;

[0073] As Figure 4 shown, S3: Based on the exported depth values, draw a depth function graph;

[0074] As Figure 5 and Figure 6 shown, S4: Use a filter to smooth the function graph and obtain the maximum value and the maximum value points;

[0075] As Figure 7 shown, S5: Obtain the internal and external parameters of the camera according to the calibration, use the image_points_to_world_plane function to convert the pixel coordinates of the points into world coordinates, and then use the distance_pp operator to calculate the actual distance between two points, which is the actual length of the lead.

[0076] In summary, a method for measuring the lead of steel bars based on 3D vision according to the present invention realizes an automatic non-contact function for measuring the lead of steel bars. The method has a relatively fast speed and good effect for measuring the lead of steel bars, and also avoids the large lead measurement error caused by the measurement method based on 2D vision. The measurement method has high measurement accuracy and is less affected by the environment, and has the advantages of scientific and reasonable method, strong applicability and good effect.

[0077] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and the descriptions in the specification only illustrate the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed. The scope of protection claimed by the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for measuring the pitch of steel bars based on 3D vision, characterized in that: It includes the following steps: Step (A): Use a 3D camera to capture the depth map of the steel bar, then use a threshold segmentation algorithm to extract the rectangular contour of the steel bar, and extract the center line of the rectangle; Step (B): Obtain the depth values of all points on the center line and export the depth values to an Excel table; Step (C): Based on the exported Excel table, use Python to plot the function graph of the pixel coordinates and depth values of the points on the center line; Step (D): Use a filtering algorithm to optimize the function graph and find the maximum points; Step (E): Select two maximum points between the specified pixel coordinate points to calculate the lead of the steel bar.

2. The method for measuring the pitch of steel bars based on 3D vision according to claim 1, characterized in that: Step (A): Use a 3D camera to capture the depth map of the steel bar, then use a threshold segmentation algorithm to extract the rectangular contour of the steel bar, and extract the center line of the rectangle. The specific steps are as follows: Step (A1): Use a 3D camera to capture the depth map of the steel bar, where the 3D camera should be selected as structured light or based on the principle of laser triangulation; Step (A2): Use a threshold segmentation algorithm to extract the rectangular contour of the steel bar. The specific steps are as follows: Step (A21): Based on the Halcon algorithm library, use the threshold operator to perform threshold segmentation on the captured depth map of the steel bar; Step (A22): Use the connection operator to connect a region and connect adjacent regions together, and then separate non-adjacent regions; Step (A23): Use the selectshape operator to screen the ROI according to the area size of the region, and use the smallestrectangle2 operator to find the minimum circumscribed rectangle of the ROI; Step (A3): Extract the center line of the rectangle. The coordinate calculation formulas for the two endpoints of the rectangle center line are shown in Formulas (1) and (2): row1 := Row - (Length1) * sin(Phi) col1 := Column + (Length1) * cos(Phi) (1) row2 := Row + (Length1) * sin(Phi) col2 := Column - (Length1) * cos(Phi) (2) where Row and Column are the coordinates of the center point of the rectangle, Phi is the inclination angle of the rectangle relative to the horizontal line, and Length1 is the length of one side of the rectangle; the origin of the entire image coordinate system is selected as the pixel point in the upper left corner of the image window.

3. The method for measuring the pitch of steel bars based on 3D vision according to claim 1, characterized in that: Step (B): Obtain the depth values of all points on the center line and export the depth values to an Excel table. The specific steps are as follows: Step (B1): Use the get_region_points operator to obtain the row and column coordinates of all points on the line segment, and then use the tuple_number operator to sort the row and column coordinates of the points respectively; Step (B2): Create an array, use the get_grayval operator to obtain the depth values of these points in sequence and add them to the array in turn. At the same time, use the open_file operator to create an xls file and write the data in the array.

4. The method for measuring the pitch of steel bars based on 3D vision according to claim 3, characterized in that: Step (C), based on the exported Excel table, use Python to plot a function graph of the pixel coordinates and depth values of the points on the center line. The specific steps are as follows: Step (C1), use the read_excel function of pandas to read the xls file written with depth values; Step (C2), use the scipy algorithm package to provide smoothing and noise reduction for the depth values, and then use the matplotlib algorithm package to plot the depth function graph.

5. The method for measuring the pitch of steel bars based on 3D vision according to claim 4, characterized in that: Step (D), use a filtering algorithm to optimize the function graph and find the maximum points. Specifically, use a loop statement to find the maximum points and corresponding maximum values on the depth function graph. The specific steps are as follows: Step (D1), determine the pixel range on the axial center line of the steel bar, that is, the x-axis range, and then determine the pixel length of a single thread of the steel bar, that is, a single peak interval on the depth function graph; Step (D2), use the built-in max function of Python to traverse each peak interval and find the maximum value of each interval, and then count all the maximum values and the corresponding pixel coordinate values.

6. The method for measuring the pitch of steel bars based on 3D vision according to claim 5, characterized in that: Step (E), select two maximum points between specified pixel coordinate points to calculate the lead of the steel bar. Specifically, calculate the pixel coordinate difference between the first and last groups of maximum values to obtain the pixel length of the lead, and then obtain the conversion matrix between pixel coordinates and world coordinates through the camera calibration of Halcon. The specific steps are as follows: Step (E1), use the gen_caltab operator to generate a calibration file, and then obtain the internal and external parameters of the current camera through the Halcon calibration assistant; Step (E2), convert the pixel coordinates of the points to world coordinates through image_points_to_world_plane, and then use the distance_pp operator to calculate the actual distance between the two points, which is the actual length of the lead.

Citation Information

Patent Citations

  • An online visual method for thread key size parameters under a motion background

    CN109785338A

  • Thread angle measuring method based on machine vision

    CN111353993A

Cited By

  • Threaded raceway lead measuring method based on raceway axial section contour data

    CN121323546A