A welding position recognition method based on point cloud projection skeletonization
By using a point cloud projection skeletonization method based on Z-coordinate mode and connected component analysis, the efficiency and stability problems of welding position recognition for vertically assembled workpieces in the prior art are solved, achieving efficient and robust weld recognition that is adaptable to workpieces with different placement postures.
Patent Information
- Application Number
- CN202611262942.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-27
AI Technical Summary
Existing welding position recognition methods based on 3D point clouds cannot meet the requirements for efficient and stable recognition of vertically assembled workpieces. They are easily affected by abnormal points, are computationally complex, and lack versatility.
The equation of the workpiece bottom surface is determined by analyzing the mode of the Z-coordinate and the connected component. After normalizing the posture and rotating, the point cloud is cropped and a two-dimensional projection image is generated. Binarization and thinning are then performed. Combined with line detection and maximum suppression, vertical and horizontal weld seams are identified and restored to the original coordinate system through inverse transformation.
Even with partial point cloud defects or noise interference, this method achieves efficient, universal, and robust automatic identification of welding positions for vertically assembled workpieces, stably extracts weld seam positions, reduces dependence on point cloud integrity, and improves the accuracy and speed of identification.
Smart Images

Figure CN123181564A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated welding technology, specifically to a welding position recognition method based on point cloud projection skeletonization. Background Technology
[0002] With the continuous improvement of industrial automation, welding robots are widely used in steel structure manufacturing, shipbuilding, automobile production and other fields. In actual welding operations, automatic identification of the welding position on the workpiece is a key prerequisite for realizing autonomous welding by robots. In recent years, 3D point cloud technology has been introduced into the field of welding position identification because it can accurately describe the 3D geometry of the workpiece.
[0003] Existing welding position recognition methods based on 3D point clouds mostly employ RANSAC plane fitting, deep learning semantic segmentation, normal vector gradient extraction, or direct plane intersection. These methods suffer from drawbacks such as susceptibility to outlier interference, high requirements for point cloud integrity, computational complexity, and insufficient versatility, failing to meet the requirements for efficient and stable recognition of vertically assembled workpieces. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a welding position recognition method based on point cloud projection skeletonization, which solves the problem that existing welding position recognition methods cannot meet the requirements for efficient and stable recognition of vertically assembled workpieces.
[0005] To achieve the above objectives, the present invention provides a welding position recognition method based on point cloud projection skeletonization, comprising the following steps:
[0006] The original point cloud data of the workpiece surface is acquired and downsampled to obtain the downsampled point cloud. Based on the mode and connected component analysis of the Z coordinate in the downsampled point cloud, the plane equation of the bottom surface of the workpiece is determined.
[0007] The downsampled point cloud is rotated according to the bottom surface equation to make the bottom surface parallel to the horizontal plane, thus obtaining the rotated point cloud.
[0008] Using a plane parallel to the bottom surface and located at a predetermined height above the bottom surface as the dividing plane, the rotated point cloud is trimmed, retaining a subset of the point cloud on the side furthest from the bottom surface;
[0009] The point cloud subset is projected onto a horizontal plane to generate a two-dimensional projected image;
[0010] The two-dimensional projection image is binarized and thinned to obtain a skeleton image;
[0011] Line detection is performed on the skeleton image, and maximum suppression is applied to the detected lines to obtain a set of candidate lines;
[0012] Based on the angle between pairs of lines in the candidate line set and the existence of steel along the corresponding direction at the intersection point, vertical welds are identified.
[0013] Extract the closed contour boundaries from the skeleton image to identify horizontal welds;
[0014] The identified vertical and horizontal welds are mapped back to the original camera coordinate system through an inverse rotation transformation to obtain the actual welding positions.
[0015] By adopting the above technical solution, the bottom equation is determined based on the mode of the Z-coordinate and connected component analysis, and attitude normalization rotation is implemented. After generating a two-dimensional image by combining point cloud projection, binarization thinning, line detection, and maximum suppression are performed to identify vertical and horizontal weld seams. Finally, the image is restored to the original coordinate system through inverse transformation. This allows for stable extraction of weld seam positions even when there are local missing points or noise interference in the point cloud. At the same time, it avoids dependence on deep learning or complex plane fitting, and achieves efficient, universal, and robust automatic identification of welding positions for vertically assembled workpieces. This solves the problem that existing welding position identification methods cannot meet the requirements for efficient and stable identification of vertically assembled workpieces.
[0016] Preferably, determining the plane equation of the bottom surface of the workpiece includes:
[0017] The original point cloud data of the workpiece surface is acquired and downsampled to obtain the downsampled point cloud;
[0018] The frequency of the Z-coordinate of all points in the downsampled point cloud is counted, and the value with the highest frequency is taken as the mode of the Z-coordinate.
[0019] Points whose Z-coordinates fall within the range of the mode plus or minus a preset thickness are selected as candidate bottom points;
[0020] Project the candidate bottom points onto the XY plane, perform connected component analysis, and retain the point set corresponding to the connected component with the largest area;
[0021] Calculate the average Z-coordinate of all points in the retained point set as the reference height of the bottom surface;
[0022] The equation of the bottom surface is determined to be Z, which is equal to the reference height of the bottom surface.
[0023] Preferably, obtaining the rotated point cloud includes:
[0024] Calculate the normal vector of the bottom surface;
[0025] The downsampled point cloud is rotated around the X-axis by a first angle, so that the Y component of the normal vector after rotation is zero. The first angle is determined by the ratio of the Y component to the Z component of the normal vector.
[0026] The point cloud, after being rotated around the X-axis, is rotated around the Y-axis by a second angle so that the X component of the normal vector after the rotation is zero. The second angle is determined by the ratio of the X component to the Z component of the normal vector after the first rotation.
[0027] Applying a composite rotation matrix of two rotations to the downsampled point cloud yields a rotated point cloud with its bottom surface parallel to the XY plane.
[0028] Preferably, retaining the subset of point clouds on the side furthest from the bottom surface includes:
[0029] A plane parallel to the bottom surface and at a preset height from the bottom surface is used as the dividing surface;
[0030] Points located on the side of the segmentation plane closer to the bottom surface in the rotated point cloud are removed, and points located on the side of the segmentation plane farther from the bottom surface are retained to form a subset of the point cloud.
[0031] Preferably, generating the two-dimensional projection image includes:
[0032] Determine the minimum and maximum values of the X-coordinate and the minimum and maximum values of the Y-coordinate in the point cloud subset;
[0033] Construct a 2D image with a width equal to the floor of the difference between the maximum and minimum values of the X coordinate and a height equal to the floor of the difference between the maximum and minimum values of the Y coordinate, and initialize all pixels to zero;
[0034] For each point in the point cloud subset, calculate the floor and floor of the difference between the X coordinate and the minimum X coordinate, and the floor and floor of the difference between the Y coordinate and the minimum Y coordinate, and combine them to obtain the pixel coordinates.
[0035] At each pixel coordinate position in the two-dimensional image, the pixel value is increased by one unit.
[0036] Preferably, obtaining the skeleton image includes:
[0037] In the two-dimensional projection image, pixels with pixel values greater than a preset binarization threshold are set to the first value, and the remaining pixels are set to the second value to obtain a binary image.
[0038] A thinning algorithm is applied to the binary image to reduce the width of the lines in the image to one pixel while maintaining the connectivity and overall shape of the lines, resulting in a skeleton image.
[0039] Preferably, obtaining the candidate line set includes:
[0040] Hough transform is used to detect straight lines in the skeleton image, and the number of pixels covered by each straight line is calculated, where coverage refers to the distance from a pixel to the straight line being less than the distance resolution.
[0041] Iterate through all line pairs. When the angle difference between two lines is less than a preset angle difference threshold and the distance difference between two lines is less than a preset distance threshold, compare the number of pixels covered by the two lines. If the number of pixels covered by the first line is greater than that of the second line, keep the first line and delete the second line; otherwise, keep the second line and delete the first line. Repeat until there are no redundant line pairs.
[0042] Preferably, the identification of vertical welds includes:
[0043] Iterate through each pair of lines in the candidate line set and calculate the angle between the two lines;
[0044] When the included angle is within a preset degree range, calculate the intersection point of the two lines;
[0045] From the intersection point, search outwards along the corresponding direction of the image at a preset distance, and sum the pixel values on the search path in each direction;
[0046] If the sum of pixel values along the search path is greater than a preset threshold, then steel is present in that direction.
[0047] If there are two directions with an angle less than a preset degree and the line segment between the steel areas corresponding to these two directions is located on the straight line pair, then the line segment is identified as a vertical weld.
[0048] Preferably, the identification of horizontal welds includes:
[0049] Perform a contour tracking algorithm on the skeleton image to extract all closed boundary trajectories;
[0050] Filter out boundary trajectories whose trajectory length is greater than a preset length threshold and whose overall trajectory direction is less than a preset angle deviation from the horizontal direction;
[0051] The selected boundary trajectories are identified as horizontal welds.
[0052] Preferably, obtaining the actual welding position includes:
[0053] Obtain the composite rotation matrix used in the attitude normalization rotation;
[0054] Calculate the inverse of the composite rotation matrix;
[0055] The coordinates of the identified vertical and horizontal welds in the rotated coordinate system are transformed by the inverse matrix to obtain the three-dimensional spatial coordinates in the original camera coordinate system.
[0056] This invention provides a welding position recognition method based on point cloud projection skeletonization. It has the following beneficial effects:
[0057] 1. This invention determines the bottom surface equation based on the mode of the Z-coordinate and connected component analysis, and performs attitude normalization rotation. After generating a two-dimensional image by combining point cloud projection, it performs binarization thinning, line detection, and maximum suppression to identify vertical and horizontal weld seams. Finally, it restores the original coordinate system through inverse transformation. Thus, it can stably extract the weld seam position even when there are local missing points or noise interference in the point cloud. At the same time, it avoids dependence on deep learning or complex plane fitting, and realizes efficient, universal, and robust automatic identification of welding positions for vertically assembled workpieces. It solves the problem that existing welding position identification methods cannot meet the requirements of efficient and stable identification of vertically assembled workpieces.
[0058] 2. This invention generates a projected image by projecting a three-dimensional point cloud onto a two-dimensional plane and obtains a skeleton image with a single pixel width using a thinning algorithm. This reduces the dependence of welding position recognition on the integrity of the point cloud. Even if the side point cloud of the vertical steel plate has local missing parts due to occlusion or scanning angle issues, the lines representing the weld in the projected image can still remain continuous, thus ensuring the stability of the recognition process.
[0059] 3. This invention uses a method based on the mode of Z-coordinates and connected component analysis to determine the bottom surface of the workpiece. It abandons the complex methods of traditional RANSAC plane fitting, least squares fitting, or deep learning semantic segmentation. It is simple to calculate, requires no iteration, and has a strong ability to suppress noise and outliers. It significantly reduces the computational cost while ensuring the accuracy of bottom surface recognition. By performing Hough line detection on the skeleton image and supplementing it with maximum suppression, it can select the most representative line pairs from the redundant line candidate set. Then, it combines the existence judgment of steel in four directions at the intersection point to confirm the vertical weld. It eliminates false line intersections caused by non-weld structures or image noise, thus improving the accuracy and reliability of vertical weld recognition.
[0060] 4. This invention employs a contour boundary extraction method for horizontal welds, directly utilizing the closed continuous trajectory in the refined image as the horizontal weld, eliminating the need for additional straight-line fitting or intersection calculation. The process is simple and efficient, enabling rapid location of the intersection between the vertical steel plate and the bottom surface, further improving the overall recognition speed. Furthermore, by using posture normalization rotation, the point cloud is adjusted to a standard posture where the bottom surface is parallel to the horizontal plane. After recognition, the weld coordinates are mapped back to the original camera coordinate system through inverse transformation, eliminating the influence of workpiece tilt on the recognition results. This allows the method to adapt to workpieces with different placement postures, enhancing its versatility and engineering applicability. Attached Figure Description
[0061] Figure 1 This is a flowchart of a welding position recognition method based on point cloud projection skeletonization proposed in this invention;
[0062] Figure 2This is an architecture diagram of a welding position recognition system based on point cloud projection skeletonization proposed in an embodiment of the present invention;
[0063] Figure 3 This is a flowchart of the bottom surface determination steps proposed in an embodiment of the present invention;
[0064] Figure 4 This is a flowchart illustrating the steps for generating a two-dimensional projection image from a point cloud projection according to an embodiment of the present invention.
[0065] Figure 5 This is a flowchart of the horizontal weld identification steps proposed in an embodiment of the present invention. Detailed Implementation
[0066] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0067] Example 1:
[0068] In the first embodiment of the present invention, the present invention provides a welding position recognition method based on point cloud projection skeletonization, such as... Figure 1 As shown, it includes the following steps:
[0069] Please see the appendix Figure 3 The original point cloud data of the workpiece surface is acquired and downsampled to obtain the downsampled point cloud. Based on the mode and connected component analysis of the Z coordinate in the downsampled point cloud, the plane equation of the bottom surface of the workpiece is determined.
[0070] Furthermore, determining the plane equation of the workpiece's bottom surface includes:
[0071] The original point cloud data of the workpiece surface is acquired and downsampled to obtain the downsampled point cloud;
[0072] The frequency of the Z-coordinate of all points in the downsampled point cloud is counted, and the value with the highest frequency is taken as the mode of the Z-coordinate.
[0073] Points whose Z-coordinates fall within the range of the mode plus or minus a preset thickness are selected as candidate bottom points;
[0074] Project the candidate bottom points onto the XY plane, perform connected component analysis, and retain the point set corresponding to the connected component with the largest area;
[0075] Calculate the average Z-coordinate of all points in the retained point set as the reference height of the bottom surface;
[0076] The equation of the bottom surface is determined to be Z, which is equal to the base reference height.
[0077] Specifically, after acquiring the downsampled point cloud, in order to eliminate the influence of the workbench plane tilt and stray points and establish a unified geometric benchmark, it is necessary to accurately extract the bottom surface spatial equation of the workpiece. This step achieves robust identification and parameterized expression of the bottom surface by statistically analyzing the distribution characteristics of the Z coordinate of the point cloud and combining it with connected component analysis.
[0078] In this embodiment, the downsampled point cloud set is denoted as ,in As a point index, the workpiece is placed horizontally on the worktable or has a horizontal bottom surface, therefore the point cloud on the bottom surface exhibits the densest distribution in the Z-axis direction. Specifically, firstly, statistics are performed... The Z-coordinate frequency distribution of all points is used to determine the most frequent value as the mode of the Z-coordinate. ,Right now: ,in This is an indicator function; it takes the value 1 if the condition within the parentheses is true, and 0 otherwise. The mode represents the total number of points in the point cloud after downsampling, and it corresponds to the approximate height of the bottom surface of the workpiece.
[0079] Select the Z coordinate located in the interval All points within the area are considered as the candidate base point set. ,in To accommodate thickness tolerance, in this embodiment Preferably 0.5 mm. Projecting onto the XY plane yields a two-dimensional point set. Perform 4-connected or 8-connected region analysis on this plane to identify all connected regions and calculate the number of projected points contained in each connected region. Retain the original 3D point set corresponding to the connected region with the largest number of points. This step can effectively eliminate isolated splash points or noise points located at other heights.
[0080] Then calculate The arithmetic mean of the Z-coordinates of all points is recorded as the base reference height. : ,in Represents a point set The total number of midpoints. Ultimately, the plane equation of the workpiece's bottom surface is directly determined as a horizontal plane: This equation serves as the reference surface for subsequent point cloud attitude normalization rotation. If the worktable surface is slightly tilted, the average bottom height obtained in this way can still stably represent the overall bottom plane, thus providing a reliable input for the calculation of the rotation matrix.
[0081] The downsampled point cloud is rotated according to the bottom plane equation to make the bottom plane parallel to the horizontal plane, thus obtaining the rotated point cloud.
[0082] Furthermore, the rotated point cloud is obtained, including:
[0083] Calculate the normal vector of the bottom surface;
[0084] The downsampled point cloud is rotated around the X-axis by a first angle so that the Y component of the normal vector is zero after rotation. The first angle is determined by the ratio of the Y component to the Z component of the normal vector.
[0085] The point cloud, after being rotated around the X-axis, is rotated around the Y-axis by a second angle, so that the X component of the normal vector after the rotation is zero. The second angle is determined by the ratio of the X component to the Z component of the normal vector after the first rotation.
[0086] Applying a composite rotation matrix of two rotations to the downsampled point cloud yields a rotated point cloud with its bottom surface parallel to the XY plane.
[0087] Specifically, after determining the bottom surface equation, in order to prevent the point cloud from being affected by the initial placement posture of the workpiece during subsequent projection and image processing, the entire point cloud needs to be rotated to a standard posture where the bottom surface is parallel to the horizontal plane. This step achieves the normalization of the point cloud posture by analyzing the bottom surface normal vector and performing two rotations around the X-axis and Y-axis in sequence.
[0088] In this embodiment, the known equation of the base surface is: The normal vector of the plane is However, due to workpiece tilt or scanning angle deviation, the bottom surface normal vector obtained from the actual acquired bottom surface point cloud is usually not strictly perpendicular to the XY plane. Therefore, it is necessary to first calculate the bottom surface point set in the downsampled point cloud. The normal vector. Generally, principal component analysis is used to... Perform plane fitting to obtain the normal vector. ,in These are the components of the normal vector in the X, Y, and Z directions, respectively.
[0089] To ensure that the normal vector of the rotated base is parallel to the Z-axis, the rotation is performed in two steps; the first step is to rotate the point cloud around the X-axis by a first angle. This makes the Y component of the normal vector zero after rotation. Rotation angle Determined by the following formula: ,in and These are the Y and Z components of the original normal vector. The rotation matrix corresponding to this rotation operation is: After the first rotation, the normal vector is updated to The second step is to rotate the point cloud around the Y-axis by a second angle. This makes the X component of the normal vector zero after rotation, and the rotation angle is... Determined by the following formula: ,in and The X and Z components of the normal vector after the first rotation are given by the following rotation matrix: Finally, the composite rotation matrix is Apply the composite rotation matrix to the downsampled point cloud. For each point in the array, obtain the rotated point cloud. : At this point, the bottom surface is parallel to the XY plane.
[0090] If the normal vector Approaching zero, the point cloud angle can be pre-corrected. In this embodiment, and The calculation uses the standard arctangent function, with a range of values of . After the above rotation, subsequent processing such as cutting and projection can be carried out under a unified horizontal reference, effectively eliminating the impact of workpiece tilt on weld recognition accuracy.
[0091] Using a plane parallel to the bottom surface and located at a preset height above the bottom surface as the dividing plane, the point cloud is cropped and rotated, retaining the subset of the point cloud on the side furthest from the bottom surface;
[0092] Furthermore, the subset of point cloud furthest from the bottom surface is preserved, including:
[0093] A plane parallel to the bottom surface and at a preset height from the bottom surface is used as the dividing surface;
[0094] Points located on the side of the segmentation plane closer to the bottom surface in the rotated point cloud are removed, and points located on the side of the segmentation plane farther from the bottom surface are retained to form a subset of the point cloud.
[0095] Specifically, after completing the point cloud pose normalization rotation, the bottom surface is parallel to the horizontal plane. In order to reduce interference information in the subsequent projected image and focus on the vertical area where the weld is located, redundant point clouds located near the bottom surface need to be removed, and only the part far away from the bottom surface needs to be retained.
[0096] In this embodiment, let the equation of the bottom surface be... = Parallel to the bottom surface and at a predetermined height from the bottom surface The plane is used as the dividing plane. The equation of this dividing plane is expressed as: ,in This is the preset height value. Under normal circumstances... It should be less than the minimum height of the vertical workpiece to avoid accidentally removing the vertical weld area. Preferably 10 mm, rotated to form point clouds any point in If its Z-coordinate satisfies: If the point is located on the side of the dividing plane closer to the bottom, it is determined that the point is removed; otherwise, if the following conditions are met: If a point is selected, that point is retained. Ultimately, all retained points form a subset of the point cloud. ,Right now: .
[0097] If the workpiece has local bulges or measurement noise, it can be adjusted accordingly. Fine-tuning was performed to ensure that the side point cloud of the vertical steel plate was still completely preserved after cutting. The value range is from 5 mm to 20 mm; through the above clipping, the point cloud subset... It only includes points located at a sufficient height above the bottom surface, thereby eliminating the interference of the flat area of the bottom surface on subsequent projection and image processing, so that the projected image can more clearly reflect the geometric contours of the vertical and horizontal welds.
[0098] Please see the appendix Figure 4 A subset of the point cloud is projected onto a horizontal plane to generate a two-dimensional projected image.
[0099] Furthermore, generating a two-dimensional projection image includes:
[0100] Determine the minimum and maximum values of the X-coordinate and the Y-coordinate in the point cloud subset;
[0101] Construct a 2D image with a width equal to the floor of the difference between the maximum and minimum values of the X coordinate and a height equal to the floor of the difference between the maximum and minimum values of the Y coordinate, and initialize all pixels to zero;
[0102] For each point in the point cloud subset, calculate the floor and floor of the difference between the X coordinate and the minimum X coordinate, and the floor and floor of the difference between the Y coordinate and the minimum Y coordinate, and combine them to obtain the pixel coordinates.
[0103] Increment the pixel value by one unit at each pixel coordinate position in the 2D image.
[0104] Specifically, after point cloud cropping, a subset of point cloud containing only vertical regions is obtained. In order to identify weld seams using mature two-dimensional image processing algorithms, this three-dimensional point cloud subset needs to be projected onto a horizontal plane to generate a two-dimensional image reflecting the distribution density of the point cloud.
[0105] In this embodiment, a subset of point clouds is defined. The minimum X-coordinate of all points is The maximum value is The minimum value of the Y-coordinate is The maximum value is First, construct a picture with a width of Height is Two-dimensional image ,in: ; This represents the floor function, ensuring the image covers the entire point cloud. All pixels in the image are initialized to zero.
[0106] for any point in ( , Map its coordinates to the image pixel coordinate system. First, calculate the relative offset: Then take respectively and Rounding down and rounding up yields a combination of four pixel coordinates:
[0107] ;
[0108] ;
[0109] ;
[0110] ;
[0111] in This represents the floor function. This represents the floor function. (In the image...) At these four pixel locations, the pixel value is increased by one unit. This process is equivalent to accumulating each three-dimensional point into the two-dimensional image with sub-pixel precision to form a density distribution map.
[0112] Since multiple points may fall into the same pixel region during the projection process, the pixel value in the final image, obtained through the above accumulation operation, reflects the number of points at that location. If the point cloud density is extremely high, the accumulated pixel values can be normalized to facilitate subsequent binarization operations. The two-dimensional projected image generated through this step... This method preserves the geometric distribution features of the original point cloud and provides efficient image input for subsequent thinning and line detection.
[0113] The two-dimensional projection image is binarized and thinned to obtain the skeleton image;
[0114] Further, a skeleton image is obtained, including:
[0115] In a two-dimensional projection image, pixels with values greater than a preset binarization threshold are set to the first value, and the remaining pixels are set to the second value to obtain a binary image.
[0116] A thinning algorithm is applied to the binary image to reduce the width of the lines in the image to one pixel while maintaining the connectivity and overall shape of the lines, resulting in a skeleton image.
[0117] Specifically, after obtaining the two-dimensional projection image, the pixel values in the image reflect the distribution density of the point cloud on the horizontal plane. In order to extract the geometric skeleton of the weld and facilitate subsequent line detection, the projection image needs to be converted into a binary image and further refined into lines with a single pixel width.
[0118] In this embodiment, the two-dimensional projected image is set as follows: Its pixel value Representing coordinates The point cloud accumulation count at a given location is first evaluated by performing a binarization operation: a preset binarization threshold is introduced. For each pixel in the image, if its pixel value is greater than Then set the pixel to the first value. Otherwise, set it to the second value. The binarization process can be represented as: , A value of 0 indicates that the presence of at least one point cloud projection is considered as foreground. In this embodiment, The preferred value is 255. The optimal value is 0, thus obtaining a standard binary image. .
[0119] In a binary image, the foreground region corresponds to a dense weld seam area in the point cloud, but lines often have a certain width. To improve the accuracy of line detection, it is necessary to... The thinning algorithm employed is the classic Zhang-Suen parallel thinning algorithm. This algorithm iteratively removes boundary pixels that meet specific conditions while preserving the connectivity of the lines, ultimately reducing the line width to a single pixel. The thinned image is denoted as the skeleton image. .
[0120] In some embodiments, the thinning algorithm may also employ a morphological skeleton extraction method. After this step, the thick lines in the original projected image are transformed into a single-pixel-wide topological skeleton, which greatly simplifies the complexity of subsequent line detection and enables the center line of the weld to be accurately presented.
[0121] Line detection is performed on the skeleton image, and maximum suppression is applied to the detected lines to obtain a set of candidate lines;
[0122] Furthermore, the candidate line set is obtained, including:
[0123] Hough transform is used to detect straight lines in skeleton images. The number of pixels covered by each straight line is calculated. Coverage means that the distance from a pixel to the straight line is less than the distance resolution.
[0124] Iterate through all line pairs. When the angle difference between two lines is less than a preset angle difference threshold and the distance difference between two lines is less than a preset distance threshold, compare the number of pixels covered by the two lines. If the number of pixels covered by the first line is greater than that of the second line, keep the first line and delete the second line; otherwise, keep the second line and delete the first line. Repeat until there are no redundant line pairs.
[0125] Specifically, after obtaining the skeleton image, it is necessary to extract the straight line features representing the edge of the vertical steel plate. Since there are a large number of redundant lines that are approximately overlapping in the lines detected by the Hough transform, the most representative candidate line set must be selected through maximum suppression.
[0126] In this embodiment, the skeleton image is denoted as... Its dimensions are width With height First, a standard Hough transform is used for line detection. The Hough transform maps each foreground pixel in the image space to a parameter space, where the parameter space is defined by distance. and angle Using coordinates, for each foreground pixel in the skeleton image It corresponds to a sine curve in the parameter space: ,in This represents the perpendicular distance from the origin to the line. This represents the angle between the normal to the straight line and the horizontal axis. In this embodiment, the distance resolution is set. Pixels, angular resolution radians, accumulator threshold Values That is, one-sixth of the smaller side length of the image, voting on the parameter space, the parameter pair corresponding to the peak value. This represents a detected straight line.
[0127] In general, the Hough transform outputs a set of straight lines. There are many redundant lines with geometric approximations. Therefore, maximum suppression needs to be performed. Specifically, for the line `lili`, the number of pixels it covers is defined as: ,in This represents the Euclidean distance from a pixel to the line. Pixels represent distance resolution, while coverage reflects how closely the line matches the actual skeleton.
[0128] The preset angle difference threshold is The preset distance difference threshold is Pixels. Traverse all line pairs. If the following conditions are met: Then compare the number of points covered by the two lines: if Then keep And delete Otherwise, keep And delete Repeat the above process until there are no redundant line pairs, and finally obtain the candidate line set. After this suppression process, geometrically similar repeating lines are eliminated, and only representative lines that best match the skeleton are retained, providing reliable input for the accurate solution of subsequent vertical welds.
[0129] Vertical welds are identified based on the angle between pairs of lines in the candidate line set and the existence of steel along the corresponding direction at the intersection point.
[0130] Furthermore, identifying vertical welds includes:
[0131] Iterate through each pair of lines in the candidate line set and calculate the angle between the two lines;
[0132] When the included angle is within a preset range, calculate the intersection of the two lines;
[0133] Search outwards from the intersection point along the corresponding direction of the image at a preset distance, and sum the pixel values on the search path in each direction;
[0134] If the sum of pixel values along the search path is greater than a preset threshold, then steel is present in that direction.
[0135] If there are two directions with an angle less than a preset degree and the line segment between the steel areas corresponding to these two directions is located on a straight line, then the line segment is identified as a vertical weld.
[0136] Specifically, after obtaining the candidate line set, it is necessary to identify the true vertical weld from the geometric relationship of the lines. The vertical weld corresponds to the edge line where two vertical steel plates intersect. In the projection image, it is represented by two approximately perpendicular lines, and there should be a steel area around the intersection point along a specific direction.
[0137] In this embodiment, the candidate line set is denoted as Each straight line With normal direction angle Distance from the origin to the line First, iterate through all pairs of lines. Calculate the angle between the two lines. The formula for calculating the included angle is: ,in and These are the direction angles of the two lines, in degrees. When the included angle... When the angle is within a preset range, it is considered that the two straight lines may constitute the boundary of the vertical weld. In this embodiment, the preset included angle range is preferably 75 degrees to 105 degrees.
[0138] For a pair of lines that satisfy the included angle condition, calculate the intersection point of the two lines. The intersection point can be found by solving a system of equations for all lines. After obtaining the intersection point, from... Starting from the top, bottom, left, and right directions of the image, the search proceeds outwards, with a search distance of [distance to be filled in]. Preferably, the image size is 50 pixels. The process is performed pixel by pixel along each direction, and the skeleton image along the retrieval path is counted. The sum of pixel values .when Greater than the preset threshold When it is determined that steel exists in that direction, in this embodiment, The preferred value is 10.
[0139] A true vertical weld should contain two steel regions, with the included angle between these regions being less than 180 degrees. Let the set of directions containing steel be denoted as . Calculate the angle between any two of these directions. .when Furthermore, the line segments corresponding to the regions enclosed by these two directions lie exactly on the opposite side of the straight line. When viewed from above, the line segment is identified as a vertical weld. The projection position of this line segment onto the weld in the image coordinate system is shown.
[0140] If multiple pairs of straight lines satisfy the conditions, the corresponding vertical welds are output respectively. Through the steel existence verification based on the above direction retrieval, false straight line intersections caused by noise or non-weld structures can be effectively eliminated, significantly improving the reliability of vertical weld identification.
[0141] Please see the appendix Figure 5 Extract the closed contour boundaries from the skeleton image to identify horizontal welds;
[0142] Furthermore, identifying horizontal welds includes:
[0143] Perform a contour tracking algorithm on the skeleton image to extract all closed boundary trajectories;
[0144] Filter out boundary trajectories whose trajectory length is greater than a preset length threshold and whose overall trajectory direction is less than a preset angle deviation from the horizontal direction;
[0145] The selected boundary trajectories are identified as horizontal welds.
[0146] Specifically, after identifying the vertical weld seam, it is also necessary to extract the horizontal weld seam at the junction of the vertical steel plate and the bottom surface. Since the horizontal weld seam appears as a closed and continuous contour boundary in the skeleton image, it can be quickly located by contour tracking.
[0147] In this embodiment, the skeleton image The horizontal weld in the image corresponds to the intersection of the bottom of the vertical steel plate and the horizontal bottom surface. In the projected image, it appears as an approximately horizontal closed boundary trajectory. A contour tracking algorithm is then used to... Perform a scan to extract all closed boundary trajectories. The Suzuki contour tracking algorithm can be used for each extracted boundary trajectory. Calculate its total length That is, the number of pixels contained in the trajectory.
[0148] Under normal circumstances, the trajectory length of the actual horizontal weld is greater than the preset length threshold. Furthermore, its overall extension direction should be close to horizontal, and the trajectory should be... The direction angle of the line connecting the first and last points is The absolute value of the angle it makes with the horizontal direction is The filtering criteria are: ,in For length threshold, In this embodiment, to determine the maximum permissible angular deviation, Preferably 100 pixels, The preferred angle is 20 degrees, and the boundary trajectory that meets the above conditions is identified as a horizontal weld.
[0149] If the workpiece has multiple independent horizontal welds, then each trajectory that meets the conditions corresponds to a horizontal weld. Through this step, without the need for complex line fitting or intersection calculation, the spatial projection position of the horizontal weld can be obtained efficiently and accurately by directly using the contour features of the thinned image, providing a clear input for subsequent inverse coordinate transformation.
[0150] The identified vertical and horizontal welds are mapped back to the original camera coordinate system through an inverse rotation transformation to obtain the actual welding positions.
[0151] Furthermore, the actual welding positions are obtained, including:
[0152] Obtain the composite rotation matrix used in pose-normalized rotation;
[0153] Calculate the inverse of the composite rotation matrix;
[0154] The coordinates of the identified vertical and horizontal welds in the rotated coordinate system are transformed by an inverse matrix to obtain the three-dimensional spatial coordinates in the original camera coordinate system.
[0155] Specifically, after completing the image domain recognition of vertical and horizontal weld seams, their coordinates need to be mapped back to the original three-dimensional space to guide robot welding. Since the point cloud was rotated for attitude normalization in the aforementioned processing, the corresponding inverse transformation must be implemented to restore the real physical position.
[0156] In this embodiment, the composite rotation matrix used for the pose normalization rotation step is denoted as . Its expression is ,in and Let X and Y be the rotation matrices about the X and Y axes, respectively. Invert the composite rotation matrix to obtain the inverse matrix. In the rotated coordinate system, a pixel on any weld seam ( , First, it needs to be converted to three-dimensional coordinates in this coordinate system. The equation of the base is known as follows: Since the welding position is located above the bottom surface, the Z-coordinate of this point can be set as... Meanwhile, pixel coordinates ( , It needs to be reverse mapped to the X and Y values in the rotated coordinate system: ,in and These are the minimum coordinate values recorded during the projection of the point cloud subset. This yields the 3D points in the rotated coordinate system. Transform this point back to the original camera coordinate system using the inverse matrix: .
[0157] Under normal circumstances, This refers to the coordinates of the actual welding position in three-dimensional space. For continuous welds, the above transformation needs to be performed sequentially on each sampling point on the trajectory. A uniform sampling method can be used to extract a point at regular pixel intervals. In this embodiment, the sampling interval is preferably 5 pixels. The final output is... The point set can be directly used for robot welding path planning. Through inverse transformation, the weld seam identified in the image domain is accurately mapped back to the original measurement space, ensuring the actual usability of the welding position.
[0158] Example 2:
[0159] In a second embodiment of the present invention, the present invention provides a welding position recognition system based on point cloud projection skeletonization, such as... Figure 2 As shown, it includes the following modules:
[0160] Downsampling and bottom determination module: used to acquire the original point cloud data of the workpiece surface and perform downsampling to obtain the downsampled point cloud. Based on the mode and connected component analysis of the Z coordinate in the downsampled point cloud, the plane equation of the bottom surface of the workpiece is determined.
[0161] Attitude rotation module: used to perform attitude normalization rotation on the downsampled point cloud according to the bottom surface equation, so that the bottom surface is parallel to the horizontal plane, and the rotated point cloud is obtained;
[0162] Point cloud cropping module: Used to crop and rotate the point cloud using a plane that is parallel to the bottom surface and located at a preset height above the bottom surface as the dividing plane, retaining the subset of the point cloud on the side away from the bottom surface;
[0163] Projection image module: used to project a subset of point cloud onto a horizontal plane to generate a two-dimensional projection image;
[0164] Binary thinning module: Used to perform binarization and thinning processing on two-dimensional projected images to obtain skeleton images;
[0165] Line detection module: Used to detect lines in the skeleton image and perform maximum suppression on the detected lines to obtain a set of candidate lines;
[0166] Vertical weld identification module: used to identify vertical welds based on the angle between pairs of lines in the candidate line set and the existence of steel along the corresponding direction at the intersection point.
[0167] Flat weld recognition module: used to extract closed contour boundaries in skeleton images and identify horizontal welds;
[0168] Coordinate Inversion Module: Used to map the identified vertical and horizontal weld seams back to the original camera coordinate system through rotation inverse transformation to obtain the actual welding position.
[0169] In the automated welding of prefabricated steel structure components, the workpieces to be welded in the workshop are mostly vertically assembled components such as H-beams and channel steel. These workpieces are large and heavy, making it difficult to ensure an absolutely level bottom surface during hoisting and positioning. Furthermore, the complex lighting conditions at the work site often result in localized voids in the point cloud data captured by the 3D camera due to reflections or occlusions. Traditional methods based on plane fitting or deep learning either have stringent requirements for point cloud integrity or are computationally time-consuming, failing to meet the demands of rapid production changeover. To address these issues, this invention employs a welding position recognition system based on point cloud projection skeletonization, the architecture of which is as follows: Figure 2 As shown. The specific implementation process of this system is as follows:
[0170] First, the original point cloud of the workpiece surface is collected and downsampled. The mode of the Z coordinate of the downsampled point cloud is counted. Points near the mode are selected and projected onto the XY plane. The largest area region is retained as the bottom surface of the workpiece through connected component analysis, and the bottom surface equation is obtained.
[0171] Next, based on the bottom normal vector, the point cloud is rotated around the X and Y axes until the bottom surface is parallel to the horizontal plane. The plane parallel to the bottom surface and located above the bottom surface is used as the dividing plane. Points near the bottom surface are removed, and the point cloud in the vertical region is retained.
[0172] Then, the retained point cloud is vertically projected onto the horizontal plane to construct a two-dimensional projected image. The image is then binarized, and a thinning algorithm is executed to obtain a skeleton image with a single pixel width.
[0173] Next, Hough transform is used to detect straight lines on the skeleton image. Based on the number of coverage points, maximum suppression is performed to obtain a set of candidate straight lines. Straight line pairs are traversed. If the angle between them is between 75 degrees and 105 degrees, the intersection point is calculated. From the intersection point, the four directions of up, down, left and right are searched. The number of skeleton pixels on the path is counted to determine the existence of steel. If there are two directions with an angle of less than 180 degrees and the line segment between them is located on the straight line pair, it is identified as a vertical weld.
[0174] Simultaneously, contour tracking is performed on the skeleton image to extract closed boundaries, and trajectories with longer lengths and near-horizontal orientations are selected as horizontal welds.
[0175] Finally, the identified weld coordinates are mapped back to the original camera coordinate system through an inverse rotation transformation to obtain the actual three-dimensional welding position.
[0176] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A welding position recognition method based on point cloud projection skeletonization, characterized in that, Includes the following steps: The original point cloud data of the workpiece surface is acquired and downsampled to obtain the downsampled point cloud. Based on the mode and connected component analysis of the Z coordinate in the downsampled point cloud, the plane equation of the bottom surface of the workpiece is determined. The downsampled point cloud is rotated according to the bottom surface equation to make the bottom surface parallel to the horizontal plane, thus obtaining the rotated point cloud. Using a plane parallel to the bottom surface and located at a predetermined height above the bottom surface as the dividing plane, the rotated point cloud is trimmed, retaining a subset of the point cloud on the side furthest from the bottom surface; The point cloud subset is projected onto a horizontal plane to generate a two-dimensional projected image; The two-dimensional projection image is binarized and thinned to obtain a skeleton image; Line detection is performed on the skeleton image, and maximum suppression is applied to the detected lines to obtain a set of candidate lines; Based on the angle between pairs of lines in the candidate line set and the existence of steel along the corresponding direction at the intersection point, vertical welds are identified. Extract the closed contour boundaries from the skeleton image to identify horizontal welds; The identified vertical and horizontal welds are mapped back to the original camera coordinate system through an inverse rotation transformation to obtain the actual welding positions.
2. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The determination of the plane equation of the bottom surface of the workpiece includes: The original point cloud data of the workpiece surface is acquired and downsampled to obtain the downsampled point cloud; The frequency of the Z-coordinate of all points in the downsampled point cloud is counted, and the value with the highest frequency is taken as the mode of the Z-coordinate. Points whose Z-coordinates fall within the range of the mode plus or minus a preset thickness are selected as candidate bottom points; Project the candidate bottom points onto the XY plane, perform connected component analysis, and retain the point set corresponding to the connected component with the largest area; Calculate the average Z-coordinate of all points in the retained point set as the reference height of the bottom surface; The equation of the bottom surface is determined to be Z, which is equal to the reference height of the bottom surface.
3. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The obtained rotated point cloud includes: Calculate the normal vector of the bottom surface; The downsampled point cloud is rotated around the X-axis by a first angle, so that the Y component of the normal vector after rotation is zero. The first angle is determined by the ratio of the Y component to the Z component of the normal vector. The point cloud, after being rotated around the X-axis, is rotated around the Y-axis by a second angle so that the X component of the normal vector after the rotation is zero. The second angle is determined by the ratio of the X component to the Z component of the normal vector after the first rotation. Applying a composite rotation matrix of two rotations to the downsampled point cloud yields a rotated point cloud with its bottom surface parallel to the XY plane.
4. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The subset of point clouds retained on the side furthest from the bottom surface includes: A plane parallel to the bottom surface and at a preset height from the bottom surface is used as the dividing surface; Points located on the side of the segmentation plane closer to the bottom surface in the rotated point cloud are removed, and points located on the side of the segmentation plane farther from the bottom surface are retained to form a subset of the point cloud.
5. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The generation of the two-dimensional projection image includes: Determine the minimum and maximum values of the X-coordinate and the minimum and maximum values of the Y-coordinate in the point cloud subset; Construct a 2D image with a width equal to the floor of the difference between the maximum and minimum values of the X coordinate and a height equal to the floor of the difference between the maximum and minimum values of the Y coordinate, and initialize all pixels to zero; For each point in the point cloud subset, calculate the floor and floor of the difference between the X coordinate and the minimum X coordinate, and the floor and floor of the difference between the Y coordinate and the minimum Y coordinate, and combine them to obtain the pixel coordinates. At each pixel coordinate position in the two-dimensional image, the pixel value is increased by one unit.
6. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The obtained skeleton image includes: In the two-dimensional projection image, pixels with pixel values greater than a preset binarization threshold are set to the first value, and the remaining pixels are set to the second value to obtain a binary image. A thinning algorithm is applied to the binary image to reduce the width of the lines in the image to one pixel while maintaining the connectivity and overall shape of the lines, resulting in a skeleton image.
7. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The obtained candidate line set includes: Hough transform is used to detect straight lines in the skeleton image, and the number of pixels covered by each straight line is calculated, where coverage refers to the distance from a pixel to the straight line being less than the distance resolution. Iterate through all line pairs. When the angle difference between two lines is less than a preset angle difference threshold and the distance difference between two lines is less than a preset distance threshold, compare the number of pixels covered by the two lines. If the number of pixels covered by the first line is greater than that of the second line, keep the first line and delete the second line; otherwise, keep the second line and delete the first line. Repeat until there are no redundant line pairs.
8. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The identification of vertical welds includes: Iterate through each pair of lines in the candidate line set and calculate the angle between the two lines; When the included angle is within a preset degree range, calculate the intersection point of the two lines; From the intersection point, search outwards along the corresponding direction of the image at a preset distance, and sum the pixel values on the search path in each direction; If the sum of pixel values along the search path is greater than a preset threshold, then steel is present in that direction. If there are two directions with an angle less than a preset degree and the line segment between the steel areas corresponding to these two directions is located on the straight line pair, then the line segment is identified as a vertical weld.
9. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: The identification of horizontal weld seams includes: Perform a contour tracking algorithm on the skeleton image to extract all closed boundary trajectories; Filter out boundary trajectories whose trajectory length is greater than a preset length threshold and whose overall trajectory direction is less than a preset angle deviation from the horizontal direction; The selected boundary trajectories are identified as horizontal welds.
10. The welding position recognition method based on point cloud projection skeletonization according to claim 1, characterized in that: Obtaining the actual welding position includes: Obtain the composite rotation matrix used in the attitude normalization rotation; Calculate the inverse of the composite rotation matrix; The coordinates of the identified vertical and horizontal welds in the rotated coordinate system are transformed by the inverse matrix to obtain the three-dimensional spatial coordinates in the original camera coordinate system.
