A method and system for measuring the spacing between steel bars based on multi-view vision

By using multi-view vision technology to perform three-dimensional correction and depth information calculation on rebar spacing, the complexity and accuracy problems of traditional measurement methods are solved, and efficient and accurate rebar spacing measurement is achieved.

CN120912613BActive Publication Date: 2026-02-24SHENZHEN TIEYUE ELECTRIC CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511441694.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2026-02-24
Estimated Expiration
2045-10-10

AI Technical Summary

Technical Problem

Traditional methods for measuring rebar spacing are complex to operate, inefficient, and susceptible to human factors. Environmental interference at construction sites can also lead to inaccurate measurement results.

Method used

A multi-view vision-based method for measuring rebar spacing is adopted. The stereo correction module corrects the binocular camera image, the global feature is used to generate a feature matching constraint matrix for local feature point matching, the depth information of rebar intersections is calculated by combining camera calibration parameters, and the spacing is calculated by inverse projection formula.

Benefits of technology

It improves the accuracy and efficiency of rebar spacing measurement, reduces errors caused by image distortion and optical axis non-parallelism, eliminates interference from connectors, and enhances the reliability of the measurement system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120912613B_ABST
    Figure CN120912613B_ABST
Patent Text Reader

Abstract

A steel bar spacing measurement method and system based on multi-view vision, the application relates to the field of distance measurement, in the method, based on the remapping parameter, the stereo correction module carries out stereo correction to the left and right images to obtain the corrected left and right images; based on the global features of the corrected left and right images, the steel bar depth information calculation module calculates the feature matching constraint matrix; based on the local feature points of the corrected left and right images, the steel bar depth information calculation module determines the matching feature point pair; based on the matching feature points, the steel bar depth information calculation module calculates the parallax value, and calculates the depth information of the steel bar intersection point according to the parallax value and the preset camera calibration parameter; based on the corrected left and right images, the steel bar intersection point three-dimensional coordinate reconstruction module detects and reconstructs the pixel coordinates of the steel bar intersection point; based on the depth information and the pixel coordinates, the physical spacing calculation module calculates the steel bar spacing according to the inverse projection formula. The application is used for improving the accuracy of steel bar spacing measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of distance measurement, and in particular relates to a method and system for measuring rebar spacing based on multi-view vision. Background Technology

[0002] In building construction, accurate measurement of rebar spacing is crucial for ensuring project quality. Traditional methods for measuring rebar spacing mainly rely on measuring tools such as laser rangefinders and protractors, requiring manual alignment of the rebar ends and movement of the measuring tool to obtain spacing data. This method is not only complex and inefficient, but also susceptible to errors due to human factors, especially when working on large areas of rebar, requiring numerous repeated measurements and consuming significant manpower and time.

[0003] In related technologies, a machine vision-based rebar spacing measurement technique is commonly used. This technique acquires images of the rebars using a vision sensor, identifies the rebar positions using image processing algorithms, and calculates the spacing, thereby automating the measurement process and improving measurement efficiency and accuracy.

[0004] However, due to the complex environment of construction sites, there are often interference factors such as strong light, vibration and obstruction. These factors can affect image quality, resulting in inaccurate extraction of rebar features and unreliable measurement results, making it difficult to meet the measurement needs of actual construction sites. Summary of the Invention

[0005] This application provides a method and system for measuring rebar spacing based on multi-view vision, which is used to improve the accuracy of rebar spacing measurement.

[0006] In a first aspect, this application provides a method for measuring rebar spacing based on multi-view vision, applied to a measurement system. The measurement system includes a stereo calibration module, a rebar depth information calculation module, a rebar intersection three-dimensional coordinate reconstruction module, and a physical spacing calculation module. The method includes:

[0007] Based on the remapping parameters calculated from the intrinsic and extrinsic parameters of the binocular camera, the stereo correction module performs stereo correction on the left and right images acquired by the binocular camera to obtain corrected left and right images.

[0008] Based on the global features of the corrected left and right images, the rebar depth information calculation module calculates the similarity between the global features to obtain the feature matching constraint matrix;

[0009] Based on the local feature points of the corrected left and right images, the rebar depth information calculation module uses the feature matching constraint matrix as a constraint condition to match the local feature points and obtain matching feature point pairs.

[0010] Based on matching feature points, the rebar depth information calculation module calculates the disparity value and calculates the depth information of the rebar intersections according to the disparity value and preset camera calibration parameters.

[0011] Based on the corrected left and right images, the 3D coordinate reconstruction module for rebar intersections detects and reconstructs the pixel coordinates of the rebar intersections.

[0012] Based on depth information and pixel coordinates, the physical spacing calculation module calculates the rebar spacing according to the inverse projection formula.

[0013] By employing the above technical solutions, the stereo correction module corrects the images acquired by the binocular camera, reducing errors caused by image distortion and the non-parallelism of the binocular camera's optical axis. The rebar depth information calculation module generates a feature matching constraint matrix using global features, and performs local feature point matching under this constraint, improving the accuracy of feature point matching and reducing mismatches. Based on the accurately matched feature points, the disparity value is calculated and combined with camera calibration parameters to obtain more accurate rebar intersection depth information. The rebar intersection 3D coordinate reconstruction module detects and reconstructs the pixel coordinates of the rebar intersections, and combines them with the obtained depth information to accurately calculate the actual physical spacing of the rebars using the inverse projection formula. The measurement system can simultaneously acquire spacing data from multiple rebar intersections, improving measurement efficiency and the accuracy of rebar spacing measurement.

[0014] In conjunction with some embodiments of the first aspect, in some embodiments, based on the remapping parameters calculated from the intrinsic and extrinsic parameters of the binocular camera, the stereo correction module performs stereo correction on the left and right images acquired by the binocular camera to obtain corrected left and right images, specifically including:

[0015] The stereo calibration module calibrates the stereo camera using the checkerboard method, obtaining the intrinsic and extrinsic parameter matrices of the stereo camera.

[0016] The stereo correction module decomposes the intrinsic and extrinsic parameter matrices to obtain the rotation matrix, and calculates the projection matrix based on the rotation matrix to make the optical axes of the binocular cameras parallel and the epipolar lines aligned in the horizontal direction.

[0017] The stereo correction module constructs the coplanar image plane of the binocular camera based on the projection matrix and calculates the remapping parameters;

[0018] The stereo correction module uses remapping parameters to remap the left and right images to obtain corrected left and right images.

[0019] By employing the above technical solution and using the checkerboard method for camera calibration, the intrinsic and extrinsic parameter matrices of the binocular camera can be obtained. By decomposing these matrices to obtain the rotation matrix, and calculating the projection matrix, the optical axes of the binocular camera are made parallel and the epipolar lines are aligned horizontally. This reduces the search range for binocular disparity calculation and improves the efficiency of feature matching. The coplanar image plane constructed based on the projection matrix ensures that the left and right images are on the same plane, facilitating pixel-level matching of corresponding points. The calculation and application of remapping parameters eliminate image distortion, enabling the corrected left and right images to better reflect the geometric relationships of the actual scene and improving the accuracy of rebar spacing measurement.

[0020] In conjunction with some embodiments of the first aspect, in some embodiments, the inverse projection formula is: ;

[0021] In the above formula, The focal length is the intrinsic parameter of the calibrated binocular camera. The physical distance between the optical centers of the two cameras. The disparity value of the rebar intersection point is calculated based on pixel coordinates. This is depth information.

[0022] By adopting the above technical solution, the parameters in the formula are all definite values ​​obtained through camera calibration, and the parallax value is precise data obtained based on image processing. This calculation method based on geometric optics reduces the cumulative error in traditional measurement methods, can directly obtain the absolute depth value of the rebar intersection, and improves the accuracy of the rebar spacing.

