A method for measuring and detecting a rectangular cross-section conduit or wire.
By acquiring multi-angle images through a multi-view vision system and optimizing the axis vector and normal vector, a three-dimensional model of a rectangular cross-section duct is reconstructed. This solves the problems of complex detection process and missing information in existing technologies, and achieves efficient and accurate detection results.
Patent Information
- Application Number
- CN202511179288.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-08-22
AI Technical Summary
Existing technologies for detecting rectangular cross-section conduits suffer from several drawbacks. Complex structural images are prone to information loss or confusion, leading to distorted 3D reconstruction. Furthermore, the detection process is highly complex and difficult to adapt to the rapid detection needs of industrial sites.
A multi-view vision system is used to acquire images from multiple angles. By optimizing the axis vectors and normal vectors and combining the reconstruction of the end, twist angle and circular hole, a complete 3D model is output, reducing the need for surface pretreatment and enhancing the resistance to environmental interference.
It achieves high-precision and rapid detection of rectangular cross-section conduits, reduces the complexity of the detection process, improves the consistency and accuracy of system measurements, and adapts to the rapid detection needs of industrial sites.
Smart Images

Figure CN120672971B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of optical measurement technology, and specifically relates to a method for measuring and detecting a rectangular cross-section conduit or wire. Background Technology
[0002] Rectangular cross-section conduits, with their advantages of lightweight design, high torsional stiffness, and strong process adaptability, are increasingly widely used in high-end manufacturing fields such as new energy vehicles, aerospace, and shipbuilding. In the new energy vehicle sector, they can be used to construct cage-like protective structures for battery packs, improving collision safety. In the aerospace sector, seamless extrusion-formed rectangular conduits can significantly extend fatigue life. In the shipbuilding sector, aluminum alloy rectangular tubes can achieve a weight reduction of over 30% for the hull, improving navigation efficiency. The structural precision of these conduits directly affects the safety and reliability of equipment; therefore, efficient and accurate detection of their geometric dimensions and characteristic defects has become a crucial aspect of industrial manufacturing.
[0003] Existing inspection technologies for rectangular cross-section conduits mainly fall into four categories: First, manual inspection, which involves measuring dimensions with general measuring tools and visually judging defects. This is suitable for simple scenarios such as on-site repairs, but it relies heavily on operator skills, resulting in extremely low efficiency and making it difficult to adapt to mass production. Second, fixture inspection, which uses physical limits to quickly determine the conformity of the conduit type. This is suitable for large-scale production, but the accuracy of the fixture depends on processing costs, and it can only qualitatively judge deviations, not quantify data, and it is not compatible with conduits of multiple specifications. Third, sensor inspection, which can measure local features, but its technological maturity is insufficient, and it cannot complete the three-dimensional reconstruction of the entire conduit, making it difficult to meet the needs of automated production. Fourth, point cloud inspection using general vision systems, which reconstructs the conduit type through non-contact acquisition of three-dimensional point clouds. This covers a wide range of scenarios, but it has blind spots, and high-precision measurement requires spraying matte paint on the surface of the rectangular cross-section conduit and arranging feature markers, significantly extending the measurement cycle, especially for long conduits or complex structures where adaptability is poor.
[0004] Despite the varying focuses of existing technologies, significant bottlenecks remain in the comprehensive, efficient, and high-precision detection of rectangular cross-section conduits. On one hand, image acquisition of complex structures is prone to information loss or confusion, leading to distorted 3D reconstruction. On the other hand, surface preprocessing requirements increase the complexity of the detection process, making it difficult to adapt to the rapid detection needs of industrial environments. Furthermore, existing technologies are weakly resistant to interference from ambient light and vibration, exhibiting insufficient stability. Therefore, developing comprehensive, high-precision, and high-efficiency measurement and detection methods for rectangular cross-section conduits has become an urgent technical challenge. Summary of the Invention
[0005] The purpose of this invention is to overcome the defects in the prior art and provide a method for measuring and detecting rectangular cross-section conduits or wires.
[0006] This invention provides a method for measuring and detecting rectangular cross-section conduits or wires, comprising the following steps:
[0007] (1) Acquire multi-angle images of the rectangular cross-section duct under test using a multi-view vision system;
[0008] (2) Based on the multi-angle images, solve for the initial values of the axis vectors of the spatial rectangular body representing the tube body of the rectangular cross-section. ;
[0009] (3) Based on the initial value of the axis vector Solve for the initial value of the normal vector of the spatial rectangle. ;
[0010] (4) Optimize the initial values of the axis vectors of the spatial rectangle. , thus obtaining the optimized axis vector ;
[0011] (5) Based on optimized axis vector Determine the normal vector of the optimized spatial rectangle. ;
[0012] (6) A special structure of a rectangular cross-section conduit reconstructed from a modeled tube body, the special structure including an end, a torsion angle and a circular hole;
[0013] (7) Integrate the measurement data of the tube body and special structures, and output a complete three-dimensional model of the tube with a rectangular cross section to complete the inspection.
[0014] A further solution is that, in step (1), the multi-view vision system needs to be calibrated before acquiring images. After calibration, the rectangular cross-section conduit to be measured is placed in the measurement area, and the calibrated multi-view vision system is used to photograph the rectangular cross-section conduit to obtain images of the rectangular cross-section conduit from all camera perspectives. The calibration process of the multi-view vision system is as follows:
[0015] Using a calibration board with regularly arranged circular coded and non-coded markers, the calibration board was photographed under different poses of a multi-view vision system.
[0016] Solving the intrinsic parameter matrix of each camera based on the principle of close-range photogrammetry and extrinsic parameter rotation matrix A measurement coordinate system is established at the center of the calibration plate;
[0017] In this measurement coordinate system, the Z-axis is perpendicular to the measurement plane and points towards the top camera, the X and Y axes are perpendicular to each other and located within the measurement plane, and the origin of the coordinate system is located at the geometric center of the measurement plane.
[0018] A further solution is that solving for the axis vector in step (2) includes:
[0019] Denoising and grayscale thresholding are performed on the camera images to obtain the boundary straight line of the rectangular cross-section duct;
[0020] Connect the camera's optical center with the boundary line to form a boundary plane;
[0021] By applying the principle of small-angle approximation, image points that are equidistant from the straight lines to the two side boundaries in the image are identified, forming an undetermined axis.
[0022] Connect the camera's optical center with the axis to be determined to form the plane of the axis to be determined. Solve for the intersection of two adjacent planes of the axis to be determined by the proposed axis.
[0023] The initial values of the axis vectors are obtained by averaging the proposed axes of all adjacent cameras. .
[0024] A further solution is to solve for the initial value of the normal vector in step (3). include:
[0025] With the initial value of the axis vector and unit normal vector The four edges of a spatial rectangle;
[0026] Points on the straight line connecting the boundary of the rectangular cross-section conduit and the optical center of the camera form sampling rays;
[0027] Calculate the skew line distance vector between the sampling ray and the axis of the spatial rectangle. And the skew line distance vector between the sampling ray and the edge of the spatial rectangle ;
[0028] Determine the same-direction distance vectors by the cosine of the included angle, and then filter for the minimum distance value;
[0029] The objective function is the sum of the minimum distances from all sampled rays to the edge, with a fixed step size. Rotation normal vector:
[0030] ;
[0031] Traversal The optimal initial value of the normal vector is obtained in the range [0°, 360°). .
[0032] A further solution is that, in step (4), the initial value of the axis vector... The optimization process is as follows:
[0033] Based on the initial value of the axis vector Initial value of the normal vector Calculate the four vertices of the end face of the spatial rectangle and the two intersection points of the axes;
[0034] Project the vertices and intersections onto the camera image to obtain the projection points of the vertices and intersections.
[0035] Calculate the length of the perpendicular line from each projection point to the axis projection line;
[0036] Filter the longest and second longest perpendicular lines and calculate the scaling factor;
[0037] Correct the axis points based on the coordinates of the image boundary points and the scaling factor;
[0038] The optimized axis vector is obtained by fitting the corrected axis points. .
[0039] A further solution is that, in step (5), the normal vector is determined. The process is as follows:
[0040] Based on optimized axis vector Repeat the process of solving for the initial value of the normal vector as described in claim 4. The steps are as follows, and the final normal vector is output. .
[0041] A further solution is that rebuilding the end in step (6) includes:
[0042] Pipeline data is obtained by spreading along the pipe body direction using spatial rectangular prisms as reconstruction units.
[0043] Near the end, select the light rays that pass through the central axis of the rectangular cross-section and have two intersections with the cross-section, and solve for the intersection points of the light rays with the rectangular body;
[0044] Based on the scaling factor and geometric length of the intersection point and the central axis point, the position of the axis point near the end face in the camera image is determined, and the coordinates of the axis point of the end face are obtained by 3D reconstruction.
[0045] A further embodiment is that step (6), reconstructing the torsion angle, includes:
[0046] The standard point cloud of the torsion angle is obtained by analyzing the digital model of the rectangular cross-section duct, and the standard point cloud is transformed from the digital model coordinate system to the measurement coordinate system.
[0047] Select a camera, project the standard point cloud onto the two-dimensional image coordinate system, and iteratively adjust the position of the standard point cloud with the gradient of the projected area as the objective function.
[0048] Determine the matrix transformation relationship from the digital model coordinate system to the measurement coordinate system to complete the three-dimensional reconstruction of the torsion angle.
[0049] A further embodiment is that step (6) of reconstructing the circular hole includes:
[0050] Transform the circular hole from the digital model coordinate system to the measurement coordinate system;
[0051] Based on the spatial rectangular body normal vector of the tube near the circular hole, a constraint plane passing through the center of the circular annulus at the center of the circular hole is established;
[0052] For camera images that meet the requirements, establish the objective function relationship between the image and the central ring of the circular hole in the measurement coordinate system. Combine the constraint plane to solve the center coordinates of the central ring of the circular hole and complete the reconstruction.
[0053] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0054] This invention acquires multi-angle images through a multi-view vision system, combines the solution and optimization of axis vectors and normal vectors to achieve pipe body modeling, and integrates measurement data of special structures such as ends, torsion angles, and circular holes to output a complete 3D model. It can solve the problem of information loss or confusion in the acquisition of complex structure images in the prior art, which leads to 3D reconstruction distortion. It eliminates the need for preprocessing such as applying matte paint or placing feature markers on the surface of rectangular cross-section conduits, reducing the complexity of the inspection process and adapting to the rapid inspection needs of industrial sites.
[0055] The multi-view vision system of this invention is calibrated using a calibration plate with regularly arranged circular coded markers and non-coded markers. Based on the principle of close-range photogrammetry, it solves the camera's intrinsic and extrinsic parameters and establishes a clear measurement coordinate system. This provides accurate coordinate references and parameter foundations for subsequent multi-angle image acquisition and 3D reconstruction, improving the consistency and accuracy of the system's measurements.
[0056] This invention denoises camera images, extracts boundary lines, and combines the spatial geometric relationships of a multi-view vision system. Through solving for the boundary plane, the undetermined axis, and the proposed axis, and averaging the results, initial values of the axis vectors are obtained. Multi-view data fusion is used to reduce single-view errors, providing a reliable initial basis for subsequent calculations. Based on the initial axis vector values, the optimal initial normal vector value is determined by calculating the distance between the sampled light rays and the skew lines of the edges and axes, combined with angle traversal search, accurately capturing the normal features of the spatial rectangular body. The initial axis vector values are optimized through analysis of the perpendicular length of the projection point and scaling factor correction, making them more closely resemble the actual shape of the rectangular cross-section conduit. Based on the optimized axis vector, the normal vector is re-solved, further improving its accuracy. Finally, through the synergistic optimization of the axis vector and normal vector, the accuracy of the spatial rectangular body's representation of the rectangular cross-section conduit body is significantly improved, laying a solid foundation for subsequent reconstruction of special structures. This effectively solves the problem of 3D reconstruction distortion caused by missing or confused image acquisition information of complex structures, reduces surface preprocessing requirements, and enhances resistance to environmental interference. Attached Figure Description
[0057] The following figures are for illustrative purposes only and are not intended to limit the scope of the invention, wherein:
[0058] Figure 1 Overall flowchart of the measurement and testing method for rectangular cross-section conduits;
[0059] Figure 2 Solve for the schematic diagram of the proposed axis;
[0060] Figure 3 : Schematic diagram for determining the direction of distance between skew lines;
[0061] Figure 4 Schematic diagram of the vertex projection and axis correction of the end face of a spatial rectangle;
[0062] Figure 5 Schematic diagram of the cross section and intersection point in the reconstruction of the end of a rectangular cross section conduit;
[0063] Figure 6 Schematic diagram of measuring the torsion angle of a rectangular cross-section duct and using camera projection;
[0064] Figure 7 Schematic diagram of the measurement of the central annulus of the circular hole and the camera's ray. Detailed Implementation
[0065] To make the objectives, technical solutions, design methods, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention.
[0066] This invention provides a method for measuring and detecting rectangular cross-section conduits or wires, comprising the following steps:
[0067] (1) Acquire multi-angle images of the rectangular cross-section duct to be tested through a multi-view vision system. The multi-view vision system consists of at least two industrial cameras, which are fixed around the duct to be tested by a bracket to form a multi-view observation network.
[0068] (2) Based on the multi-angle images, solve for the initial values of the axis vectors of the spatial rectangular body representing the tube body of the rectangular cross-section. ;
[0069] (3) Based on the initial value of the axis vector Solve for the initial value of the normal vector of the spatial rectangle. ;
[0070] (4) Optimize the initial values of the axis vectors of the spatial rectangle. , thus obtaining the optimized axis vector ;
[0071] (5) Based on optimized axis vector Determine the normal vector of the optimized spatial rectangle. ;
[0072] (6) A special structure of a rectangular cross-section conduit reconstructed from a modeled tube body, the special structure including an end, a torsion angle and a circular hole;
[0073] (7) Integrate the measurement data of the tube body and special structures, and output a complete three-dimensional model of the tube with a rectangular cross section to complete the inspection.
[0074] In step (1), the multi-view vision system needs to be calibrated before acquiring images. After calibration, the rectangular cross-section conduit to be measured is placed in the measurement area, and the calibrated multi-view vision system is used to photograph the rectangular cross-section conduit to obtain images of the rectangular cross-section conduit from all camera perspectives. The calibration process of the multi-view vision system is as follows: a calibration board with regularly arranged circular coded markers and non-coded markers is used to photograph the calibration board under different poses of the multi-view vision system; the intrinsic parameter matrix of each camera is solved based on the principle of close-range photogrammetry. and extrinsic parameter rotation matrix A measurement coordinate system is established at the center of the calibration plate; wherein the Z-axis of the measurement coordinate system is perpendicular to the measurement plane and points to the top camera, the X and Y axes are perpendicular to each other and located in the measurement plane, and the origin of the coordinate system is located at the geometric center of the measurement plane.
[0075] In step (2), the initial values of the axis vectors representing the spatial rectangular body of the duct with a rectangular cross-section are solved. The method is based on the geometric features of the approximately rectangular cross-section of the conduit. Using two-dimensional camera images as a reference, it is derived through image data and spatial geometric relationships from a multi-view vision system. The specific steps are as follows:
[0076] Preprocessing is performed on the rectangular cross-section duct camera images acquired by the multi-view vision system, including environmental denoising and grayscale threshold extraction, so as to accurately identify and confirm the boundary lines of the rectangular cross-section duct images, that is, the edge contour lines of the rectangular cross-section duct in the two-dimensional image;
[0077] Connecting the optical center of each camera to the boundary line of the rectangular cross-section duct in the 2D image forms a set of spatial planes, defined as boundary planes. Each boundary plane contains the lines connecting all image points on the corresponding boundary line to the camera's optical center, reflecting the projection relationship of the rectangular cross-section duct's edge in 3D space.
[0078] Based on the symmetry of the rectangular cross-section of the duct, the small-angle approximation principle is applied to solve for all image points equidistant from the upper and lower boundary lines in the two-dimensional image. The line formed by these image points is the undetermined axis (the theoretical projection of the axis of the rectangular cross-section duct in the two-dimensional image).
[0079] Connect the undetermined axis in the 2D image to the optical center of the corresponding camera to form the undetermined axis plane (a spatial plane containing the undetermined axis and the camera's optical center). For each pair of cameras in a multi-view system, solve for the intersecting line of their undetermined axis planes; this intersection line is the proposed axis (a candidate value for the 3D axis from the perspective of a single set of cameras).
[0080] The proposed axes obtained from solving all camera combinations in the multi-view vision system are averaged to eliminate the error interference from individual cameras. The final set of axis data is the initial value of the axis vector of the spatial rectangle. .like Figure 2 As shown, the schematic diagram for solving the axis includes: Two-dimensional images representing two adjacent cameras. This represents the optical center of the corresponding two cameras. The plane representing the undetermined axes of the two cameras obtained from the solution; This represents a proposed axis obtained from the solution.
[0081] In step (3), the initial value of the normal vector of the spatial rectangle is solved. The process is as follows:
[0082] Using known initial values of the axis vectors The normal vector to be found Let the four edges of a spatial rectangle be parallel to the axis direction. Then:
[0083] ;
[0084] in, Indicates from the 1st to the 1st The direction vector of the edge line, ; Represents a point on a known axis; Let these represent the axis vector, normal vector, and line vector of the spatial rectangle, respectively. ; These represent the height and width of the spatial rectangle, respectively. Let represent the length vectors of four parallel edges of equal length in the measurement coordinate system, and , are known quantities;
[0085] The normal vector is perpendicular to the axis vector, and is perpendicular to the axis. Starting from the perpendicular relationship, the normal vector can be solved. This method yields several normal vectors, meaning their directions rotate around the axis vector within the height section of the spatial rectangle and cannot be fixed. First, assuming the normal vector is perpendicular to the axis vector, and the starting point of the normal vector is a point on the axis vector, solve for a set of unit normal vectors. The unit normal vector This represents a vector perpendicular to the cross-section of a spatial rectangle with a modulus of 1, used to characterize the cross-sectional direction of the spatial rectangle.
[0086] Points on the boundary line of the rectangular cross-section conduit for camera image processing and the corresponding camera optical center form sampling rays. Solve for the distance vectors between each sampling ray and each edge parallel to the axis of the spatial rectangle, as well as the distance vectors between the skew lines of the axis. Since the spatial skew line distances have direction, such as... Figure 3 As shown, the positive direction is defined as the skew line distance from a sampling ray pointing towards the axis of a spatial rectangle. If the skew line directions from the same sampling ray pointing towards each edge of the spatial rectangle are the same as the skew line directions pointing towards the axis, then the ray's skew line distance towards the edge of the spatial rectangle is considered positive. The magnitude of the minimum skew line distance is taken by comparing the skew line distances towards the edges and the skew line distances towards the axis. Conversely, the negative direction is defined as the skew line distance towards the edges, and the magnitude of the maximum skew line distance is taken. Given a sampling ray in a certain camera image... and the axis of the spatial rectangle A set of unit normal vectors If its angle is defined as 0°, then:
[0087] Sampling light : Through the camera's optical center The direction vector is represented as the vector pointing from the point on the boundary line of the rectangular cross-section duct to the optical center of the camera. , The coefficients of the equation are:
[0088] ; ;
[0089] The axis of a spatial rectangle: passing through a point on the axis The direction vector of the axis , The coefficients of the equation are given by:
[0090] ; ;
[0091] , It is a non-zero direction vector, and and Non-parallel ( This ensures that the two lines are skew lines. Therefore, the distance vector between the sampling ray and the axis of the spatial rectangle, and between the skew lines of the two lines, can be expressed as:
[0092] ;
[0093] in: This indicates the direction from the optical center of the sampled ray to the point on the axis. The vector, or simply the connection vector;
[0094] It represents the product of the direction vectors of two straight lines;
[0095] It represents the magnitude of the product of the direction vectors of two lines;
[0096] This represents the projection of the connecting vector onto the product direction, and its length is the projection length of the connecting vector onto the product direction.
[0097] Represents the distance vector between skew lines. Three-dimensional coordinates in the measurement coordinate system;
[0098] Similarly, we can find the distance vector between the sampling ray and the skew line of the edge of the spatial rectangle, and the edge of the spatial rectangle. : Through a point on the edge Its direction vector is represented as , The coefficients of the equation are given by:
[0099] ; ;
[0100] , It is a non-zero direction vector, and and Non-parallel ( This ensures that the two lines are skew lines. Therefore, the distance vector between the sampling ray and the edge of the spatial rectangle, and between the skew lines of the two lines, can be expressed as:
[0101] ;
[0102] in: Indicates from the axis Start moving in the positive direction along the normal vector. Continue moving in the positive direction along the line vector. This allows you to determine a point on the edge. ; It is based on the fact that the normal vector of the spatial rectangle is perpendicular to the axis vector and is... Starting from the first point, we obtain a set of normal vector values. The quantity is known.
[0103] This indicates the direction from the optical center of the sampled ray to the point on the edge. The vector, or simply the connection vector;
[0104] It represents the product of the direction vectors of two straight lines;
[0105] It represents the magnitude of the product of the direction vectors of two lines;
[0106] This represents the projection of the connecting vector onto the product direction, and its length is the projection length of the connecting vector onto the product direction.
[0107] Represents the distance vector between skew lines. Three-dimensional coordinates in the measurement coordinate system.
[0108] Reference sampling light With the edge of the space rectangle The process of solving for the distance vector between skew lines, solving for the sampling line. The skew line distance vector between the solid and the other three edges of the spatial rectangle is: , , .
[0109] After obtaining the distance vectors of each skew line, a geometric determination is applied to determine whether the distance vectors of each skew line are in the same direction. , For example:
[0110] ;
[0111] in, For vectors , The included angle, If the distance is greater than or equal to 0, then the two vectors are in the same direction, and the smaller vector's magnitude is taken as the minimum distance reference value; otherwise, If the value is less than 0, the two vectors are inversely related, and the magnitude of the larger vector is taken as the minimum distance reference value. (Compare vectors) Separately and , , , The minimum distance reference value is determined, and the smallest value is the sampled line for this group. The minimum distance value.
[0112] Finally, the objective function is to minimize the sum of the minimum distances of all sampled rays from all cameras to the edges and axes of the spatial rectangle, i.e., to minimize the total distances of all sampled rays from all cameras. Since the normal vector direction can not be fixed because it rotates around the axis vector direction within the height section of the spatial rectangle, a unit normal vector is set. Starting from, Perpendicular to the axis vector, its angle is defined as 0°, to fix the step size. (Usually set to 0.5°~1°), rotating within the height boundary section of the spatial rectangle around the axial vector direction; traversing all... By exhaustively searching for angles, all possible angle values of the normal vector are discretized, i.e., traversing the vector with a fixed step size. Calculate the objective function value for each angle and select the optimal solution. (Normal vector) Rotation Obtain the new normal vector By applying Rodriguez's rotation formula, the new normal vector is solved. The specific formula is expressed as follows:
[0113] ;
[0114] Repeat the calculation until all solutions are obtained. This is the sum of the minimum distances from all sampled rays of all camera images to the skew lines of the edges and axes of the spatial rectangle. Compare all these minimum distance sums and determine the smallest one that satisfies the objective function. Its corresponding normal vector is then the initial value for the normal vector of the spatial rectangle being solved. .
[0115] In step (4), the axis vectors of the spatial rectangle are optimized. The process is as follows:
[0116] like Figure 4 As shown, based on the existing spatial rectangle, determine the midpoints of the two end faces of the spatial rectangle (the end faces are perpendicular to the axis direction). , It is also the intersection of the axis of the spatial rectangle and the two end faces. , Solving point , midpoint By combining the existing normal vectors and line vectors of the spatial rectangle, the points can be preliminarily determined. The four vertices of the end face of the spatial rectangle In a spatial rectangle, the opposite end face is parallel to the end face and its distance is equal to the corresponding edge length. Given the midpoint of one end face... To the midpoint on the opposite side The vector is an axis vector perpendicular to the given end face. Specifically:
[0117] ;
[0118] in, Let be the direction vector of the axis vector. Continue solving for the point. , midpoint ,but:
[0119] ;
[0120] Further determination The four vertices of the end face of the spatial rectangle , expressed as:
[0121] ;
[0122] in, The initial values for the normal vectors of the spatial rectangular solid obtained from the previous solution; Given the initial values of the axis vectors of the spatial rectangular body. Initial value of normal vector The line vector obtained by solving, ; These represent the height and width of the spatial rectangle, respectively.
[0123] Four end face vertices and the center points of both end faces , The two-dimensional image projected onto a camera yields the corresponding vertex projection points of the end face. and the projection points of the center points of the two end faces , . (Based on the vertex of the end face) Projected onto camera For example, the formula expresses the projection points of each spatial point onto a two-dimensional image:
[0124] ;
[0125] in: Represents the projection point Two-dimensional image coordinates; coordinates of the camera optical center in the measurement coordinate system. End face vertex The three-dimensional coordinates in the measurement coordinate system are: The system calibration determines the intrinsic parameter matrix of each camera. and extrinsic parameter rotation matrix Specifically, this includes:
[0126] 1) , Represents the focal length in a two-dimensional image coordinate system Axial components, ( () represents the two-dimensional image coordinates of the camera's principal point;
[0127] 2) Camera extrinsic parameter matrix , represents the rotation matrix from the measurement coordinate system to the camera coordinate system, therefore the rotation matrix in the camera coordinate system is... Point coordinates can be represented as .in, Represent In camera coordinate system Axis coordinates.
[0128] connect , This refers to the two-dimensional projection line of the axis of the spatial rectangle in the camera image; in the camera image, it consists of four projection points. Two-dimensional projection lines onto the axis respectively Draw perpendicular lines. Based on the existing four sets of perpendicular line lengths, determine the longest and second longest perpendicular line; establish a proportional relationship with the length of the second longest perpendicular line as a correction factor. Use the projection point... To two-dimensional projection lines Taking the length of the perpendicular line as an example, the formula is expressed as:
[0129] ;
[0130] in: Represents the projection point Two-dimensional image coordinates; It is based on known two-dimensional projection points and The solution is obtained by finding the straight line containing the two projection points.
[0131] Based on the formula for perpendicular lines, the four projection points are obtained by solving the problem sequentially. To two-dimensional projection lines The perpendicular line, and denoted as Compare and confirm the longest and second longest perpendicular lines, to longest, Taking the second length as an example, the corresponding two-dimensional projection point The correction factor formula is expressed as:
[0132] ;
[0133] To determine the correction factor of a spatial rectangular volume in all camera images, based on existing two-dimensional images of a duct with a rectangular cross-section, two two-dimensional projection points of the correction factor can be identified. These should be the boundary points of a rectangular cross-section duct. Therefore, based on the coordinates of the two boundary points in the 2D image of the rectangular cross-section duct, the correction factor corresponding to the camera image is applied to adjust the center axis points corresponding to the two boundary points. This further optimizes the axis vector of the reconstructed spatial rectangle. Taking the correction factor obtained from the projection in the previous step as an example, the camera... In a two-dimensional image, grayscale extraction yields a set of upper and lower boundary points. ;
[0134] The formula for the axis point is expressed as:
[0135] ;
[0136] For all axis points in the corrected 2D camera image, the least squares method is applied to obtain the expression for the axis in the 2D camera image; the corrected axis expression is then obtained in all 2D camera images. Using the corrected axis expressions from all 2D camera images, the optimized axis vector in the measurement coordinate system is obtained through 3D reconstruction. .
[0137] Determine the normal vector of the optimized spatial rectangle. The methods include:
[0138] Based on the optimized axis vector The normal vector of the spatial rectangle is obtained through optimization. The specific method and the initial value of the normal vector of the first solution for the spatial rectangle. The reason for repeating the solution process is that the axis vectors of the spatial rectangle were corrected in the previous step. Since the axis vectors are important known conditions for solving the normal vector, it is necessary to solve for the normal vector again to obtain the normal vector of the spatial rectangle in the measurement coordinate system that meets the actual measurement requirements. .
[0139] Methods for reconstructing the ends of rectangular cross-section conduits using geometric relationships include:
[0140] Given the feature vectors of a spatial rectangular prism (including axis vectors, normal vectors, and line vectors), using the spatial rectangular prism as the reconstruction unit, and setting a fixed search step size, the prism data of the rectangular prism is obtained by spreading and reconstructing along the pipe body direction of the prism with a rectangular cross-section.
[0141] Since the end face position of a rectangular cross-section conduit is difficult to determine using a diffused rectangular body method, a rectangular body is used as the measurement object near the end face position of the rectangular cross-section conduit. Figure 5 As shown, a measuring camera is selected for the reconstruction of a rectangular cross-section conduit, and the center axis points of the measured height cross-section of the rectangular body are filtered. Given a ray that intersects the height section at two points besides the central axis, find the locations of these intersection points with the rectangle. ;
[0142] Find the intersection of the height edges far from the optical center of the camera. Scale factor Intersection Point of the central axis of the cross section geometric length value and intersection Pointing to the starting point vector By applying the solved geometric length ratio and geometric length value to the end boundary position of the rectangular cross-section duct in the camera image, the position of the axis point near the end face of the rectangular cross-section duct in the camera image is determined.
[0143] The above algorithm is executed on all cameras involved in end reconstruction to determine the location of the central axis point of the end face in each camera image. Three-dimensional reconstruction yields the coordinates of the end face axis point of the rectangular cross-section duct in the measurement coordinate system, thus completing the end measurement of the rectangular cross-section duct. Wherein:
[0144] ;
[0145] ;
[0146] In the camera image, the endpoints of the height edges of the rectangular cross-section conduit end face away from the camera optical center are respectively , .
[0147] endpoints Applying the scaling factor Determine the intersection point :
[0148] ;
[0149] intersection Application length value Determine the center axis point of the end face. :
[0150] ;
[0151] in, It is a vector Two-dimensional projection coordinates in the camera image.
[0152] Calculate the light rays of all cameras that meet the above conditions, determine the end face center axis point in several camera images, and obtain the three-dimensional coordinates of the end face center axis point that conforms to the actual measurement scene through three-dimensional reconstruction.
[0153] Methods for reconstructing the torsion angle based on digital model features include: such as... Figure 6 As shown, the torsion angle is one of the important characteristics of rectangular cross-section conduits, and accurate measurement of the torsion angle is an essential step in the measurement of rectangular cross-section conduits. Specifically, this includes:
[0154] The analytical model of the rectangular cross-section duct is used to obtain the standard point cloud data of the torsion angle of the duct. This data is then transformed from the numerical model coordinate system to the measurement coordinate system of the system, establishing a set of matrix transformation relationships. Since the rectangular cross-section duct can be represented by the diffusion of a spatial rectangular volume, the normal vector of the torsion angle in the measurement coordinate system can be represented by the normal vectors of the spatial rectangular volumes near both sides of the torsion angle. Given that the analytical model determines the normal vector of the torsion angle in the numerical model coordinate system, therefore:
[0155] ;
[0156] in, , These are the coordinate data of the normal vector of the torsion angle in the measurement coordinate system and the digital model coordinate system, respectively. , These are the rotation and translation matrix relationships from the digital model coordinate system to the measurement coordinate system, respectively, obtained by applying the correspondence of normal vectors. , The relationship between the two sets of coordinate matrices is solved by applying the Singular Value Decomposition (SVD) method. , Applying matrix transformation relationships The standard point cloud of the torsion angle is transformed into the measurement coordinate system, that is:
[0157] ;
[0158] in, The standard point cloud of the twist angle in the numerical model coordinate system; Applying matrix transformation relations , Will Transform to the measurement coordinate system to obtain the standard point cloud of the corresponding torsion angle.
[0159] Then, a camera is selected, and the calibrated intrinsic and extrinsic parameter relationships of the camera are applied to transform the standard point cloud of the torsion angle from the measurement coordinate system to the camera's image coordinate system. The formula is as follows:
[0160] ;
[0161] in, It is a standard point cloud of twist angle. Project any point in the image back to the two-dimensional image coordinates in the image coordinate system; These are the coordinates of the standard point cloud of the twist angle in the measurement coordinate system; These are the coordinates of the camera's projection center point in the measurement coordinate system; It is the principal point deviation. It is the focal length of the camera lens. Image point deviation caused by lens distortion, principal point deviation, lens focal length, and image point deviation caused by distortion are collectively referred to as the camera's intrinsic parameters. , The rotation and translation matrices between the measured coordinate system and the camera coordinate system are collectively referred to as the camera's extrinsic parameters. These include:
[0162] ; ;
[0163] Standard point cloud of twist angle After transforming from the measurement coordinate system to the image coordinate system, the set of projection point coordinates of the standard point cloud is obtained. .
[0164] Finally, given that in actual measurements, the direction of the torsion angle remains constant and aligns with the normal vector, therefore:
[0165] ;
[0166] This represents the rotation matrix relationship of the standard point cloud of the torsion angle from the numerical model coordinate system to the measurement coordinate system during the actual measurement process; in addition, This represents the translation matrix relationship of the standard point cloud of the torsion angle from the digital model coordinate system to the measurement coordinate system during the actual measurement process. Therefore, taking the minimum point gradient of the projected region of the standard point cloud as the objective function, we perform iterative solutions on all camera images to determine the translation matrix transformation relationship from the digital model coordinate system to the measurement coordinate system. The specific formula is expressed as follows:
[0167] ;
[0168] in, The set of coordinates of all projected points of the standard point cloud The gradient and the function with the lowest gradient in the image coordinate system; Point Image gradient magnitude in the image coordinate system; A point in the standard point cloud representing the angle of twist The image coordinates projected from the digital model coordinate system to the image coordinate system are: . This indicates the number of projected points in the standard point cloud. For the set of projection point coordinates of a standard point cloud any two-dimensional image point Its image gradient can be expressed as:
[0169] ;
[0170] ;
[0171] Applying matrix transformation relationships to the standard point cloud of twist angle in logarithmic coordinate system , The specific formula is as follows:
[0172] ;
[0173] in, , These are standard point cloud data of the torsion angle in the measurement coordinate system and the digital model coordinate system, respectively. , These are the rotation matrix relationship and translation matrix relationship from the digital model coordinate system to the measurement coordinate system, respectively; This establishes the matrix transformation relationship from the digital coordinate system to the measurement coordinate system. With this, the measurement of the torsion angle is complete.
[0174] Methods for reconstructing the circular hole of a rectangular cross-section conduit include:
[0175] Based on the image of the circular hole in the camera image, determine the center positions of the upper and lower annular rings of the hole. Combined with the known radius of the hole, determine the range of the upper and lower circles. The midpoint of the line connecting the centers of the upper and lower annular rings is designated as the center point of the three-dimensional circular hole. If this center point is within the range of the upper or lower circle, the camera image meets the measurement requirements; otherwise, the camera image does not meet the measurement requirements.
[0176] Since the normal vector of a circular hole can be represented by the normal vector of a nearby rectangular cross-section conduit, the SVD (Singular Value Decomposition) method is applied to determine the matrix transformation relationship from the digital model coordinate system to the measurement coordinate system, such as... Figure 7 As shown, the normal vector of the circular hole and the center point of the hole are transformed from the digital coordinate system to the measurement coordinate system, and a constraint plane is established with the center point of the hole as its normal vector. The center point of the circular hole in the measurement coordinate system is known. normal vector Therefore, the constrained plane can be expressed as:
[0177] ;
[0178] Selecting a filtered measurement camera image, the image point of the circular hole's central ring boundary passes through the camera's optical center, forming a ray that intersects with the plane of the circular hole's central ring in the measurement coordinate system. Establish the objective function:
[0179] ;
[0180] center Intersection All lie within the constraint plane, specifically the plane of the central annular ring of the circular hole. The center of the central annular ring of the circular hole is the constraint plane. To be solved, and proposed To find the initial values, substitute them into the above objective function and solve. The objective function should be... By approaching zero and using the constraining plane as the constraint condition, the exact center of the annulus around the circular hole can be obtained. Finally, for all camera images that meet the measurement requirements, the above objective function is executed to reconstruct the center of the circular hole's central ring that conforms to the actual measurement requirements. And the normal vector of the central annulus of the circular hole is .
[0181] Thus, this invention has completed the corresponding measurement schemes for the tube body, end, torsion angle, and circular hole of the rectangular cross-section conduit. By combining the measured standard digital model data of the rectangular cross-section conduit, tube type detection can be completed. First, based on the measured data of the tube body, end, torsion angle, and circular hole, a complete rectangular cross-section conduit model is output. Then, the measured tube body model is aligned with its standard digital model at the bending points to confirm the measurement deviation of each bending point. Next, the measured torsion angle of the rectangular cross-section conduit is aligned with its standard digital model to determine the measurement deviation of each torsion angle. Similarly, the measurement deviation of each circular hole can be obtained. Finally, by combining the bending point deviation, torsion angle deviation, and circular hole measurement deviation, tube type detection is completed.
[0182] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for measuring and detecting a rectangular cross-section conduit or wire, characterized in that, Includes the following steps: (1) Acquire multi-angle images of the rectangular cross-section duct under test using a multi-view vision system; (2) Based on the multi-angle images, solve for the axis vectors of the spatial rectangular body representing the tube body with a rectangular cross-section. ; (3) Based on the axis vector Solve for the initial value of the normal vector of the spatial rectangle. ; (4) Optimize the axis vector of the spatial rectangle. , thus obtaining the optimized axis vector ; (5) Based on optimized axis vector Determine the normal vector of the optimized spatial rectangle. ; (6) A special structure of a rectangular cross-section conduit reconstructed from a modeled tube body, the special structure including an end, a torsion angle and a circular hole; (7) Integrate the measurement data of the tube body and special structures, and output a complete three-dimensional model of the tube with a rectangular cross section to complete the inspection; In step (2), the axis vector is solved. include: Denoising and grayscale thresholding are performed on the camera images to obtain the boundary straight line of the rectangular cross-section duct; Connect the camera's optical center with the boundary line to form a boundary plane; By applying the principle of small-angle approximation, image points that are equidistant from the straight lines to the two side boundaries in the image are identified, forming an undetermined axis. Connect the camera's optical center with the axis to be determined to form the plane of the axis to be determined. Solve for the intersection of two adjacent planes of the axis to be determined by the proposed axis. The proposed axes of all adjacent cameras are averaged to obtain the axis vectors. ; The initial value of the normal vector is obtained in step (3). include: With axis vector and unit normal vector The four edges of a spatial rectangle; Points on the straight line connecting the boundary of the rectangular cross-section conduit and the optical center of the camera form sampling rays; Calculate the skew line distance vector between the sampling ray and the axis of the spatial rectangle. And the skew line distance vector between the sampling ray and the edge of the spatial rectangle ; Determine the same-direction distance vectors by the cosine of the included angle, and then filter for the minimum distance value; The objective function is the sum of the minimum distances from all sampled rays to the edge, with a fixed step size. Rotate normal vector: ; Traversal The optimal initial value of the normal vector is obtained in the range [0°, 360°). .
2. The method for measuring and detecting a rectangular cross-section conduit or wire according to claim 1, characterized in that, In step (1), the multi-view vision system needs to be calibrated before acquiring images. After calibration, the rectangular cross-section conduit to be measured is placed in the measurement area, and the calibrated multi-view vision system is used to photograph the rectangular cross-section conduit to obtain images of the rectangular cross-section conduit from all camera perspectives. The calibration process of the multi-view vision system is as follows: Using a calibration board with regularly arranged circular coded and non-coded markers, the calibration board was photographed under different poses of a multi-view vision system. Solving the intrinsic parameter matrix of each camera based on the principle of close-range photogrammetry and extrinsic parameter rotation matrix A measurement coordinate system is established at the center of the calibration plate; In this measurement coordinate system, the Z-axis is perpendicular to the measurement plane and points towards the top camera, the X and Y axes are perpendicular to each other and located within the measurement plane, and the origin of the coordinate system is located at the geometric center of the measurement plane.
3. The method for measuring and detecting a rectangular cross-section conduit or wire according to claim 2, characterized in that, In step (4), the axis vector The optimization process is as follows: Based on axis vectors Initial value of the normal vector Calculate the four vertices of the end face of the spatial rectangle and the two intersection points of the axes; Project the vertices and intersections onto the camera image to obtain the projection points of the vertices and intersections. Calculate the length of the perpendicular line from each projection point to the axis projection line; Filter the longest and second longest perpendicular lines and calculate the scaling factor; Correct the axis points based on the coordinates of the image boundary points and the scaling factor; The optimized axis vector is obtained by fitting the corrected axis points. .
4. The method for measuring and detecting a rectangular cross-section conduit or wire according to claim 3, characterized in that, In step (5), the normal vector is determined. The process is as follows: Based on optimized axis vector Repeat step (3) to solve for the initial value of the normal vector. The steps are as follows, and the final normal vector is output. .
5. The method for measuring and detecting a rectangular cross-section conduit or wire according to claim 4, characterized in that, Reconstructing the end in step (6) includes: Pipeline data is obtained by spreading along the pipe body direction using spatial rectangular prisms as reconstruction units. Near the end, select the light rays that pass through the central axis of the rectangular cross-section and have two intersections with the cross-section, and solve for the intersection points of the light rays with the rectangular body; Based on the scaling factor and geometric length of the intersection point and the central axis point, the position of the axis point near the end face in the camera image is determined, and the coordinates of the axis point of the end face are obtained by 3D reconstruction.
6. The method for measuring and detecting a rectangular cross-section conduit or wire according to claim 5, characterized in that, Step (6) reconstructing the torsion angle includes: The standard point cloud of the torsion angle is obtained by analyzing the digital model of the rectangular cross-section duct, and the standard point cloud is transformed from the digital model coordinate system to the measurement coordinate system. Select a camera, project the standard point cloud onto the two-dimensional image coordinate system, and iteratively adjust the position of the standard point cloud with the gradient of the projected area as the objective function. Determine the matrix transformation relationship from the digital model coordinate system to the measurement coordinate system to complete the three-dimensional reconstruction of the torsion angle.
7. The method for measuring and detecting a rectangular cross-section conduit or wire according to claim 6, characterized in that, Step (6) to reconstruct the circular hole includes: Transform the circular hole from the digital model coordinate system to the measurement coordinate system; Based on the normal vector of the rectangular space of the tube near the circular hole, a constraint plane passing through the center of the circular annulus at the center of the circular hole is established; For camera images that meet the requirements, establish the objective function relationship between the image and the central ring of the circular hole in the measurement coordinate system. Combine the constraint plane to solve the center coordinates of the central ring of the circular hole and complete the reconstruction.
Citation Information
Patent Citations
Three-dimensional variable section bent runner design method and device based on geometrical mergence
CN108999845A
High-precision catheter end detecting and positioning method
CN113409395A