A method for detecting a three-dimensional profile of a damaged area of a metal workpiece and application thereof
By using a method of converting and reconstructing 3D point clouds and 2D images, the problem of relying on computer-aided design models for the detection of metal cold spraying repair in existing technologies has been solved, and efficient and autonomous detection of damaged areas in metal workpieces has been achieved.
Patent Information
- Application Number
- CN202310732374.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-20
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2043-06-20
AI Technical Summary
In existing metal cold spray repair technology, the detection of the three-dimensional contour of the damaged area of the metal workpiece relies on computer-aided design models and prior knowledge, which has a low degree of autonomy and a large computational load, affecting the detection efficiency.
A method for converting and reconstructing 3D point clouds and 2D images is adopted. The 3D point cloud data is corrected by the least squares method, the 2D grayscale image is generated by the K-nearest neighbor algorithm, the boundary is extracted by combining Gaussian filtering and Moore's neighborhood tracking algorithm, and finally the 3D contour coordinates are reconstructed, avoiding direct processing of the 3D point cloud.
It improves the detection efficiency and autonomy of the metal cold spray repair system, reduces the computational load, and achieves efficient detection without the need for computer-aided design models.
Smart Images

Figure CN116883324B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a three-dimensional contour detection method, specifically to a three-dimensional contour detection method for damaged areas of metal workpieces and its application. Background Technology
[0002] Cold spray metal repair is a metal workpiece repair technology based on additive manufacturing. It utilizes low-temperature, high-speed metal particles in a solid state to form a repair coating on the damaged area. It offers advantages such as no oxidation and no thermal deformation during the repair process, and can repair almost all metal workpieces, showing broad application prospects. Before cold spray metal repair, the three-dimensional contour of the damaged area of the metal workpiece needs to be detected. Existing detection methods rely on computer-aided design models or prior knowledge of the damaged workpiece, resulting in a low degree of autonomy for cold spray metal repair systems. Furthermore, directly processing three-dimensional point clouds incurs a high computational load, affecting detection efficiency. Summary of the Invention
[0003] Purpose of the invention: The first purpose of this invention is to provide a three-dimensional contour detection method for damaged areas of metal workpieces with high detection efficiency and strong autonomous detection capability; the second purpose of this invention is to provide the application of this three-dimensional contour detection method for damaged areas of metal workpieces.
[0004] Technical solution: The method for three-dimensional contour detection of damaged areas in metal workpieces according to the present invention includes:
[0005] (1) Acquire and correct the three-dimensional point cloud data of the damaged area of the metal workpiece;
[0006] (2) The corrected three-dimensional point cloud data is processed by the K-nearest neighbor algorithm to generate a two-dimensional grayscale image of the local surface where the damaged area is located.
[0007] (3) Denoise the two-dimensional grayscale image and then convert it into a binary image by setting a grayscale threshold;
[0008] (4) The binary image is processed by the Moore neighborhood tracking algorithm to extract the two-dimensional pixel coordinates of the boundary of the damaged area;
[0009] (5) Based on the two-dimensional pixel coordinates and corresponding gray values of the damaged area boundary, the three-dimensional contour coordinates of the damaged area are reconstructed.
[0010] Furthermore, in step (1), the local surface of the damaged area of the metal workpiece is scanned by a 3D high-precision line laser scanning device to obtain the three-dimensional point cloud data of the damaged area of the metal workpiece.
[0011] Furthermore, in step (1), the three-dimensional point cloud data of the damaged area of the metal workpiece is corrected by the least squares method.
[0012] Furthermore, the correction of the three-dimensional point cloud data of the damaged area of the metal workpiece using the least squares method includes:
[0013] The point cloud data of the local surface of the damaged area of the metal workpiece is fitted to a plane using the least squares method.
[0014] Calculate the rotation matrix R to rotate the fitted plane to be parallel to the XY plane in the point cloud coordinate system;
[0015] The local point cloud data containing the damaged area is rigidly rotated using a rotation matrix R, so that the surface of the damaged area in the 3D point cloud data is parallel to the XY plane in the point cloud coordinate system.
[0016] Furthermore, the step of fitting a plane to the local surface point cloud data of the damaged area of the metal workpiece using the least squares method includes:
[0017] Establish a point-normal plane equation: z = ax + by + c
[0018] The point cloud data of the local surface where the damaged area is located is obtained, and the values of coefficients a, b, and c in the point normal plane equation are estimated by the least squares method, so as to obtain the point normal plane equation of the fitted plane.
[0019] The calculation of the rotation matrix R that rotates the fitting plane to be parallel to the XY plane in the point cloud coordinate system includes: calculating the unit normal vector of the fitting plane. The rotation matrix between [0,0,-1] is taken as the rotation matrix R of the plane, where
[0020]
[0021] This rotation matrix R is around the vector P = [x] P y P , z P A rotation matrix that rotates counterclockwise by an angle θ.
[0022] Furthermore, in the K-nearest neighbor algorithm, the parameter k is set to 1, and the k-dimensional tree algorithm is used as the method for nearest neighbor search.
[0023] Further, in step (2), the corrected 3D point cloud data is processed using the K-nearest neighbor algorithm to generate a 2D grayscale image of the local surface where the damaged area is located, including:
[0024] Initially, generate a grayscale image with dimensions h*w, and set the initial grayscale value of each pixel to 1;
[0025] Based on the XY coordinates of the point cloud on the surface where the damaged area of the corrected 3D point cloud data is located, the point cloud XY coordinates corresponding to each pixel coordinate in the h*w dimension grayscale image are constructed, which are simply referred to as grayscale image XY coordinates.
[0026] The K-nearest neighbor algorithm is used to find the grayscale XY coordinates that are closest to the XY coordinates of each data point in the point cloud of the surface where the damaged area is located.
[0027] Calculate the average of the Z coordinates of all the closest point cloud data points corresponding to the XY coordinates of each grayscale image, and use this average as the Z coordinate information of the corresponding grayscale image XY coordinates;
[0028] Based on the Z coordinate information of the corresponding XY coordinates of the grayscale image, it is normalized to the grayscale value of each pixel in the grayscale image, with the value range being [0, 1].
[0029] Furthermore, in step (3), a two-dimensional Gaussian filter is used to denoise the two-dimensional grayscale image.
[0030] Further, in step (5), the three-dimensional contour coordinates of the damaged region are reconstructed based on the two-dimensional pixel coordinates and corresponding gray values of the damaged region boundary, including:
[0031] The Z coordinate information of the corresponding grayscale image XY coordinates is mapped to the pixel coordinates of the grayscale image;
[0032] Based on the two-dimensional pixel coordinates of the damaged area boundary, the corresponding (X,Y,Z) coordinate information is retrieved.
[0033] The above-mentioned three-dimensional contour detection method for damaged areas of metal workpieces is applied in metal cold spraying repair.
[0034] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0035] This invention is based on the conversion and reconstruction between three-dimensional point clouds and two-dimensional images. It does not require computer-aided design models and prior knowledge that would damage the workpiece, and it avoids direct processing of three-dimensional point clouds, thus reducing the computational load. It can improve the detection efficiency and autonomous detection capability of metal cold spraying repair systems. Attached Figure Description
[0036] Figure 1 This is a flowchart of a three-dimensional contour detection method for damaged areas of a metal workpiece provided in an embodiment of this application;
[0037] Figure 2 This is a schematic diagram of generating a two-dimensional grayscale image from the three-dimensional point cloud data of the damaged area in an embodiment of this application;
[0038] Figure 3This is a schematic diagram of two-dimensional image boundary extraction in an embodiment of this application;
[0039] Figure 4 This is a schematic diagram of the three-dimensional contour of the damaged region reconstructed from the two-dimensional boundary in an embodiment of this application. Detailed Implementation
[0040] The invention will now be further described with reference to the accompanying drawings.
[0041] This application provides a method for detecting the three-dimensional contour of a damaged area on a metal workpiece, applicable to cold spraying repair of metal.
[0042] The detection method first acquires local three-dimensional point cloud data of the damaged area of the metal workpiece. After correcting the three-dimensional point cloud data using the least squares method, a two-dimensional grayscale image of the local surface of the damaged area is generated using the K-nearest neighbor algorithm. Then, based on the generated two-dimensional grayscale image, the two-dimensional pixel coordinates of the boundary of the damaged area are extracted using Gaussian filtering and Moore's neighborhood tracking algorithms. Finally, the three-dimensional coordinates of the damaged area contour are reconstructed based on the extracted boundary two-dimensional pixel coordinates and the corresponding grayscale values.
[0043] The following section, in conjunction with the accompanying drawings, provides a detailed description of the three-dimensional contour detection method for the damaged area of the metal workpiece.
[0044] like Figure 1 The diagram shown is a flowchart of a three-dimensional contour detection method for a damaged area of a metal workpiece provided in an embodiment of this application. The three-dimensional contour detection method specifically includes the following steps.
[0045] (1) Acquire and correct the three-dimensional point cloud data of the damaged area of the metal workpiece;
[0046] (1-1) The local surface of the damaged area of the metal workpiece is scanned by a 3D high-precision line laser scanning device to obtain the three-dimensional point cloud data of the damaged area of the metal workpiece.
[0047] (1-2) The three-dimensional point cloud data of the damaged area of the metal workpiece is corrected using the least squares method, including:
[0048] (a) Fit a plane to the local surface point cloud data of the damaged area of the metal workpiece using the least squares method:
[0049] Establish a point-normal plane equation: z = ax + by + c
[0050] The point cloud data of the local surface where the damaged area is located is obtained, and the values of coefficients a, b, and c in the point normal plane equation are estimated by the least squares method, thereby obtaining the point normal plane equation of the fitted plane.
[0051] (b) Calculate the rotation matrix R to rotate the fitted plane to be parallel to the XY plane in the point cloud coordinate system:
[0052] Specifically, this involves calculating the unit normal vector of the fitted plane. The rotation matrix between [0,0,-1] is taken as the rotation matrix R of the plane, where
[0053]
[0054] This rotation matrix R is around the vector P = [x] P y P , z P A rotation matrix that rotates counterclockwise by an angle θ.
[0055] (c) The local point cloud data where the damaged area is located is rigidly rotated using the rotation matrix R, so that the surface where the damaged area is located in the three-dimensional point cloud data is parallel to the XY plane in the point cloud coordinate system.
[0056] (2) The corrected three-dimensional point cloud data is processed by the K-nearest neighbor algorithm to generate a two-dimensional grayscale image of the local surface where the damaged area is located.
[0057] In this embodiment, the parameter k is set to 1 in the K-nearest neighbor algorithm, and the k-dimensional tree algorithm is used as the nearest neighbor search method.
[0058] This step (2) specifically includes:
[0059] (2-1) Initially generate a grayscale image with dimensions h*w, and set the initial grayscale value of each pixel to 1;
[0060] (2-2) Based on the XY coordinates of the point cloud on the surface where the damaged area of the corrected 3D point cloud data is located, construct the point cloud XY coordinates corresponding to each pixel coordinate in the h*w dimension grayscale image, which is simply referred to as the grayscale image XY coordinates.
[0061] (2-3) Using the K-nearest neighbor algorithm, find the grayscale XY coordinates that are closest to the XY coordinates of each data point in the point cloud on the surface where the damaged area is located (note that h*w is less than the number of data points in the point cloud).
[0062] (2-4) Calculate the average of the Z coordinates of all the closest point cloud data points corresponding to the XY coordinates of each grayscale image, and use it as the Z coordinate information of the corresponding grayscale image XY coordinates;
[0063] (2-5) Based on the Z coordinate information of the corresponding XY coordinates of the grayscale image, normalize it to the grayscale value of each pixel in the grayscale image, with the value range being [0, 1].
[0064] like Figure 2The diagram shown is a schematic diagram of generating a two-dimensional grayscale image from the three-dimensional point cloud data of the damaged area in an embodiment of this application. The acquired point cloud data is fitted to a plane by the least squares method and then corrected. The two-dimensional grayscale image of the local surface where the damaged area is located is then generated by the K-nearest neighbor algorithm, thus avoiding tangential distortion of the generated image.
[0065] (3) Use a two-dimensional Gaussian filter to denoise the two-dimensional grayscale image and convert it into a binary image by setting a grayscale threshold;
[0066] (4) The binary image is processed by the Moore neighborhood tracking algorithm to extract the two-dimensional pixel coordinates of the boundary of the damaged area;
[0067] like Figure 3 The diagram shown is a schematic diagram of two-dimensional boundary detection of two-dimensional image in an embodiment of this application. The Moore neighborhood tracking algorithm extracts the two-dimensional pixel coordinates of the boundary of the damaged area. Compared with three-dimensional point cloud processing, two-dimensional image processing can effectively reduce the computational load.
[0068] (5) Based on the two-dimensional pixel coordinates and corresponding gray values of the damaged area boundary, the three-dimensional contour coordinates of the damaged area are reconstructed.
[0069] Step (5) is the inverse process of the K-nearest neighbor algorithm generating a two-dimensional grayscale image of the local surface where the damaged region is located, specifically including:
[0070] (5-1) Match the Z coordinate information of the corresponding XY coordinates of the grayscale image obtained in step (2-4) with the pixel coordinates of the grayscale image.
[0071] (5-2) Based on the two-dimensional pixel coordinates of the boundary of the damaged area obtained in step (4), query the corresponding (X,Y,Z) coordinate information.
[0072] like Figure 4 The diagram shown is a schematic representation of the three-dimensional contour of the damaged region reconstructed from a two-dimensional boundary in an embodiment of this application.
[0073] This invention eliminates the need for computer-aided design models and prior knowledge that would damage the workpiece, and avoids direct processing of three-dimensional point clouds, thereby reducing the computational load and improving the autonomy of metal cold spraying repair systems.
Claims
1. A method for detecting the three-dimensional contour of a damaged area on a metal workpiece, characterized in that, include: (1) Acquire and correct the three-dimensional point cloud data of the damaged area of the metal workpiece; (2) The corrected three-dimensional point cloud data is processed by the K-nearest neighbor algorithm to generate a two-dimensional grayscale image of the local surface where the damaged area is located; (3) Denoise the two-dimensional grayscale image and then convert it into a binary image by setting a grayscale threshold; (4) The binary image is processed by the Moore neighborhood tracking algorithm to extract the two-dimensional pixel coordinates of the boundary of the damaged area; (5) Based on the two-dimensional pixel coordinates and corresponding gray values of the damaged area boundary, the three-dimensional contour coordinates of the damaged area are reconstructed. In step (1), the three-dimensional point cloud data of the damaged area of the metal workpiece is corrected using the least squares method, including: The point cloud data of the local surface of the damaged area of the metal workpiece is fitted to a plane using the least squares method. Establish a point-normal plane equation: ; The coefficients in the point normal plane equation of the acquired local surface point cloud data of the damaged area are estimated using the least squares method. , , The value of is obtained, thus yielding the point-normal plane equation of the fitted plane; Calculate the rotation matrix R to rotate the fitted plane to be parallel to the XY plane in the point cloud coordinate system: Calculate the unit normal vector of the fitted plane. The rotation matrix between [0,0,-1] is taken as the rotation matrix R of the plane, where ; ; This rotation matrix For the vector Rotate counterclockwise Angle rotation matrix; The local point cloud data containing the damaged area is rigidly rotated using a rotation matrix R, so that the surface of the damaged area in the 3D point cloud data is parallel to the XY plane in the point cloud coordinate system.
2. The method for three-dimensional contour detection of damaged areas in metal workpieces according to claim 1, characterized in that, In step (1), the local surface of the damaged area of the metal workpiece is scanned by a 3D high-precision line laser scanning device to obtain the three-dimensional point cloud data of the damaged area of the metal workpiece.
3. The method for three-dimensional contour detection of damaged areas in metal workpieces according to claim 1, characterized in that, In the K-Nearest Neighbors algorithm, the parameter k is set to 1, and the k-dimensional tree algorithm is used as the method for nearest neighbor search.
4. The method for three-dimensional contour detection of damaged areas in metal workpieces according to claim 1 or 3, characterized in that, In step (2), the corrected 3D point cloud data is processed using the K-nearest neighbor algorithm to generate a 2D grayscale image of the local surface where the damaged area is located, including: Initially generate one A grayscale image of dimension 1, with each pixel's initial grayscale value set to 1; Based on the XY coordinates of the point cloud on the surface where the damaged area is located in the corrected 3D point cloud data, construct... The point cloud XY coordinates corresponding to the coordinates of each pixel in a grayscale image are simply referred to as the grayscale image XY coordinates. The K-nearest neighbor algorithm is used to find the grayscale XY coordinates that are closest to the XY coordinates of each data point in the point cloud of the surface where the damaged area is located. Calculate the average of the Z coordinates of all the closest point cloud data points corresponding to the XY coordinates of each grayscale image, and use this average as the Z coordinate information of the corresponding grayscale image XY coordinates; Based on the Z coordinate information of the corresponding XY coordinates of the grayscale image, it is normalized to the grayscale value of each pixel in the grayscale image, with the value range being [0, 1].
5. The method for three-dimensional contour detection of damaged areas in metal workpieces according to claim 1, characterized in that, In step (3), a two-dimensional Gaussian filter is used to denoise the two-dimensional grayscale image.
6. The method for three-dimensional contour detection of damaged areas in metal workpieces according to claim 4, characterized in that, In step (5), the three-dimensional contour coordinates of the damaged area are reconstructed based on the two-dimensional pixel coordinates and corresponding gray values of the damaged area boundary, including: The Z coordinate information of the corresponding grayscale image XY coordinates is mapped to the pixel coordinates of the grayscale image; Based on the two-dimensional pixel coordinates of the damaged area boundary, the corresponding (X,Y,Z) coordinate information can be retrieved.
7. A metal cold spray repair application, characterized in that, The method for three-dimensional contour detection of damaged areas of metal workpieces according to any one of claims 1 to 6 is adopted.
Citation Information
Patent Citations
Profile tolerance measuring method and measuring system based on 3D scanning
CN115790440A
Crack detection method fusing three-dimensional point cloud and two-dimensional image
CN115861274A