[0023] In conjunction with some embodiments of the first aspect, in some embodiments, after the physical spacing calculation module calculates the rebar spacing according to the inverse projection formula, the method further includes:

[0024] The rebar depth information calculation module extracts and corrects the pixel grayscale gradient values ​​in the left and right images, and identifies the regions with pixel grayscale gradient values ​​greater than the first preset threshold as candidate regions for connectors;

[0025] The rebar depth information calculation module calculates the pixel connected regions of the candidate region of the connector and uses the center point coordinates of each pixel connected region as the position coordinates of the connector.

[0026] When the pixel distance between the determined position coordinates and the intersection point of the rebar is less than a second preset threshold, the rebar depth information calculation module marks the connector as an interfering connector.

[0027] The rebar depth information calculation module determines the edge contour for each interfering connector;

[0028] The rebar depth information calculation module recalculates the pixel coordinates of the rebar intersections based on the edge contour to obtain the corrected pixel coordinates.

[0029] Based on depth information and corrected pixel coordinates, the physical spacing calculation module calculates the corrected rebar spacing according to the inverse projection formula.

[0030] By employing the above technical solution, candidate regions for connectors are identified through pixel grayscale gradient values, and the position coordinates of connectors are determined by calculating pixel connected components. This allows for the detection of interfering connectors that affect the positioning of rebar intersections. For marked interfering connectors, their edge contours are determined, and the pixel coordinates of the rebar intersections are recalculated, eliminating the interference of connectors on the positioning of rebar intersections. After this correction process, the pixel coordinates of the rebar intersections are more accurate, and the rebar spacing calculated using depth information and inverse projection formulas is closer to the actual value. This solves the measurement error problem caused by rebar connectors on site and improves the accuracy of rebar spacing measurement.

[0031] In conjunction with some embodiments of the first aspect, in some embodiments, the rebar depth information calculation module determines the edge contour for each interfering connector, specifically including:

[0032] The rebar depth information calculation module obtains the grayscale gradient map of a preset pixel range around the interfering connector;

[0033] The rebar depth information calculation module performs binarization processing on the grayscale gradient map to obtain a binarized image;

[0034] The rebar depth information calculation module performs connected component analysis on the binarized image and determines the set of connected pixels as the edge contour.

[0035] By adopting the above technical solution, since connectors often interfere with the pixel coordinate detection of rebar intersections, the edge contour information obtained in this way can more accurately describe the geometric shape and spatial distribution characteristics of the connectors. Therefore, when recalculating the pixel coordinates of the rebar intersections subsequently, the influence of the connectors can be removed from the rebar intersection detection results. This edge contour extraction method based on grayscale gradient and connected component analysis, compared to directly using simple shape templates or fixed threshold segmentation methods, can better adapt to connectors of different shapes and sizes, improving the accuracy of edge contour extraction and thus enhancing the detection precision of the rebar intersection pixel coordinates.

[0036] In conjunction with some embodiments of the first aspect, in some embodiments, after the rebar depth information calculation module calculates the pixel connected components of the candidate region of the connector, the method further includes:

[0037] The rebar depth information calculation module calculates the pixel distance between candidate regions of adjacent connectors;

[0038] When the pixel distance is less than the third preset threshold, the rebar depth information calculation module will merge adjacent connector candidate regions into the same connector candidate region.

[0039] The rebar depth information calculation module recalculates the pixel connectivity of the merged candidate region of the connector.

[0040] By employing the above technical solution, the pixel distance between adjacent connector candidate regions is calculated, and when the pixel distance is less than a third preset threshold, adjacent connector candidate regions are merged into a single connector candidate region. Then, the pixel connected components of the merged connector candidate region are recalculated. This solves the problem of over-segmentation of connector regions caused by image noise and uneven illumination. This adaptive region merging mechanism can re-merge candidate regions that should belong to the same connector but have been incorrectly segmented, avoiding the situation where a complete connector is mistakenly identified as multiple independent connectors. This improves the accuracy and reliability of connector candidate region identification and reduces error accumulation in subsequent processing.

[0041] In conjunction with some embodiments of the first aspect, in some embodiments, the rebar depth information calculation module calculates the pixel distance between adjacent candidate regions of connectors, specifically including:

[0042] The reinforcement depth information calculation module establishes a connection relationship diagram with the center point of each candidate area of ​​the connector as the node;

[0043] The reinforcement depth information calculation module calculates the Euclidean distance between adjacent nodes in the connection relationship diagram and uses the Euclidean distance as the pixel distance.

[0044] By adopting the above technical solution, a connection graph is established with the center point of each candidate connector region as a node, and the Euclidean distance between adjacent nodes in the connection graph is calculated as the pixel distance, thus constructing a mathematical expression of the spatial relationship between candidate connector regions. This graph theory-based distance calculation method transforms the spatial relationship between candidate connector regions into a quantifiable numerical indicator, providing a clear mathematical basis for region merging judgment and improving the accuracy of the region merging process.

[0045] In a second aspect, embodiments of this application provide a rebar spacing measurement system based on multi-view vision. The rebar spacing measurement system based on multi-view vision includes: one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the measurement system to perform the method as described in the first aspect and any possible implementation thereof.

[0046] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a measurement system, cause the measurement system to perform the method described in the first aspect and any possible implementation thereof.

[0047] Fourthly, embodiments of this application provide a computer program product that, when run on a measurement system, causes the measurement system to perform the method described in any possible implementation of the first aspect.

[0048] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

[0049] 1. This application provides a multi-view vision-based method for measuring rebar spacing. A stereo correction module corrects images acquired by a binocular camera, reducing errors caused by image distortion and the non-parallelism of the binocular camera's optical axis. A rebar depth information calculation module generates a feature matching constraint matrix using global features, performing local feature point matching under this constraint, improving the accuracy of feature point matching and reducing mismatches. Based on accurately matched feature points, disparity values ​​are calculated and combined with camera calibration parameters to obtain more precise rebar intersection depth information. A rebar intersection 3D coordinate reconstruction module detects and reconstructs the pixel coordinates of the rebar intersections, combining this with the obtained depth information and using an inverse projection formula to accurately calculate the actual physical spacing of the rebars. The measurement system can simultaneously acquire spacing data from multiple rebar intersections, improving measurement efficiency and the accuracy of rebar spacing measurement.

[0050] 2. This application provides a multi-view vision-based method for measuring rebar spacing. By analyzing pixel grayscale gradient values ​​to identify candidate regions for connectors and calculating pixel connected components to determine the coordinates of the connector positions, it can detect interfering connectors that affect the positioning of rebar intersections. For marked interfering connectors, by determining their edge contours and recalculating the pixel coordinates of the rebar intersections, the interference of connectors on the positioning of rebar intersections is eliminated. After this correction process, the pixel coordinates of the rebar intersections are more accurate, and the rebar spacing calculated by combining depth information and the inverse projection formula is closer to the actual value. This solves the measurement error problem caused by rebar connectors on site and improves the accuracy of rebar spacing measurement.

[0051] 3. This application provides a multi-view vision-based method for measuring rebar spacing. By calculating the pixel distance between adjacent candidate regions of connectors, and merging adjacent candidate regions into a single candidate region when the pixel distance is less than a third preset threshold, the method then recalculates the pixel connected components of the merged candidate region. This solves the problem of over-segmentation of connector regions caused by image noise and uneven illumination. This adaptive region merging mechanism can re-merge candidate regions that should belong to the same connector but have been incorrectly segmented, avoiding the situation where a complete connector is mistakenly identified as multiple independent connectors. This improves the accuracy and reliability of connector candidate region identification and reduces error accumulation in subsequent processing. Attached Figure Description

[0052] Figure 1 This is a flowchart illustrating a multi-view vision-based method for measuring rebar spacing in an embodiment of this application.

[0053] Figure 2 This is a flowchart illustrating an improved method for measuring rebar spacing in an embodiment of this application.

