A 3D point cloud detection method for special-shaped tube deformation
Patent Information
- Application Number
- CN202311565603.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2043-11-22
AI Technical Summary
[0003]随着工业化技术的提高,加工业得到了急速的发展,但还是存在一些尺寸缺陷,这些缺陷需要大量的人工花费许多时间去检测,浪费了许多人力和物力,效率上也无法保证
[0063] 1. The present invention provides a 3D point cloud detection method for irregular tube deformation. It uses voxel downsampling and statistical filtering to downsample and denoise the point cloud, which reduces the amount of data and noise, and can effectively solve the problems of low efficiency caused by excessive data and low accuracy caused by excessive noise.
Smart Images

Figure CN117557992B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of visual inspection, specifically a 3D point cloud detection method for irregular tube deformation. Background Technology
[0002] As a crucial component in new energy vehicles, shaped tubing needs to meet various requirements, including resistance to hydrolysis, high temperatures, and lightweight design. Components such as battery packs, motors, and controllers are connected via cooling water pipes. The cooling water acts as a heat carrier; when a component's operating temperature is too high, the cooling water carries away excess heat, dissipating it through radiators and battery coolers. When a component's operating temperature is too low, the cooling water can draw heat from components such as water heaters and water-cooled condensers.
[0003] With the advancement of industrial technology, the processing industry has developed rapidly, but some dimensional defects still exist. These defects require a lot of manpower and time to detect, wasting a lot of human and material resources, and efficiency cannot be guaranteed. Summary of the Invention
[0004] The present invention aims to address the shortcomings of the existing technology by proposing a 3D point cloud detection method for irregular tube deformation. This method aims to detect whether the deformation of irregular tubes meets the requirements through 3D point cloud detection, thereby improving production efficiency, saving costs, and avoiding losses caused by deformation.
[0005] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0006] The present invention provides a 3D point cloud detection method for irregular tube deformation, characterized in that it is used to register the measured point cloud with the model point cloud to detect whether the deformation of the irregular tube meets the requirements. The 3D point cloud detection method includes the following steps:
[0007] Step 1: Obtain the coordinate data of the irregularly shaped tube using a 3D line laser measuring instrument, and convert it into a measurement point cloud. in, M represents the i-th measurement point; M represents the number of measurement points.
[0008] The point cloud of the model is obtained from the design model diagram. in, Let M represent the j-th model point, and N represent the number of model points, where M < N;
[0009] Step 2: After voxel downsampling the measurement point cloud P and the model point cloud Q respectively, we can obtain the downsampled measurement point cloud P1 and the downsampled model point cloud Q1.
[0010] Step 3: After statistical filtering and noise reduction of P1, the noise-reduced measurement point cloud P2 is obtained;
[0011] Step 4: Use the RANSAC algorithm to perform coarse registration between P2 and Q1 to obtain the transformation matrix T between them; transform P2 into the coarsely registered measurement point cloud P3 according to T;
[0012] Step 5: Use the iterative nearest point algorithm to perform fine registration of P3 and Q1 to obtain the accurate transformation matrix T1. Based on T1, transform P3 into the finely registered measurement point cloud P4.
[0013] Step 6: Calculate the distance between P4 and Q1:
[0014] Find the model point in Q1 that is closest to each measurement point in P4, and calculate the distance between each measurement point and its nearest model point, so as to obtain the distance between all points in P4 and Q1;
[0015] Step 7: Determine if all distances are within the threshold. If so, it means that the deformation of the irregular tube meets the requirements. Otherwise, proceed to step 8.
[0016] Step 8: Count the number of points that exceed the threshold. If the number is within the set range, it means that the deformation of the special-shaped tube meets the requirements; otherwise, it means that the deformation of the special-shaped tube does not meet the requirements.
[0017] The 3D point cloud detection method for irregular tube deformation described in this invention is also characterized in that the voxel downsampling in step 2 is performed according to the following steps:
[0018] Step 2.1: Calculate the minimum x-axis coordinate x in P. 0min With the maximum value of the x-axis coordinate x 0max y-axis coordinate maximum value y 0max minimum value of y-axis coordinate 0min Maximum z-axis coordinate 0max minimum z-axis coordinate 0min ;
[0019] Step 2.2: Calculate the dimension of the voxel mesh on the corresponding coordinate axes using equation (1):
[0020]
[0021] In equation (1), r represents the size of each voxel grid; D x D represents the dimension of the voxel mesh in the x-direction. y D represents the dimension of the voxel mesh in the y-direction. z This indicates the dimension of the voxel mesh in the z-direction;
[0022] Step 2.3: Use equation (2) for the i-th measurement point voxel index h i :
[0023]
[0024] In equation (2), express x-direction index within the voxel grid express Y-direction index within the voxel grid express z-direction index within the voxel mesh express 3D coordinates;
[0025] Step 2.4: Calculate the average value of all measurement points in each voxel grid, and replace all measurement points in the corresponding voxel grid with the average value of each voxel grid to obtain the measurement points in all voxel grids and form the downsampled measurement point cloud P1.
[0026] The statistical filtering noise reduction in step 3 is performed as follows:
[0027] Step 3.1: Set the number of nearest neighbor measurement points to a for each measurement point, iterate through all measurement points in P1, and calculate the average distance between each measurement point and its a nearest neighbor points;
[0028] Step 3.2: Calculate the distance threshold d using equation (3). max :
[0029] d max =μ+λσ (3)
[0030] In equation (3), λ represents the proportionality coefficient; μ and σ represent the mean and standard deviation of all average distances, respectively;
[0031] Step 3.3: Ensure that the average distance to a neighboring points is greater than the distance threshold d. max The outlier measurement points are identified as outliers and removed, thus obtaining the noise-reduced measurement point cloud P2.
[0032] The RANSAC algorithm in step 4 includes the following steps:
[0033] Step 4.1: Based on the number of points in P2 and Q1, set the smaller number as num;
[0034] Step 4.2: Set the number of random sampling points to l. If l > num, then let l = num;
[0035] Step 4.3: Define the current iteration number as iter and initialize iter = 1; define the maximum iteration number as I; define and initialize the optimal number of interior points f. best =0 and the optimal transformation matrix T = [].
[0036] Step 4.3.1: Randomly select three points in P2 and Q1 for the iterth time, and calculate the iterth transformation matrix T between the three measurement points in P2 and the three model points in Q1. iter Thus, P2 is transformed by matrix T iter Transform to the Q1 coordinate system to obtain the set of measurement points for the iterth transformation. in, express The k-th measurement point; m represents the total number of measurement points or model points; m < M, N;
[0037] Step 4.3.2: Define the downsampled model point cloud This represents the k-th model point in Q1;
[0038] Step 4.3.3: First, The difference matrix for the iterth iteration is obtained by subtracting the coordinates of all measured points in Q1 from the coordinates of all model points in Q1. Secondly, The multiple matrix is obtained by doubling the original value of each element. Then The sum of each row of elements in the matrix is obtained by adding the elements together. right After taking the square root of each element, we obtain a matrix A of dimension m×1; after counting the number of elements in A that are less than the maximum fitting error d, we obtain the number of interior points f in the iter-th iteration. iter ;
[0039] Step 4.3.4: When f iter >f best , let f best =f iter T = T iter Otherwise, keep f best And T remains unchanged;
[0040] Step 4.4: After assigning iter+1 to iter, check if iter>I is true. If it is true, it means that the optimal transformation matrix T has been obtained. Otherwise, return to step 4.3.1 and execute sequentially.
[0041] The iterative nearest point algorithm in step 5 includes the following steps:
[0042] Step 5.1: Definition in, This represents the k-th measurement point in P3;
[0043] Construct the objective function using equation (5):
[0044]
[0045] In equation (5), R represents the rotation matrix and t represents the translation matrix;
[0046] Step 5.2: Calculate the objective function using the least squares method to minimize the sum of squared errors:
[0047] Step 5.2.1: Define the function And let the partial derivative Therefore, the translation matrix t can be obtained using equation (6):
[0048]
[0049] In equation (6), Denotes the centroid of P3, and Denotes the centroid of Q1, and
[0050] Step 5.2.2: Define centroid-free coordinates Thus, the simplified objective function is obtained using equation (7):
[0051]
[0052] Step 5.2.3: After simplifying equation (7), we obtain equation (8):
[0053]
[0054] Step 5.2.4: Calculate the rank of equation (8) to obtain equation (9):
[0055]
[0056] In equation (11), X3 represents The set, Y1 represents The set of; tr represents the rank of the matrix; T represents the transpose of the matrix;
[0057] Step 5.2.5: Define the covariance matrix S = X3Y1 T Then, SVD decomposition is performed on S. When S is full rank, the rotation matrix R = VU is obtained. T Where U and V are orthogonal matrices of the SVD decomposition;
[0058] Step 5.3: Use (10) to find the transformation matrix T1:
[0059]
[0060] The present invention provides an electronic device, including a memory and a processor, wherein the memory is used to store a program that supports the processor in executing the 3D point cloud detection method, and the processor is configured to execute the program stored in the memory.
[0061] The present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program is executed by a processor to perform the steps of the 3D point cloud detection method.
[0062] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0063] 1. The present invention provides a 3D point cloud detection method for irregular tube deformation. It uses voxel downsampling and statistical filtering to downsample and denoise the point cloud, which reduces the amount of data and noise, and can effectively solve the problems of low efficiency caused by excessive data and low accuracy caused by excessive noise.
[0064] 2. This invention uses the RANSAC algorithm for coarse registration of point clouds and the iterative nearest point algorithm for fine registration, resulting in accurate registration. The combination of coarse and fine registration improves the accuracy of registration and detection.
[0065] 3. This invention has high calculation speed and accuracy, can effectively detect the deformation of irregular tubes, improves production efficiency, and greatly saves time and economic costs. Attached Figure Description
[0066] Figure 1 This is a flowchart of a 3D point cloud detection method for irregular tube deformation according to the present invention. Detailed Implementation
[0067] In this embodiment, a 3D point cloud detection method for irregular tube deformation is used to register the measured point cloud with the model point cloud to detect whether the deformation of the irregular tube meets the requirements, such as... Figure 1 As shown, the 3D point cloud detection method includes the following steps:
[0068] Step 1: Obtain the coordinate data of the irregularly shaped tube using a 3D line laser measuring instrument, and convert it into a measurement point cloud. in, M represents the i-th measurement point; M represents the number of measurement points.
[0069] The point cloud of the model is obtained from the design model diagram. in, Let M represent the j-th model point, and N represent the number of model points, where M < N;
[0070] Step 2: After voxel downsampling the measurement point cloud P and the model point cloud Q respectively, we obtain the downsampled measurement point cloud P1 and the downsampled model point cloud Q1:
[0071] Step 2.1: Calculate the minimum x-axis coordinate x in P. 0min With the maximum value of the x-axis coordinate x 0max y-axis coordinate maximum value y 0max minimum value of y-axis coordinate 0min Maximum z-axis coordinate 0max minimum z-axis coordinate 0min ;
[0072] Step 2.2: Calculate the dimension of the voxel mesh on the corresponding coordinate axes using equation (1):
[0073]
[0074] In equation (1), r represents the size of each voxel grid; D x D represents the dimension of the voxel mesh in the x-direction. y D represents the dimension of the voxel mesh in the y-direction. z This indicates the dimension of the voxel mesh in the z-direction;
[0075] Step 2.3: Use equation (2) for the i-th measurement point voxel index h i :
[0076]
[0077] In equation (2), express x-direction index within the voxel grid express Y-direction index within the voxel grid express z-direction index within the voxel mesh express 3D coordinates;
[0078] Step 2.4: Calculate the average value of all measurement points in each voxel grid, and replace all measurement points in the corresponding voxel grid with the average value of each voxel grid to obtain the measurement points in all voxel grids and form the downsampled measurement point cloud P1.
[0079] Step 3: After statistical filtering and noise reduction of P1, the noise-reduced measurement point cloud P2 is obtained:
[0080] Step 3.1: Set the number of nearest neighbor measurement points to a for each measurement point, iterate through all measurement points in P1, and calculate the average distance between each measurement point and its a nearest neighbor points;
[0081] Step 3.2: Calculate the distance threshold d using equation (3). max :
[0082] d max =μ+λσ (3)
[0083] In equation (3), λ represents the proportionality coefficient; μ and σ represent the mean and standard deviation of all average distances, respectively;
[0084] Step 3.3: Ensure that the average distance to a neighboring points is greater than the distance threshold d. max The outlier measurement points are identified as outliers and removed, thus obtaining the noise-reduced measurement point cloud P2.
[0085] Step 4: Use the RANSAC algorithm to perform coarse registration between P2 and Q1, obtaining the transformation matrix T between them; transform P2 into the coarsely registered measurement point cloud P3 based on T:
[0086] Step 4.1: Based on the number of points in P2 and Q1, set the smaller number as num;
[0087] Step 4.2: Set the number of random sampling points to l. If l > num, then let l = num;
[0088] Step 4.3: Define the current iteration number as iter and initialize iter = 1; define the maximum iteration number as I; define and initialize the optimal number of interior points f. best =0 and the optimal transformation matrix T = [].
[0089] Step 4.3.1: Randomly select three points in P2 and Q1 for the iterth time, and calculate the iterth transformation matrix T between the three measurement points in P2 and the three model points in Q1. iter Thus, P2 is transformed by matrix T iter Transform to the Q1 coordinate system to obtain the set of measurement points for the iterth transformation. in, express The k-th measurement point; m represents the total number of measurement points or model points; m < M, N;
[0090] Step 4.3.2: Define the downsampled model point cloud This represents the k-th model point in Q1;
[0091] Step 4.3.3: First, The difference matrix for the iterth iteration is obtained by subtracting the coordinates of all measured points in Q1 from the coordinates of all model points in Q1. Secondly, The multiple matrix is obtained by doubling the original value of each element. Then The sum of each row of elements in the matrix is obtained by adding the elements together. right After taking the square root of each element, we obtain a matrix A of dimension m×1; after counting the number of elements in A that are less than the maximum fitting error d, we obtain the number of interior points f in the iter-th iteration. iter ;
[0092] Step 4.3.4: When f iter >f best , let f best =f iter T = T iter Otherwise, keep f best And T remains unchanged;
[0093] Step 4.4: After assigning iter+1 to iter, check if iter>I is true. If it is true, it means that the optimal transformation matrix T has been obtained. Otherwise, return to step 4.3.1 and execute sequentially.
[0094] Step 5: Use the iterative nearest point algorithm to perform fine registration of P3 and Q1, obtaining the accurate transformation matrix T1. Based on T1, transform P3 into the finely registered measurement point cloud P4.
[0095] Step 5.1: Definition in, This represents the k-th measurement point in P3;
[0096] Construct the objective function using equation (5):
[0097]
[0098] In equation (5), R represents the rotation matrix and t represents the translation matrix;
[0099] Step 5.2: Calculate the objective function using the least squares method to minimize the sum of squared errors:
[0100] Step 5.2.1: Define the function And let the partial derivative Find:
[0101]
[0102] Calculate the centroid of P3: The center of mass of Q1: Equation (6) can be transformed into and
[0103] Step 5.2.2: Define centroid-free coordinates Thus, the simplified objective function is obtained using equation (7):
[0104]
[0105] Step 5.2.3: Expanding equation (7) yields:
[0106]
[0107] Substituting equation (8) into Further simplification:
[0108]
[0109] Substituting equation (9) into equation (7), we get:
[0110]
[0111] Step 5.2.4: For equation (10), we have:
[0112]
[0113] In equation (11), X3 represents The set, Y1 represents The set of; tr represents the rank of the matrix; T represents the transpose of the matrix;
[0114] Step 5.2.5: Define the covariance matrix S = X3Y1 T Then, SVD decomposition is performed on S. When S is full rank, the rotation matrix R = VU is obtained. T , where U and V are orthogonal matrices of the SVD decomposition;
[0115] Step 5.3: Use (12) to find the transformation matrix T1:
[0116]
[0117] Step 6: Calculate the distance between P4 and Q1:
[0118] Find the model point in Q1 that is closest to each measurement point in P4, and calculate the distance between each measurement point and its nearest model point, so as to obtain the distance between all points in P4 and Q1;
[0119] Step 7: Determine if all distances are within the threshold. If so, it means that the deformation of the irregular tube meets the requirements. Otherwise, proceed to step 8.
[0120] Step 8: Count the number of points that exceed the threshold. If the number is within the set range, it means that the deformation of the special-shaped tube meets the requirements; otherwise, it means that the deformation of the special-shaped tube does not meet the requirements.
[0121] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.
[0122] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.
Claims
1. A method for detecting profiled tube deformations from a 3D point cloud, characterized in that, It is used to register the measured point cloud with the model point cloud to detect whether the deformation of the irregular tube meets the requirements. The 3D point cloud detection method includes the following steps: Step 1: Obtain the coordinate data of the special-shaped tube by a 3D line laser measuring instrument, and convert it into a measurement point cloud ; wherein, represents the thmeasurement point; represents the number of measurement points; Obtaining model point cloud from design model drawing wherein, denotes the th model point, denotes the number of model points, and ; Step 2: Measure the point cloud and model point cloud After voxel downsampling, the downsampled measurement point cloud was obtained. and downsampled model point cloud ; Step 2.1: Calculation In Minimum value of axis coordinates and Maximum value of axis coordinates , Maximum value of axis coordinates and Minimum value of axis coordinates , Maximum value of axis coordinates and Minimum value of axis coordinates ; Step 2.2: Calculate the dimension of the voxel mesh on the corresponding coordinate axes using equation (1): (1) In equation (1), Indicates the size of each voxel grid; Indicates voxel mesh in Dimension of direction; Indicates voxel mesh in Dimension of direction; Indicates voxel mesh in Dimension of direction; Step 2.3: Using equation (2) Measurement points voxel index : (2) In equation (2), express Within the voxel grid Direction index, express Within the voxel grid Direction index, express Within the voxel grid Direction index, express 3D coordinates; Step 2.4: Calculate the average value of all measurement points in each voxel grid, and replace all measurement points in the corresponding voxel grid with the average value of each voxel grid to obtain the measurement points in all voxel grids, and form a downsampled measurement point cloud. ; Step 3: Put After statistical filtering and noise reduction, the denoised measurement point cloud is obtained. ; Step 3.1: Set the number of nearest neighbor measurement points for each measurement point to 1. traversal All measurement points are included, and the relationship between each measurement point and the total measurement points is calculated. The average distance between neighboring points; Step 3.2: Calculate the distance threshold using equation (3) : (3) In equation (3), Indicates the proportionality coefficient; and These represent the mean and standard deviation of all average distances, respectively. Step 3.3: Combine with The average distance between the nearest neighbors is greater than the distance threshold. The outlier measurement points are identified and removed, thus obtaining the denoised measurement point cloud. ; Step 4: Use the RANSAC algorithm to... and Perform coarse registration to obtain the transformation matrix between the two. ;according to Will Transformed into a coarsely registered measurement point cloud ; Step 5: Use the iterative nearest point algorithm to... and Perform fine registration to obtain the accurate transformation matrix. ,according to Will Transformed into a precisely registered measurement point cloud ; Step 6: and Calculate the distance between them: exist Find the corresponding For each measurement point, the nearest model point is identified, and the distance between each measurement point and its nearest model point is calculated, thus obtaining... All points and The distance; Step 7: Determine if all distances are within the threshold. If so, it means that the deformation of the irregular tube meets the requirements; otherwise, proceed to step 8. Step 8: Count the number of points that exceed the threshold. If the number is within the set range, it means that the deformation of the special-shaped tube meets the requirements; otherwise, it means that the deformation of the special-shaped tube does not meet the requirements.
2. The 3D point cloud detection method for irregular tube deformation according to claim 1, characterized in that, The RANSAC algorithm in step 4 includes the following steps: Step 4.1: According to and The number of points in the data, set the smaller number as ; Step 4.2: Set the number of random sampling points to... ,if , then, let ; Step 4.3: Define the current iteration number as... and initialize The maximum number of iterations is defined as ; Define and initialize the optimal number of interior points. and the optimal transformation matrix ; Step 4.3.1: In and The middle of each Three points are randomly selected and calculated. The three measurement points in the middle are respectively with The three model points in the first Transformation matrix Thus By transforming the matrix Transform to In the coordinate system, we obtain the first... Set of measurement points for the second transformation ;in, express The Middle There are 1 measurement points; m represents the total number of measurement points or model points. ; Step 4.3.2: Define the downsampled model point cloud , express The first in One model point; Step 4.3.3: First, The coordinates of all measurement points in the middle and After subtracting the coordinates of all model points, we obtain the first... The difference matrix of the next iteration Secondly, The multiple matrix is obtained by doubling the original value of each element. Then After adding the elements of each row in the matrix, we get the summation matrix. ,right After taking the square root of each element, the dimension is obtained as follows: matrix ;statistics The middle is smaller than the maximum fitting error After determining the number of elements, we obtain the first... Number of interior points in the next iteration ; Step 4.3.4: When ,make , Otherwise, keep and constant; Step 4.4: Assign to Then, make a judgment Does it hold true? If it does, then the optimal transformation matrix has been obtained. Otherwise, return to step 4.3.1 and execute sequentially.
3. The 3D point cloud detection method for irregular tube deformation according to claim 2, characterized in that, The iterative nearest point algorithm in step 5 includes the following steps: Step 5.1: Definition ,in, express The first in One measurement point; Construct the objective function using equation (5): (5) In equation (5), Represents the rotation matrix. Represents the translation matrix; Step 5.2: Calculate the objective function using the least squares method to minimize the sum of squared errors: Step 5.2.1: Define the function And let the partial derivative Thus, the translation matrix can be obtained using equation (6). : (6) In equation (6), express The center of mass, and , express The center of mass, and ; Step 5.2.2: Define centroid-free coordinates Thus, the simplified objective function is obtained using equation (7): (7) Step 5.2.3: After simplifying equation (7), we obtain equation (8): (8) Step 5.2.4: Calculate the rank of equation (8) to obtain equation (9): (9) In equation (11), express The set, express A set; Describes the rank of a matrix; Represents the transpose of a matrix; Step 5.2.5: Define the covariance matrix and to Perform SVD decomposition when When the rank is full, the rotation matrix is obtained. ,in, and It is an orthogonal matrix decomposed by SVD; Step 5.3: Use (10) to find the transformation matrix. : (10)。 4. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing any of the 3D point cloud detection methods of claims 1-3, and the processor is configured to execute the program stored in the memory.
5. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the steps of any of the 3D point cloud detection methods described in claims 1-3.