[0054] Figure 3 This is a schematic diagram of the physical device structure of a rebar spacing measurement system based on multi-view vision provided in an embodiment of this application. Detailed Implementation

[0055] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to any or all possible combinations including one or more of the listed items.

[0056] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0057] The following example is used in conjunction with Figure 1 The present application describes a method for measuring rebar spacing based on multi-view vision in an embodiment of the present application:

[0058] Please see Figure 1This is a flowchart illustrating a multi-view vision-based rebar spacing measurement method in an embodiment of this application.

[0059] S101. Based on the remapping parameters calculated from the intrinsic and extrinsic parameters of the binocular camera, the stereo correction module performs stereo correction on the left and right images acquired by the binocular camera to obtain corrected left and right images.

[0060] Based on the remapping parameters calculated from the intrinsic and extrinsic parameter matrices of the stereo camera, the stereo correction module performs stereo correction on the left and right images acquired by the stereo camera to obtain corrected left and right images. Specifically, the stereo correction module performs camera calibration on the stereo camera using a checkerboard method to obtain the intrinsic and extrinsic parameter matrices of the stereo camera; the stereo correction module decomposes the intrinsic and extrinsic parameter matrices to obtain a rotation matrix, and calculates a projection matrix based on the rotation matrix to make the optical axes of the stereo camera parallel and the epipolar lines aligned in the horizontal direction; the stereo correction module constructs a coplanar image plane of the stereo camera based on the projection matrix and calculates the remapping parameters; the stereo correction module uses the remapping parameters to remap the left and right images to obtain corrected left and right images.

[0061] The stereo calibration module performs stereo calibration on the left and right images acquired by the binocular cameras, obtaining calibrated left and right images. This step first uses a checkerboard method to calibrate the binocular cameras, obtaining their intrinsic and extrinsic parameter matrices. The intrinsic parameter matrix contains inherent parameters such as the camera's focal length, principal point coordinates, and distortion coefficients, while the extrinsic parameter matrix describes the relative positional relationship between the two cameras, including rotation matrices and translation vectors. The stereo calibration module obtains the rotation matrix by decomposing the intrinsic and extrinsic parameter matrices. This rotation matrix is ​​used to adjust the imaging planes of the two cameras, making them coplanar and their optical axes parallel. The projection matrix is ​​calculated based on the rotation matrix to ensure that the epipolar lines of the binocular cameras are aligned horizontally, thus simplifying the two-dimensional feature matching problem into a one-dimensional search. Based on the projection matrix, a coplanar image plane of the binocular cameras is constructed, and remapping parameters are calculated. These remapping parameters contain the coordinate transformation information required to map the original images to the calibrated images. Finally, the left and right images are remapped using the remapping parameters to obtain the calibrated left and right images. The parameters used in the chessboard method, such as the chessboard grid size, the number of calibration images, and the chessboard grid corner detection accuracy threshold, can be adjusted according to the actual application scenario, and are not limited here.

[0062] Specific implementation methods for stereo correction include: The first method uses the Zhang Zhengyou calibration method. This involves capturing checkerboard images from different angles, extracting checkerboard corners using corner detection algorithms (such as Harris corner detection or sub-pixel level corner detection), establishing the correspondence between the world coordinate system and the image coordinate system, solving for the camera intrinsic matrix and distortion coefficients using the least squares method, and then obtaining the rotation and translation relationship between the two cameras through stereo calibration. The Bouguet algorithm is used to calculate the rotation matrix for stereo correction, determining the optimal correction parameters by minimizing the reprojection error. The second method employs a feature-point-based self-calibration method. Image feature points are extracted using feature detection algorithms such as SIFT or SURF, mismatched points are removed using the RANSAC algorithm, the fundamental matrix is ​​calculated using the eight-point algorithm, and then the fundamental matrix is ​​decomposed to obtain the essential matrix. The relative pose of the cameras is recovered from the essential matrix. The Hartley algorithm is used for stereo correction. This algorithm constructs a homography transformation matrix so that the corresponding epipolar lines of the two images are parallel and located on the same horizontal line.

[0063] In stereo calibration, the loss of image edge information can occur. To address this issue, an adaptive boundary expansion method can be employed. This method dynamically adjusts the size and cropping region of the output image based on the effective area of ​​the calibrated image when calculating remapping parameters. By analyzing the characteristics of the calibration transformation matrix, the degree of image deformation is predicted, maximizing the preservation of original image information while ensuring epipolar alignment accuracy. Simultaneously, image interpolation algorithms, such as bilinear interpolation or cubic spline interpolation, are introduced to smooth pixel values ​​during the remapping process, reducing image quality degradation caused by coordinate transformation.

[0064] S102. Based on the global features of the corrected left and right images, the rebar depth information calculation module calculates the similarity between global features to obtain the feature matching constraint matrix.

[0065] The rebar depth information calculation module calculates the similarity between global features of the corrected left and right images to obtain a feature matching constraint matrix. Global features refer to high-dimensional feature vectors that characterize the entire image content, containing information such as texture, structure, and semantics. The rebar depth information calculation module extracts global feature descriptors from the corrected left and right images using deep learning networks or traditional feature extraction methods. Similarity calculation employs cosine similarity, Euclidean distance, or other metrics to evaluate the feature similarity of corresponding regions in the left and right images. The feature matching constraint matrix is ​​a two-dimensional matrix where each element represents the matching confidence between a region in the left image and its corresponding region in the right image. Rows in the matrix correspond to feature regions in the left image, and columns correspond to feature regions in the right image. The values ​​of the matrix elements can be normalized to the interval [0, 1], where 1 represents a perfect match and 0 represents a complete mismatch. Parameters such as the similarity threshold, feature dimension, and matching confidence calculation method can be set according to specific application requirements and are not limited here.

[0066] Specific implementation methods for global feature extraction and similarity calculation include: The first method uses a pre-trained convolutional neural network (such as ResNet, VGG, or EfficientNet) as the feature extractor. The corrected left and right images are input into the network, and feature maps are extracted from the middle layers or before the final fully connected layer. Global average pooling or max pooling is performed on the feature maps to obtain a fixed-dimensional global feature vector. Cosine similarity is used to calculate the feature similarity of corresponding regions in the left and right images, constructing a feature matching constraint matrix. By setting a similarity threshold, matching pairs below the threshold are marked as invalid matches, forming a sparse constraint matrix. The second method uses traditional image descriptors, such as the GIST or HOG descriptors, dividing the image into a regular grid. An oriented gradient histogram or Gabor filter response is calculated within each grid. The features of all grids are concatenated to form a global feature vector, and normalized cross-correlation or chi-square distance is used to calculate feature similarity. Dynamic programming or graph cut algorithms are used to optimize the feature matching results, generating a spatially consistent feature matching constraint matrix.

[0067] When calculating global feature similarity, illumination variations can lead to feature instability. To address this issue, illumination-invariant feature extraction methods can be introduced. This method first preprocesses the input image for illumination, including histogram equalization, adaptive histogram equalization, or the Retinex algorithm, to reduce the impact of uneven illumination. In the feature extraction stage, feature representations robust to illumination variations, such as gradient direction features or phase consistency features, are employed. A multi-scale feature pyramid is constructed, extracting and fusing features at different scales to improve the discriminative power and stability of the features. By weighted fusion of similarity scores from multiple features, a more reliable feature matching constraint matrix is ​​generated.

[0068] S103. Based on the local feature points of the corrected left and right images, the rebar depth information calculation module uses the feature matching constraint matrix as a constraint condition to match the local feature points and obtain matching feature point pairs.

[0069] The rebar depth information calculation module, based on corrected local feature points in the left and right images, uses a feature matching constraint matrix as a constraint condition to match local feature points, obtaining matched feature point pairs. Local feature points refer to key points in the image that are salient and repeatable, such as corner points, edge points, or center points of textured areas. The module uses a feature detection algorithm to extract local feature points and their descriptors from the left and right images respectively. The feature matching constraint matrix, as prior knowledge, limits the search range and matching probability of feature point matching. When performing local feature point matching, not only the similarity between feature descriptors is considered, but the matching confidence requirement at corresponding positions in the constraint matrix must also be met. Matched feature point pairs refer to the pairing of feature points corresponding to the same spatial point in the left and right images; these pairs will be used for subsequent disparity calculation. Parameters such as the number of local feature points, the dimension of the feature descriptors, and the matching distance threshold can be adjusted according to image quality and computational resources, and are not limited here.

[0070] The specific implementation methods for local feature point detection and constraint matching include: The first method uses the SIFT (Scale Invariant Feature Transform) algorithm to detect feature points. This algorithm finds scale-space extrema by constructing a Gaussian difference pyramid and uses principal direction assignment to achieve rotation invariance, generating a 128-dimensional feature descriptor. In the feature matching stage, for each feature point in the left image, when searching for candidate matching points in the right image, the constraint value of the corresponding region in the feature matching constraint matrix is ​​first queried, and the search is only performed in regions where the constraint value is higher than a preset threshold. Preliminary matching is performed using the nearest neighbor distance ratio test, and then matching optimization is performed by combining epipolar constraints and disparity range constraints. The second method uses the ORB (Oriented FAST and Rotated BRIEF) algorithm. It uses a FAST corner detector to quickly locate feature points, calculates the orientation of feature points using image moments, and generates binary descriptors. In the constraint matching process, a matching cost function is constructed using the feature matching constraint matrix, and the descriptor distance and constraint confidence are weighted and combined. Hamming distance is used to calculate the similarity of the binary descriptors, and erroneous matches are eliminated through bidirectional matching verification and the RANSAC algorithm, resulting in high-quality matching feature point pairs.

[0071] When performing local feature point matching under constraints, a technical problem may arise where overly strong constraints lead to the incorrect rejection of correct matches. To address this issue, an adaptive constraint relaxation strategy can be employed. This strategy dynamically adjusts the constraint strength based on the distribution density and saliency of local feature points. For sparse feature regions, the threshold requirement of the constraint matrix is ​​appropriately relaxed to expand the search range and increase the matching success rate. A multi-level matching verification mechanism is introduced. First, a candidate matching set is obtained under relatively relaxed constraints. Then, methods such as geometric consistency testing and disparity continuity testing are used to progressively screen the matches, ensuring accuracy. Simultaneously, a matching confidence scoring system is established, comprehensively considering descriptor similarity, constraint satisfaction, and spatial consistency. Each matching pair is assigned a confidence score for weighted application in subsequent processing.

[0072] S104. Based on matching feature points, the rebar depth information calculation module calculates the disparity value and calculates the depth information of the rebar intersections according to the disparity value and preset camera calibration parameters.

[0073] The rebar depth information calculation module calculates disparity values ​​based on matching feature point pairs, and then calculates the depth information of rebar intersections based on the disparity values ​​and preset camera calibration parameters. The disparity value refers to the difference in the horizontal coordinates of the same spatial point in the left and right images; that is, the x-coordinate of a feature point in the left image minus the x-coordinate of the corresponding feature point in the right image. Preset camera calibration parameters include the corrected camera focal length f and the baseline length T (the physical distance between the optical centers of the two cameras). The depth information calculation is based on the principle of triangulation; the three-dimensional coordinates of spatial points can be recovered through the disparity values ​​and camera parameters. As an important measurement target, the accuracy of the depth information of rebar intersections directly affects the accuracy of spacing measurements. Parameters such as the sub-pixel accuracy of disparity calculation and the numerical stability threshold of depth calculation can be set according to the measurement accuracy requirements and are not limited here.

[0074] The specific implementation methods for disparity calculation and depth recovery include: The first method employs a sub-pixel level disparity optimization approach. Based on integer-pixel level matching, sub-pixel accuracy disparity estimation is achieved through parabolic fitting or phase correlation methods. For each matched feature point pair, a matching cost function is calculated in its neighborhood. The extreme point of the cost function is found through least-squares fitting, and the position corresponding to this extreme point is the sub-pixel level matching position. The triangulation formula Z=fT / ( Calculate the depth value, where Z is the depth, f is the focal length, and T is the baseline length. The disparity value is used. To improve computational stability, median filtering or bilateral filtering is applied to the disparity value to remove the influence of outliers. The second implementation uses a global disparity optimization method based on confidence propagation, constructing a Markov random field model to transform disparity calculation into an energy minimization problem. A data term is defined to represent the matching cost, and a smoothing term represents the continuity constraint of disparity between adjacent pixels. The optimal disparity map is solved using a confidence propagation algorithm or a graph cut algorithm. For the disparity value at feature point locations, bilinear interpolation is used to obtain it from the disparity map. Combined with camera calibration parameters, the 3D coordinates of spatial points are solved using a system of projection equations to obtain accurate depth information.

[0075] A technical problem arises when calculating depth information: excessively small disparity values ​​can amplify depth estimation errors. To address this, a multi-baseline fusion method can be employed. This method obtains image pairs with different baseline lengths by setting up multiple cameras at different locations or moving cameras to different locations for multiple shots. For distant targets, image pairs with longer baselines are used to calculate disparity, improving the relative accuracy of disparity measurement. For near targets, shorter baselines are used to avoid occlusion and matching ambiguity. The depth estimation results from multiple baselines are fused using a weighted method, with weights determined based on the confidence level of disparity measurements and the suitability of the geometric configuration. A depth consistency check is introduced to eliminate outliers with excessively large differences in depth estimation across different baselines, improving the reliability of the depth information.

[0076] S105. Based on the corrected left and right images, the three-dimensional coordinate reconstruction module of the rebar intersection point detects and reconstructs the pixel coordinates of the rebar intersection point.

[0077] The 3D coordinate reconstruction module for rebar intersections detects and reconstructs the pixel coordinates of rebar intersections based on corrected left and right images. Rebar intersections refer to the points where transverse and longitudinal rebars intersect in a rebar mesh; these intersections are key reference points for measuring rebar spacing. This module first preprocesses the corrected image, including image enhancement and noise reduction, to improve the clarity of rebar edges. Then, edge detection and line detection algorithms are used to identify the rebar contours, and the transverse and longitudinal rebars are determined by analyzing their orientation. Rebar intersection detection is achieved by finding the intersection positions of rebars in different directions, using methods such as template matching, feature detection, or deep learning. Pixel coordinate reconstruction refers to accurately locating the two-dimensional coordinates of the detected intersection in the image. Parameters such as the rebar diameter threshold, the confidence threshold for intersection detection, and the error tolerance for line fitting can be adjusted according to the actual rebar specifications and image quality; no limitations are imposed here.

[0078] The specific implementation methods for rebar intersection detection and coordinate reconstruction include: The first method uses a Hough transform-based approach. First, the Canny edge detection algorithm is used to extract image edges, and broken edges are connected through morphological operations (dilation and erosion). The Hough line detection algorithm is applied to identify line segments in the image, classifying them into transverse and longitudinal rebars based on their direction. Intersections of lines in different directions are calculated, and neighboring intersections are merged using a clustering algorithm (such as DBSCAN) to obtain the intersection positions of the rebar mesh. Least squares are used to fit edge points near the intersections to improve the accuracy of intersection location. The second method uses deep learning, employing convolutional neural networks (such as U-Net or Mask R-CNN) for end-to-end rebar intersection detection. The network is trained using a labeled rebar image dataset, and the network output includes a heatmap or bounding box containing intersection positions. Non-maximum suppression is used to remove duplicate detections, and sub-pixel localization techniques (such as Gaussian fitting) are used to accurately determine the pixel coordinates of the intersections. The detection results from both left and right images are combined, and epipolar constraints are used to verify the correspondence of intersections, ensuring consistency in detection.

[0079] S106. Based on depth information and pixel coordinates, the physical spacing calculation module calculates the rebar spacing according to the inverse projection formula.

[0080] Based on depth information and pixel coordinates, the physical spacing calculation module calculates the rebar spacing according to the inverse projection formula, where the inverse projection formula is: ;

[0081] In the above formula, The focal length is the intrinsic parameter of the calibrated binocular camera. The physical distance between the optical centers of the two cameras. The disparity value of the rebar intersection point is calculated based on pixel coordinates. This is depth information.

[0082] The spacing between reinforcing bars is calculated by the difference in the three-dimensional coordinates of adjacent intersection points, and the actual physical distance between the two points is calculated using the Euclidean distance formula. This module also needs to consider coordinate system transformation, converting the measurement results in the camera coordinate system to the world coordinate system or a user-defined reference coordinate system. Parameters such as measurement units (millimeters, centimeters, or meters), coordinate system origin position, and measurement accuracy requirements can be set according to project needs and are not limited here.

[0083] The specific implementation methods for calculating rebar spacing include: The first implementation method uses a direct 3D reconstruction method. For each detected rebar intersection, its pixel coordinates are used. , )and( , The calculated depth value Z is used to calculate the 3D coordinates using the inverse projection formula. The topology of the reinforcing mesh is established, and the connection relationships between adjacent intersections are identified. For horizontally adjacent intersection pairs, the difference in their 3D coordinates is calculated to obtain the horizontal spacing; for vertically adjacent intersection pairs, the difference in their 3D coordinates is calculated to obtain the vertical spacing. The least squares method is used to fit multiple measurements to obtain the average spacing and spacing distribution statistics. The second implementation method uses a plane fitting approach. Assuming the reinforcing mesh is located in the same plane, the RANSAC algorithm is used to perform plane fitting on the 3D coordinates of all intersections. The 3D coordinates are projected onto the fitting plane, and the spacing is calculated in the plane coordinate system to eliminate the influence of depth measurement errors. A mesh model is established, and the intersection positions are adjusted through an optimization algorithm to conform to the constraints of a regular mesh, improving the consistency of spacing measurements. The output includes statistical indicators such as average spacing, maximum and minimum spacing, and spacing standard deviation.

[0084] In the above embodiments, the stereo correction module corrects the images acquired by the binocular camera, reducing errors caused by image distortion and the non-parallelism of the binocular camera's optical axis. The rebar depth information calculation module generates a feature matching constraint matrix using global features, and performs local feature point matching under this constraint, improving the accuracy of feature point matching and reducing mismatches. Based on the accurately matched feature points, the disparity value is calculated and combined with camera calibration parameters to obtain more accurate rebar intersection depth information. The rebar intersection 3D coordinate reconstruction module detects and reconstructs the pixel coordinates of the rebar intersections, and combines them with the obtained depth information to accurately calculate the actual physical spacing of the rebars using the inverse projection formula. The measurement system can simultaneously acquire spacing data from multiple rebar intersections, improving measurement efficiency and the accuracy of rebar spacing measurement.

[0085] In the above embodiments, basic measurement of rebar spacing is achieved by performing stereo correction on images acquired by binocular cameras and combining steps such as feature matching, depth information calculation, and 3D coordinate reconstruction. However, in practical applications, rebar meshes often have additional structures such as connectors, which may interfere with the positioning of rebar intersections, thus affecting measurement accuracy. To solve this problem, this application embodiment also provides an improved rebar spacing measurement method, which is described below in conjunction with... Figure 2 An improved method for measuring rebar spacing is described in the embodiments of this application:

[0086] Please see Figure 2 This is a flowchart illustrating an improved method for measuring rebar spacing in an embodiment of this application.

[0087] S201, The rebar depth information calculation module extracts and corrects the pixel grayscale gradient values ​​in the left and right images, and identifies the areas where the pixel grayscale gradient values ​​are greater than the first preset threshold as candidate areas for connectors;

[0088] The rebar depth information calculation module extracts and corrects pixel grayscale gradient values ​​from the left and right images, and identifies regions with pixel grayscale gradient values ​​greater than a first preset threshold as candidate regions for connectors. Pixel grayscale gradient values ​​reflect the rate of change of grayscale values ​​between adjacent pixels in an image. In rebar mesh images, connectors typically exhibit characteristics of local grayscale abrupt changes. Connectors refer to metal components used to fix or connect rebars, such as binding wires, clips, and welding points. These components often exhibit different grayscale characteristics and texture patterns from the main rebar body in the image. The first preset threshold is a critical value for gradient intensity used to distinguish connectors from the background or the main rebar body. The setting of this threshold needs to consider the overall brightness and contrast of the image, as well as the material characteristics of the connectors. Candidate regions for connectors refer to the set of pixels that meet the gradient threshold conditions. These regions may contain actual connectors or other high-gradient features. Parameters such as the direction of gradient calculation (horizontal, vertical, or all-directional), the type of gradient operator (Sobel, Prewitt, or Scharr), and the specific value of the first preset threshold can be adjusted according to the actual image features and connector type, and are not limited here.

[0089] The specific implementation methods for pixel grayscale gradient value extraction and connector candidate region recognition include: The first method uses the Sobel operator to calculate gradients. A 3×3 horizontal and vertical Sobel kernel is used to convolve the image to obtain the horizontal gradient Gx and the vertical gradient Gy. The gradient magnitude G and gradient direction θ are calculated. Gaussian filtering is applied to the gradient magnitude image to reduce noise, and then binarization is performed using a first preset threshold. Continuous high-gradient pixels are connected into regions through morphological closing operations, and a connected component labeling algorithm is used to identify each independent connector candidate region. The second method employs a multi-scale gradient analysis method. A Gaussian pyramid is constructed to represent the image at multiple scales, and Canny edge detection results are calculated at each scale. The optimal detection scale is determined using scale space theory, at which the edge response of the connector is strongest. An adaptive thresholding method is used to dynamically adjust the first preset threshold based on the local image statistical characteristics, improving the detection capability of connectors under different lighting conditions. Edge tracking and contour extraction algorithms are used to organize edge pixels into closed or semi-closed contours as connector candidate regions.

[0090] S202, The rebar depth information calculation module calculates the pixel connected regions of the candidate areas of the connectors;

[0091] The rebar depth information calculation module calculates the pixel connected components of candidate regions for connectors. A pixel connected component refers to a set of interconnected pixels in a binary image that have the same attribute value (in this case, satisfying the gradient threshold condition) and are spatially adjacent. Connectivity is defined in two ways: 4-connectivity and 8-connectivity. 4-connectivity only considers adjacent pixels in the four directions (up, down, left, and right), while 8-connectivity also includes adjacent pixels in the diagonal direction. The process of calculating pixel connected components involves traversing all candidate region pixels, grouping spatially connected pixels into the same connected component, and assigning a unique label to each connected component. The attributes of a connected component include geometric features such as the number of pixels, bounding box, centroid coordinates, area, and perimeter. These attributes will be used for subsequent connector analysis and selection. Parameters such as the connectivity definition method, minimum connected component area threshold, and connected component shape constraints can be set according to the actual size and shape characteristics of the connector, and are not limited here.

[0092] The specific implementation methods for pixel connected component calculation include: The first method employs a two-pass scanning algorithm. The first pass traverses the image from left to right and top to bottom, checking the scanned neighboring pixels for each foreground pixel. If a labeled pixel exists in the neighborhood, its label is inherited; if multiple different labels exist, the equivalence relation is recorded and the smallest label is selected; if no labeled pixel exists in the neighborhood, a new label is assigned. The second pass updates the labels of all pixels according to the equivalence relation table, ensuring that all pixels within the same connected component have the same label. Statistical characteristics of each connected component are calculated, including the mean and variance of pixel coordinates, minimum bounding rectangle, convex hull, etc. The second method employs a region growing algorithm, selecting the pixel with the highest gradient value as the seed point and expanding it recursively or in a queue. Expansion conditions include the pixel's gradient value exceeding a threshold and the grayscale difference from the seed region being within acceptable limits. A disjoint-set data structure is used to efficiently manage pixel affiliation, supporting dynamic region merging operations. Morphological processing is performed on each grown region, filling internal holes and smoothing boundary contours.

[0093] S203, The rebar depth information calculation module calculates the pixel distance between adjacent candidate areas of connectors;

[0094] The rebar depth information calculation module calculates the pixel distance between adjacent candidate areas of connectors. Specifically, the rebar depth information calculation module establishes a connection relationship graph with the center point of each candidate area of ​​connector as a node; the rebar depth information calculation module calculates the Euclidean distance between adjacent nodes in the connection relationship graph and uses the Euclidean distance as the pixel distance.

[0095] The rebar depth information calculation module calculates the pixel distance between adjacent candidate connector regions. This step first establishes a connectivity graph with the center point of each candidate connector region as a node. The center point is obtained by calculating the average of the coordinates of all pixels within the connected component, representing the geometric center of the candidate connector region. The connectivity graph is a graph-structured data representation where nodes represent candidate connector regions and edges represent the spatial proximity between regions. The definition of adjacency can be determined based on the nearest neighbor principle, distance threshold, or Delaunay triangulation. Pixel distance is calculated using Euclidean distance, which is the straight-line distance between the coordinates of two center points. This distance metric intuitively reflects the spatial distribution of candidate connector regions on the image plane. The methods for determining adjacency, the distance calculation metric, and the connectivity graph construction algorithm can be selected according to specific application requirements and are not limited here.

[0096] The specific implementation methods for calculating the pixel distance between candidate regions of adjacent connectors include: The first implementation uses the k-nearest neighbor (k-NN) method to construct a connection graph. For each candidate region of a connector, the Euclidean distance to the center points of all other regions is calculated, and the k nearest regions are selected as neighbors. A priority queue or heap data structure is used to efficiently maintain the distance sorting, and the value of k can be set according to the typical distribution density of the connectors. After construction, all edges are traversed to calculate and store the pixel distance values. To improve computational efficiency, spatial index structures such as KD-Tree or R-Tree can be used to accelerate the nearest neighbor search. The second implementation uses the Delaunay triangulation method, taking the center points of all candidate regions of connectors as the vertex set, and using incremental insertion or divide-and-conquer algorithms to construct a Delaunay triangulation network. This method automatically determines the natural adjacency relationships in space, avoiding the problem of manually setting the number of neighbors. For each edge in the triangulation network, the Euclidean distance between the corresponding two vertices (center points) is calculated. Further constrained Delaunay triangulation can be used, adding constraints such as the direction of reinforcing bars, to make the connection relationships more consistent with the actual structure.

[0097] S204. When the pixel distance is less than the third preset threshold, the rebar depth information calculation module will merge adjacent connector candidate regions into the same connector candidate region.

[0098] When the pixel distance is less than a third preset threshold, the rebar depth information calculation module merges adjacent connector candidate regions into a single connector candidate region. The third preset threshold is the distance standard for determining whether two connector candidate regions belong to the same actual connector. The setting of this threshold needs to consider the typical size of the connector, image resolution, and possible segmentation errors. The merging operation combines multiple candidate regions that meet the distance condition into a larger region, which helps to recover complete connectors that were incorrectly segmented during gradient extraction and connected component calculation. The merging process needs to update all attributes of the region, including pixel set, boundaries, and center point coordinates. The specific value of the third preset threshold, the priority rules during merging, and whether to consider other auxiliary judgment conditions can be flexibly set according to the connector type and detection requirements; no limitations are imposed here.

[0099] The specific implementation methods for merging candidate regions for connectors include: The first method employs an iterative merging algorithm based on a disjoint-set data structure (union-find). Initially, each candidate region forms a set. All edges in the connectivity graph are traversed, and for edges with pixel distances less than a third preset threshold, the disjoint-set data structure is used to merge the corresponding two regions into the same set. A rank-based merging strategy is used during merging, merging smaller sets into larger sets to maintain the balance of the tree structure. After all merges are completed, the attributes of the merged regions are recalculated for each set, including the pixel union of all member regions, the new center point coordinates, and the updated bounding boxes. The second method uses a graph clustering approach, constructing a weighted connectivity graph where the edge weights are the reciprocal of the pixel distance or the Gaussian function transformation value. Spectral clustering or modularity optimization algorithms are used to perform community detection on the graph, automatically identifying regions that should be merged. A distance threshold is set as a hard constraint to ensure that only regions with distances less than the third preset threshold can be clustered into the same community. A merging operation is performed on all candidate regions within each community to generate new merged candidate regions.

[0100] S205, The rebar depth information calculation module recalculates the pixel connected domains of the merged candidate regions of the connectors.

[0101] The rebar depth information calculation module recalculates the pixel connected components of the merged candidate connector regions. After the region merging is completed in step S204, the original connected component information is invalid, and connected component analysis needs to be performed again to obtain accurate region attributes. The recalculation process includes performing a union operation on the pixel sets of all merged regions to form a new binary image representation. A connected component labeling algorithm is applied to the merged pixel set to ensure that all pixels belonging to the same merged region receive the same label. This step not only updates the basic information of the connected components but also discovers new connected structures that may be generated during the merging process. The recalculated connected component attributes will be used for subsequent connector localization and interference judgment. The choice of connected component recalculation algorithm, whether to perform morphological post-processing, and the completeness of attribute updates can be weighed according to processing efficiency and accuracy requirements, and are not limited here.

[0102] The specific implementation methods for recalculating connected components after merging include: The first method employs a fast update method based on label mapping, establishing a mapping table from the original connected component labels to the merged labels. It iterates through the original labeled image, directly updating the label value of each pixel according to the mapping table, avoiding repeated connected component searches. Boundary tracking is performed on the updated labeled image to verify connectivity and extract precise contour information. The complete attribute set of the new connected components is calculated, including shape features such as area, perimeter, rectangularity, and circularity. An incremental calculation method is used, based on the attributes of the original connected components, to obtain the estimated value of the merged attributes through weighted summation. The second method employs a complete reconstruction method, collecting the pixel coordinates of all merged regions into a list and creating the smallest bounding rectangle containing these pixels. Connectivity analysis is performed within this local region, using seed filling or scanline algorithms to label all connected pixels. Freeman chain code or contour tracking algorithms are used to extract precise boundary representations to support subsequent shape analysis. Principal component analysis (PCA) is used to calculate the principal axis direction and aspect ratio of the connected components, providing a basis for the orientation estimation of the connectors.

[0103] S206. Use the coordinates of the center point of the connected component of each pixel as the position coordinates of the connector.

[0104] The center point coordinates of each pixel's connected component are used as the position coordinates of the connector. The center point coordinates can be calculated using methods such as geometric center (centroid) or weighted center. The geometric center is obtained by calculating the arithmetic mean of all pixel coordinates within the connected component, with the formula (x_c, y_c) = (Σx_i / N, Σy_i / N), where N is the total number of pixels in the connected component. This method is simple and intuitive, suitable for connectors with regular shapes. For connectors with irregular shapes or density variations, a weighted center calculation method can be used, with weights based on pixel grayscale values, gradient strength, and other features. The accuracy of the position coordinates directly affects subsequent interference detection and distance calculation; therefore, it is necessary to ensure the accuracy of the calculation. The choice of center point calculation method, whether to perform sub-pixel accuracy optimization, and the definition of the coordinate system can be determined according to specific needs and are not limited here.

[0105] The median of the x and y coordinates of all pixels within the connected component can be calculated separately and used as the center point coordinates. This method has better robustness to anomalous shapes and is less affected by local protrusions. Combined with shape analysis, a skeletonization algorithm is used to extract the center line for linear connectors, and the midpoint of the center line is taken as the position coordinates. For ring-shaped connectors, the center position is determined using Hough circle detection.

[0106] S207. When the pixel distance between the determined position coordinates and the intersection point of the rebar is less than the second preset threshold, the rebar depth information calculation module marks the connector as an interfering connector.

[0107] The rebar depth information calculation module marks a connector as an interfering connector when the pixel distance between its location coordinates and the rebar intersection point is less than a second preset threshold. An interfering connector is one whose location is too close to the rebar intersection point, potentially affecting the accurate positioning of the intersection point. The second preset threshold defines a safe distance between the connector and the rebar intersection point; when the actual distance is less than this threshold, the connector may obscure the intersection point or alter image features near the intersection point. The pixel distance is calculated using the Euclidean distance between the connector's center point coordinates and the coordinates of the nearest rebar intersection point. The marking process requires traversing all combinations of connectors and rebar intersection points to establish an interference relationship mapping. Objects marked as interfering connectors will undergo special processing in subsequent steps to eliminate their impact on the rebar intersection point positioning. The setting of the second preset threshold needs to consider the typical size of the connector, the rebar diameter, and measurement accuracy requirements. Whether the actual contour range of the connector is considered during distance calculation can be adjusted according to the application scenario and is not limited here.

[0108] The specific implementation methods for marking interfering connectors include: The first method employs a fast query method based on spatial indexing, constructing an R-Tree spatial index structure for rebar intersections to support efficient range queries. For the position coordinates of each connector, a second preset threshold is used as the query radius to search for all rebar intersections within the range in the R-Tree. Precise pixel distances are calculated to confirm whether they are less than the threshold. An interference mapping table is established, recording the list of rebar intersections affected by each interfering connector, and the list of interfering connectors affecting each rebar intersection. Bit markers or attribute fields are used to record the interference status of the connectors. The second method employs a distance transformation-based method, generating a distance transformation map for the rebar intersection positions, where each pixel value represents the distance to the nearest intersection. The distance value is queried at the connector's position coordinates to directly determine whether it is less than the second preset threshold. Considering the actual range of the connector, not only the center point but also the sampling points on the connector's outline are checked to ensure the entire connector is outside the safe distance. Morphological dilation operations are used to expand the influence range of the rebar intersections, generating conservative interference judgment results.

[0109] S208, the rebar depth information calculation module determines the edge contour for each interfering connector;

[0110] The rebar depth information calculation module determines the edge contour for each interfering connector. Specifically, this includes: acquiring a grayscale gradient map of a preset pixel range around the interfering connector; binarizing the grayscale gradient map to obtain a binarized image; and performing connected component analysis on the binarized image to determine the set of connected pixels as the edge contour. This step first acquires a grayscale gradient map of a preset pixel range around the interfering connector. The preset pixel range defines the region of interest for contour extraction, typically set as the outermost rectangle of the connector extending outwards by a certain number of pixels. The grayscale gradient map is calculated using a gradient operator, reflecting the local edge strength information of the image. Binarizing the grayscale gradient map sets pixels with gradient values ​​higher than a threshold as foreground and the rest as background, resulting in a binarized image. The binarization threshold can be determined using a globally fixed threshold, an Otsu adaptive threshold, or a locally adaptive threshold. Connected component analysis is performed on the binarized image, organizing spatially continuous foreground pixels into connected components, each corresponding to a potential edge contour. Edge contours belonging to the interfering connector are then selected through shape and position constraints. The size of the preset pixel range, the selection of the gradient operator, the binarization method, the contour filtering conditions, and other parameters can be flexibly set according to the characteristics of the connector, and are not limited here.

[0111] Specific implementation methods for determining the edge contour of the interference connector include: The first method uses Canny edge detection combined with contour tracking. Within a preset range, the Canny algorithm is applied, using a double-threshold strategy and non-maximum suppression to obtain refined edges. Strong and weak edges are connected through hysteresis thresholding to form a complete edge chain. Contour tracking algorithms (such as Moore's neighborhood tracking) are used to organize edge pixels into an ordered sequence of contour points. The Douglas-Peucker algorithm is applied to simplify the contour, removing redundant points while maintaining the contour shape. The integrity and accuracy of the contour are verified by calculating the contour signature (such as a distance function to the center). The second method uses the active contour model (Snake) method, initializing the contour as the circumscribed ellipse or convex hull of the connector. An energy function is defined, including internal energy (controlling contour smoothness), external energy (attracting the contour to the image edge), and constraint energy (maintaining the contour shape). The contour position is iteratively optimized using gradient descent or dynamic programming methods to minimize the total energy. GVF (Gradient Vector Flow) is used to improve the external energy field, enhancing the ability to capture concave edges. A convergence condition is set, stopping iteration when the contour change is less than a threshold.

[0112] S209, The rebar depth information calculation module recalculates the pixel coordinates of the rebar intersections based on the edge contour to obtain the corrected pixel coordinates;

[0113] The rebar depth information calculation module recalculates the pixel coordinates of rebar intersections based on the edge contour, obtaining corrected pixel coordinates. Since the presence of interfering connectors may cause the originally detected rebar intersection positions to shift, it is necessary to correct the intersection positions using the precise contour information of the connectors. The correction process includes analyzing the intersection relationship between the connector contour and the rebar, identifying rebar segments obscured or affected by the connectors. By extending and interpolating the rebar direction, the true path of the rebar within the connector area is estimated. Based on the corrected rebar path, the intersection positions of the transverse and longitudinal rebars are recalculated. The corrected pixel coordinates more accurately reflect the actual position of the rebar intersections compared to the original coordinates, eliminating positioning errors caused by connector interference. The selection of the correction algorithm, the rebar path fitting method, and the accuracy requirements for intersection calculation can be flexibly adjusted according to specific applications and are not limited here.

[0114] The specific implementation methods for rebar intersection pixel coordinate correction include: The first method uses a line fitting approach. Feature points are extracted from visible rebar segments outside the connector outline, and the RANSAC algorithm is used to fit the straight line equation of the rebar. The straight line equation is extended to the connector area to predict the direction of the occluded rebar. Line fitting is performed separately for transverse and longitudinal rebars, and the intersection of the extended lines is calculated as the corrected rebar intersection. Considering the possible bending of the rebar, quadratic curves or spline curves are used for fitting to improve the accuracy of path prediction. Confidence intervals for intersection positions are calculated through multiple sampling and fitting. The second method uses a template matching approach. A template library containing connector and rebar intersections is established, with templates generated from historical data or simulations. Template matching is performed around interfering connectors to find the most similar template configuration. The actual intersection position is inferred based on the intersection position in the template and the alignment parameters of the current image. Deformable template matching technology is used, allowing the template to deform appropriately to adapt to the actual situation. The matching results of multiple templates are fused through Bayesian inference to obtain the most probable intersection position.

[0115] S210. Based on depth information and corrected pixel coordinates, the physical spacing calculation module calculates the corrected rebar spacing according to the inverse projection formula.

[0116] Based on depth information and corrected pixel coordinates, the physical spacing calculation module calculates the corrected rebar spacing using the inverse projection formula. The corrected rebar spacing refers to the actual physical spacing of the rebars calculated after interference from connectors has been eliminated, offering higher accuracy compared to uncorrected measurements. The inverse projection formula converts two-dimensional image coordinates and depth information into three-dimensional spatial coordinates. The basic principle is the same as in step S106, but corrected pixel coordinates are used. The depth information can use previously calculated results or be recalculated based on corrected feature points to improve consistency. The calculation of physical spacing needs to consider the spatial relationship between the intersections of adjacent rebars, obtaining the actual distance through the difference in three-dimensional coordinates. The output of the corrected rebar spacing can include various forms such as individual spacing values, statistical characteristics (mean, standard deviation), and spacing distribution maps. The accuracy evaluation method for spacing calculation, the format of the results, and whether outlier detection is performed can be determined according to engineering requirements and are not limited here.

[0117] In the above embodiments, by analyzing pixel grayscale gradient values ​​to identify candidate regions for connectors and calculating pixel connected components to determine the position coordinates of connectors, interfering connectors affecting the positioning of rebar intersections can be detected. For marked interfering connectors, by determining their edge contours and recalculating the pixel coordinates of the rebar intersections, the interference of connectors on the positioning of rebar intersections is eliminated. After this correction process, the pixel coordinates of the rebar intersections are more accurate, and the rebar spacing calculated by combining depth information and the inverse projection formula is closer to the actual value, solving the measurement error problem caused by rebar connectors on site and improving the accuracy of rebar spacing measurement.

[0118] The measurement system in the embodiments of this invention is described below from the perspective of hardware processing. Please refer to [link / reference needed]. Figure 3 This is a schematic diagram of the physical device structure of a rebar spacing measurement system based on multi-view vision provided in an embodiment of this application.

[0119] It should be noted that, Figure 3 The structure of the measurement system shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0120] like Figure 3 As shown, the measurement system includes a Central Processing Unit (CPU) 301, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on a program stored in Read-Only Memory (ROM) 302 or a program loaded from storage section 308 into Random Access Memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the measurement system. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An Input / Output (I / O) interface 305 is also connected to the bus 304.

[0121] The following components are connected to I / O interface 305: input section 306 including a camera, infrared sensor, etc.; output section 307 including a liquid crystal display (LCD) and speakers, etc.; storage section 308 including a hard disk, etc.; and communication section 309 including a network interface card such as a LAN (Local Area Network) card and a modem, etc. Communication section 309 performs communication processing via a network such as the Internet. Drive 310 is also connected to I / O interface 305 as needed. Removable media 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 310 as needed so that computer programs read from them can be installed into storage section 308 as needed.

[0122] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the various functions defined in the present invention.

[0123] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor measurement system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. The transmitted data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof.

[0124] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of measurement systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based measurement system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0125] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the measurement system described in the above embodiments; or it may exist independently and not assembled into the measurement system. The storage medium carries one or more computer programs that, when executed by a processor of a measurement system, cause the measurement system to implement the methods provided in the above embodiments.

[0126] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application 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 scope of the technical solutions of the embodiments of this application.

[0127] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".

[0128] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.

[0129] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for measuring rebar spacing based on multi-view vision, applied to a measurement system, characterized in that, The measurement system includes a 3D correction module, a rebar depth information calculation module, a rebar intersection 3D coordinate reconstruction module, and a physical spacing calculation module. The method includes: Based on the remapping parameters calculated from the intrinsic and extrinsic parameters of the binocular camera, the stereo correction module performs stereo correction on the left and right images acquired by the binocular camera to obtain corrected left and right images. Based on the global features of the corrected left and right images, the rebar depth information calculation module calculates the similarity between the global features to obtain a feature matching constraint matrix; Based on the local feature points of the corrected left and right images, the rebar depth information calculation module uses the feature matching constraint matrix as a constraint condition to match the local feature points and obtain matching feature point pairs. Based on the matching feature points, the rebar depth information calculation module calculates the disparity value, and calculates the depth information of the rebar intersections according to the disparity value and preset camera calibration parameters; Based on the corrected left and right images, the three-dimensional coordinate reconstruction module of the rebar intersection point detects and reconstructs the pixel coordinates of the rebar intersection point; Based on the depth information and the pixel coordinates, the physical spacing calculation module calculates the rebar spacing according to the inverse projection formula.

2. The method according to claim 1, characterized in that, The remapping parameters are calculated based on the intrinsic and extrinsic parameter matrices of the binocular camera. The stereo correction module performs stereo correction on the left and right images acquired by the binocular camera to obtain corrected left and right images, specifically including: The stereo calibration module performs camera calibration on the binocular camera based on the chessboard method, and obtains the intrinsic parameter matrix and extrinsic parameter matrix of the binocular camera; The stereo correction module decomposes the intrinsic parameter matrix and the extrinsic parameter matrix to obtain a rotation matrix, and calculates the projection matrix based on the rotation matrix to make the optical axis of the binocular camera parallel and the epipolar lines aligned in the horizontal direction. The stereo correction module constructs the coplanar image plane of the binocular camera based on the projection matrix and calculates the remapping parameters; The stereo correction module uses the remapping parameters to remap the left and right images to obtain corrected left and right images.

3. The method according to claim 1, characterized in that, The inverse projection formula is: ; In the above formula, the The focal length, an intrinsic parameter of the corrected binocular camera, is... The physical distance between the optical centers of the two cameras, the The disparity value of the rebar intersection point calculated based on the pixel coordinates, the This refers to the depth information.

4. The method according to claim 1, characterized in that, After the physical spacing calculation module calculates the rebar spacing according to the inverse projection formula, the method further includes: The rebar depth information calculation module extracts the pixel grayscale gradient values ​​in the corrected left and right images, and identifies the regions where the pixel grayscale gradient values ​​are greater than a first preset threshold as candidate regions for connectors. The rebar depth information calculation module calculates the pixel connected domains of the candidate region of the connector, and uses the center point coordinates of each pixel connected domain as the position coordinates of the connector. When the rebar depth information calculation module determines that the pixel distance between the location coordinates and the intersection point of the rebar is less than a second preset threshold, the connector is marked as an interfering connector. The rebar depth information calculation module determines the edge contour for each of the interfering connectors; The rebar depth information calculation module recalculates the pixel coordinates of the rebar intersection points based on the edge contour to obtain the corrected pixel coordinates. Based on the depth information and the corrected pixel coordinates, the physical spacing calculation module calculates the corrected rebar spacing according to the inverse projection formula.

5. The method according to claim 4, characterized in that, The rebar depth information calculation module determines the edge contour for each of the interfering connectors, specifically including: The rebar depth information calculation module obtains a grayscale gradient map of a preset pixel range around the interference connector; The rebar depth information calculation module performs binarization processing on the grayscale gradient map to obtain a binarized image; The rebar depth information calculation module performs connected component analysis on the binarized image and determines the set of connected pixels as the edge contour.

6. The method according to claim 4, characterized in that, After the rebar depth information calculation module calculates the pixel connected components of the candidate region of the connector, the method further includes: The rebar depth information calculation module calculates the pixel distance between adjacent candidate regions of the connector; When the pixel distance is less than the third preset threshold, the rebar depth information calculation module will merge adjacent connector candidate regions into the same connector candidate region. The rebar depth information calculation module recalculates the pixel connected domains of the merged candidate regions for connectors.

7. The method according to claim 6, characterized in that, The rebar depth information calculation module calculates the pixel distance between adjacent candidate regions of the connector, specifically including: The rebar depth information calculation module establishes a connection relationship diagram with the center point of each candidate area of ​​the connector as the node. The rebar depth information calculation module calculates the Euclidean distance between adjacent nodes in the connection relationship graph and uses the Euclidean distance as the pixel distance.

8. A rebar spacing measurement system based on multi-view vision, characterized in that, The measurement system includes: A memory and one or more processors; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the measurement system to perform the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on the measurement system, the measurement system performs the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, When the computer program product is run on the measurement system, it causes the measurement system to perform the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method and system for measuring distance between steel bars based on binocular vision

    CN115682970A

  • Intelligent identification distance measuring and calculating method and device based on binocular camera

    CN116379936A