Point cloud-based electrode stem straightness detection method
By using a line laser camera and a robotic arm in tandem, combined with deep learning models and geometric projection algorithms, automated and non-contact detection of the straightness of the electrode rod was achieved. This solved the problems of low detection efficiency and large errors in existing technologies, and improved the accuracy and consistency of the detection.
Patent Information
- Application Number
- CN202511769605.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-20
AI Technical Summary
Existing methods for detecting the straightness of electrode rods suffer from low automation, low detection efficiency, and are prone to introducing human error and damaging the workpiece surface. Furthermore, the detection results are greatly affected by the workpiece's posture, making it difficult to meet the real-time requirements of industrial production.
A line laser camera and a robotic arm work together to obtain the coordinate system transformation matrix through hand-eye calibration technology, collect and process the three-dimensional point cloud data of the electrode rod surface, segment the electrode rod using a deep learning model, and achieve non-contact straightness evaluation by combining geometric projection and fitting algorithms.
It enables automated, non-contact detection of electrode rod straightness, improving detection efficiency, reducing labor costs, avoiding surface damage, improving the accuracy and consistency of detection results, and eliminating measurement errors introduced by workpiece posture.
Smart Images

Figure CN121708090A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of machine vision and automatic detection, and particularly relates to a straightness detection method for an electrode rod based on point cloud. BACKGROUND
[0002] As a key conductive and structural component in many industrial devices, the straightness of the electrode rod is a core geometric tolerance that directly affects the performance of the product and the reliability of the system. Deviation in the straightness of the electrode rod not only causes unstable conductive performance and mechanical stress concentration, but also causes subsequent assembly difficulties and errors. Therefore, efficient and accurate straightness detection of the electrode rod is an important quality control link in the production process.
[0003] In existing technical practices, the straightness detection of the electrode rod mainly relies on contact measurement methods. Although these methods, such as using a dial gauge or a three-coordinate measuring machine for point-by-point scanning, can obtain a certain measurement accuracy, they have low automation and usually require a large amount of manual intervention or complex mechanical devices for point-by-point scanning. This process not only consumes time and effort and has low detection efficiency, but also is difficult to adapt to the fast-paced detection needs of modern industrial production lines. Moreover, the repeated physical contact of the measurement probe poses a risk of scratching or bruising the surface of the electrode rod, which may have a potential impact on the subsequent performance.
[0004] In order to overcome the shortcomings of contact measurement, non-contact optical detection methods have emerged. These methods usually use an industrial camera to take two-dimensional images and evaluate the straightness through edge extraction and other image processing algorithms. However, such detection schemes based on two-dimensional images are very sensitive to changes in environmental lighting, object surface reflection, and background complexity in the production site. These factors can cause inaccurate edge positioning, thereby interfering with the accuracy of the detection results. When manual assistance is required for image screening or target recognition, subjective judgment errors are introduced, making it difficult to ensure the consistency of the detection results.
[0005] In addition, whether it is a contact or non-contact method, the reliability of the detection results is often affected by the initial placement posture of the electrode rod being measured. Small tilting or position offset of the workpiece can be amplified during the measurement process, resulting in systematic measurement errors. The existing technology generally lacks a standardized data processing procedure to actively eliminate errors introduced by inconsistent workpiece postures, which greatly reduces the repeatability and objectivity of the measurement results, limiting their application in quality control scenarios with strict requirements. Therefore, it is of great practical significance and application value to develop a non-contact straightness detection method that is automated, high-precision, efficient, and stable and reliable in results. SUMMARY
[0006] The purpose of the present application is to provide a point cloud-based electrode rod straightness detection method, which solves the problems of offline detection mode, inability to meet the real-time needs of industrial production, dependence on manual operation or mechanical point-by-point scanning, low detection efficiency, easy introduction of subjective errors, and damage to the surface of the workpiece.
[0007] The present application provides the following solutions:
[0008] The present application provides a point cloud-based electrode rod straightness detection method, which automatically collects and processes three-dimensional point cloud data of the electrode rod surface through the cooperation of a line laser camera and a robot, uses a deep learning model to segment the electrode rod, and combines geometric projection and fitting algorithms to realize automatic and non-contact quantitative evaluation of the straightness of the electrode rod.
[0009] The point cloud-based electrode rod straightness detection method is implemented through the following technical solutions:
[0010] First, the conversion matrix between the robot base, the robot end, the line laser camera, and the electrode rod coordinate system is obtained through hand-eye calibration technology, and the positioning of the surface of the electrode rod to be measured is completed. Then, the robot moves to drive the line laser camera to rotate around the electrode rod to be measured, collects multiple frames of electrode rod point cloud data of the electrode rod to be measured, and uses the conversion matrix and registration algorithm to fuse the multiple frames of electrode rod point cloud data to generate complete electrode rod surface point cloud. After preprocessing of denoising and downsampling, the generated point cloud is segmented using an improved PointNet++ algorithm to extract the point cloud of the electrode rod surface. Then, the point cloud of the electrode rod surface is projected to generate a depth map, and the depth map is binarized. Then, the electrode rod axis is calculated and fitted. Finally, the minimum containing region method is used to evaluate the straightness of the electrode rod, and the electrode rod straightness error is determined according to the inter-range criteria.
[0011] Further, the hand-eye calibration technology obtains the conversion matrix by solving a standard form hand-eye calibration matrix equation, which is calculated according to the motion parameters of the robot at different positions.
[0012] Further, the operation of collecting multiple frames of electrode rod point cloud data of the electrode rod to be measured includes taking a point cloud image every 60 degrees around the electrode rod, a total of 6 point cloud images, and the edges of adjacent two point cloud images have overlapping regions. The registration algorithm is an iterative closest point algorithm, which is used to realize fine registration of the multiple frames of electrode rod point cloud data.
[0013] Further, the denoising preprocessing includes bilateral filter denoising processing. The bilateral filter denoising processing considers both the spatial coordinates and normal vector features of the electrode rod surface point cloud, and preserves the edge structure of the electrode rod while smoothing the data and removing noise points.
[0014] Further, the downsampling preprocessing comprises a uniform density downsampling processing. The uniform density downsampling processing constructs a KD-Tree spatial index to accelerate neighborhood search, and estimates the local point cloud density of each point, and then calculates the sampling probability according to the local point cloud density and a preset target density, and performs probability sampling on the point cloud, so as to complete the uniformization of the spatial distribution of the point cloud.
[0015] Further, the segmentation operation specifically comprises: using a probability threshold output by the improved PointNet++ algorithm to separate the foreground and the background of the preprocessed electrode rod surface point cloud; wherein the foreground is the point cloud of the preprocessed electrode rod surface, and the background is the point cloud not belonging to the preprocessed electrode rod surface; and then performing clustering processing on the foreground to remove isolated noise regions, and finally extracting the point cloud of the electrode rod surface.
[0016] Further, the structure of the improved PointNet++ algorithm comprises a feature extraction layer and a feature propagation layer, and the feature extraction layer and the feature propagation layer both combine a LAM attention mechanism module. The function of the LAM attention mechanism module is to use the local cross-channel interaction mechanism of channel attention and the spatial detail capturing mechanism of spatial attention to adaptively adjust the feature weight of the point cloud data, and combine the adjusted feature with a shortcut connection using element addition, so as to realize feature transmission under multiple receptive field scales.
[0017] Further, before the electrode rod axis is calculated and fitted, the principal axis of the point cloud of the electrode rod surface is obtained by principal component analysis, and the attitude of the point cloud of the electrode rod surface is adjusted to be parallel to the principal axis and the coordinate axis, so as to correct the projection error introduced by the attitude tilt. The binarization processing uses an algorithm of maximizing the inter-class variance between the foreground and the background to automatically determine the binarization threshold.
[0018] Further, the method for calculating and fitting the electrode rod axis specifically comprises: in the binarized image, extracting an upper edge point on the electrode rod cross section, and finding a corresponding lower edge point for each upper edge point, the corresponding lower edge point being the point with the smallest Euclidean distance from the upper edge point among all lower edge points; then, defining the midpoint of each pair of the upper edge point and the lower edge point as an axis coordinate, and finally performing linear fitting on all axis coordinate points by the least square method to obtain the electrode rod axis.
[0019] Further, the operation of determining the electrode rod straightness error according to the interphase criterion specifically comprises: calculating the vertical distance deviation of all axis coordinate points to the electrode rod axis; passing the maximum point and the minimum point in all vertical distance deviations, respectively making a straight line parallel to the electrode rod axis to form an initial containing area; determining two parallel lines with the minimum distance in the range of all axis coordinate points, the two parallel lines with the minimum distance must meet the interphase criterion, which requires the two parallel lines with the minimum distance to contact at least three axis coordinate points, and the three axis coordinate points are alternately located on the two parallel lines with the minimum distance; and finally, the vertical distance between the two parallel lines with the minimum distance is defined as the electrode rod straightness error.
[0020] Through the above scheme, the following beneficial technical effects are obtained:
[0021] The application realizes the automatic and non-contact detection of the straightness of the electrode rod, improves the detection efficiency, reduces the labor cost, and avoids the damage to the surface of the electrode rod caused by the contact measurement.
[0022] The application accurately distinguishes the foreground of the electrode rod from the complex background and optimizes the positioning accuracy of the edge area by using the improved PointNet++ algorithm integrated with the LAM attention mechanism to segment the point cloud data, thereby reducing the interference of background noise and sundries, eliminating the subjective judgment error in manual detection, and improving the accuracy and consistency of the straightness detection result.
[0023] The application corrects the posture of the electrode rod by principal component analysis before projection, projects the three-dimensional point cloud as a depth map for axis extraction, and combines the minimum containing area method and the interphase criterion to evaluate the straightness error, thereby establishing a standardized data processing and evaluation process, effectively eliminating the measurement error introduced by the posture of the workpiece, ensuring the objectivity and repeatability of the evaluation method, and thereby ensuring the reliability of the final detection result. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 is a flowchart of an electrode rod straightness detection method based on point cloud provided by one or more embodiments of the application.
[0025] Figure 2 is a network structure diagram of an improved PointNet++ provided by one specific embodiment of the application.
[0026] Figure 3 is a point cloud noise reduction schematic diagram provided by one specific embodiment of the application.
[0027] Figure 4 is a structure diagram of an LAM attention mechanism provided by one specific embodiment of the present application.
[0028] Figure 5 is an axis acquisition schematic diagram provided by one specific embodiment of the present application.
[0029] Figure 6 is a straightness error evaluation schematic diagram provided by one specific embodiment of the present application.
[0030] Figure 7 is an inter-phase criterion schematic diagram provided by one specific embodiment of the present application.
[0031] Figure 8 is a segmentation precision comparison diagram provided by one specific embodiment of the present application.
[0032] Figure 9 is a detection effect comparison diagram provided by one specific embodiment of the present application. DETAILED DESCRIPTION
[0033] The technical solutions of the present application will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0034] Reference is made to the accompanying drawings Figure 1 , Figure 1 is a flowchart of a point cloud-based electrode rod straightness detection method provided by one or more embodiments of the present application. The present application provides a point cloud-based electrode rod straightness detection method, which comprises the following steps:
[0035] S1, a conversion matrix between a robot base, a robot end, a line laser camera and an electrode rod coordinate system is obtained through a hand-eye calibration technology, which provides a basis for spatial positioning and coordinate unification for subsequent point cloud data acquisition and fusion.
[0036] S2, on the basis of the positioning, the robot is moved to drive the line laser camera to perform rotational motion around the electrode rod to be detected, and multiple frames of electrode rod point cloud data of the surface of the electrode rod to be detected are acquired. The acquired multiple frames of electrode rod point cloud data are subjected to coordinate transformation and alignment using the aforementioned conversion matrix and registration algorithm, and finally a complete electrode rod surface point cloud is generated by fusion.
[0037] S3, preprocessing the generated complete electrode rod surface point cloud, the preprocessing including two stages of noise reduction and downsampling. The noise reduction preprocessing considers the spatial position information and normal vector information of the point cloud data by means of bilateral filtering and the like, filters out outlier noise points while retaining the edge contour structure of the electrode rod. The downsampling preprocessing uniformly samples the point cloud to reduce the amount of point cloud data and make the distribution of the point cloud in space tend to be uniform, thereby providing a better data basis for subsequent segmentation processing.
[0038] S4, using an improved PointNet++ algorithm to perform semantic segmentation on the preprocessed electrode rod surface point cloud, so as to accurately extract the point cloud belonging to the electrode rod surface from the complex background environment. The improved PointNet++ algorithm combines a LAM attention mechanism module in the feature extraction layer and the feature propagation layer, and adaptively adjusts the weight of the point cloud features through the module, thereby effectively distinguishing the target and the background. After segmentation, the preliminary extracted foreground point cloud is clustered to remove isolated noise point clusters, and finally the pure electrode rod surface point cloud is obtained.
[0039] S5, after obtaining the point cloud of the electrode rod surface, the calculation and fitting of the electrode rod axis are performed. First, the principal component analysis method is used to calculate the principal axis direction of the point cloud of the electrode rod surface, and the posture of the entire point cloud is adjusted so that the principal axis is parallel to a coordinate axis of the coordinate system. This operation is used to correct the subsequent projection calculation error introduced by the arbitrary posture of the workpiece. After posture correction, the three-dimensional electrode rod surface point cloud is projected along a specific direction to generate a two-dimensional depth map. The depth map is binarized, and then the contour edge points of the electrode rod are extracted in the binarized image. A series of discrete axis coordinates are obtained by calculating the midpoints of the corresponding point pairs on the contour, and finally the least squares method is used to linearly fit these axis coordinates to obtain the electrode rod axis.
[0040] S6, after fitting the electrode rod axis, the minimum containing region method is used to evaluate the straightness of the electrode rod. The method first calculates the perpendicular distance deviation of each axis coordinate point to the fitted electrode rod axis. Then, according to the interrelation criterion, a pair of parallel lines that can contain all coordinate points with the minimum distance are found among all axis coordinate points. The interrelation criterion requires that the two parallel lines constituting the minimum containing region must contact at least three measured axis coordinate points, and these contact points must be alternately distributed on the two parallel lines. Finally, the perpendicular distance between the pair of parallel lines that meet the interrelation criterion is determined as the straightness error of the electrode rod.
[0041] The accompanying drawings are referred to in the description of the application. Figure 1The application provides a point cloud-based electrode rod straightness detection method, and a starting step (S1 step) is to obtain a coordinate system conversion matrix necessary for subsequent point cloud collection and data fusion through a hand-eye calibration technology. The step aims to accurately determine the fixed spatial position relationship between a line laser camera installed at the end of a manipulator and the manipulator itself.
[0042] The hand-eye calibration process is realized by establishing and solving a matrix equation describing the transformation relationship between multiple coordinate systems. In a specific embodiment, a certain point in the camera coordinate system can be converted to the manipulator end coordinate system, and then to the manipulator base coordinate system through the known manipulator pose parameters.
[0043] In order to solve the hand-eye calibration matrix , first, control the manipulator to move to an initial pose, at this time, a point in the fixed calibration object coordinate system and its representation in the manipulator base coordinate system have the following relationship (1):
[0044] ;
[0045] wherein, is the homogeneous coordinates of a point in the calibration object coordinate system; is the corresponding homogeneous coordinates of the point in the manipulator base coordinate system. Since the calibration object and the manipulator base are fixed, the and are constant throughout the calibration process; is the transformation matrix from the calibration object coordinate system to the line laser camera coordinate system, which is the external parameter of the camera and can be obtained through camera calibration; is the hand-eye calibration matrix to be solved, representing the transformation from the line laser camera coordinate system to the manipulator end coordinate system; is the transformation matrix from the manipulator end coordinate system to the manipulator base coordinate system, which can be read from the manipulator controller in real time.
[0046] Subsequently, the manipulator is moved to a new pose, at this time, the manipulator end pose and the camera pose are changed, but the point and its representation in the base coordinate system remain unchanged. The above relationship (1) becomes relationship (2):
[0047] ;
[0048] wherein, and These are the transformation matrices for the robotic arm and the camera under the new pose, respectively. It is the hand-eye calibration matrix to be solved, representing the transformation from the line laser camera coordinate system to the robot end effector coordinate system; It is the homogeneous coordinate of a point in the calibrated object coordinate system; It is a point The corresponding homogeneous coordinates in the robot arm base coordinate system. Since both the calibration object and the robot arm base are fixed, and It remains unchanged throughout the calibration process.
[0049] Combining the above relations (1) and (2), we can obtain relation (3): .
[0050] Transform the relation (3) to include the unknown matrix. Moving the terms to both sides of the equation, we obtain the following standard hand-eye calibration equation form, i.e., relation (4), i.e. .
[0051] Relation (4) can be written as The standard form, in which:
[0052] matrix This represents the relative motion of the robot's end effector from its initial pose to its new pose. This matrix can be obtained by reading the robot's pose data twice. and Calculated.
[0053] matrix This represents the relative motion of the camera coordinate system with respect to a fixed calibration object. This matrix can be obtained from the external parameters obtained through two camera calibrations. and Calculated.
[0054] By controlling the robotic arm to move to multiple different poses, multiple sets of corresponding positions can be obtained. and This results in a system of overdetermined equations. Numerical optimization methods are used to solve this system of equations, thus calculating the hand-eye calibration matrix. The exact solution. In the hand-eye calibration matrix. Once calibrated, a complete transformation link from the camera coordinate system to the robot base coordinate system is established, providing a foundation for the accurate registration and fusion of multi-view point clouds in subsequent steps.
[0055] After determining the transformation matrix between the line laser camera and the robotic arm end effector, the method of the present invention proceeds to step S2, namely the automated acquisition and fusion of point cloud data on the surface of the electrode rod to be tested.
[0056] The automated data acquisition process uses a pre-programmed motion control system to move a robotic arm, which in turn drives a calibrated line laser camera in a circular motion around the central axis of the electrode rod under test. To ensure the acquisition of complete electrode rod surface information and provide sufficient overlap for subsequent registration, the acquisition strategy in this embodiment is set as follows: the line laser camera triggers an acquisition every 60-degree rotation of the robotic arm, acquiring one frame of local electrode rod point cloud data. This process is repeated until the electrode rod is circled once, acquiring a total of 6 independent local point cloud images. This acquisition method ensures that there is data overlap in the edge regions of any two adjacent point cloud images.
[0057] After acquisition, the six frames of local point cloud data, scattered in their respective camera coordinate systems, are fused into a single, complete point cloud model. This fusion process first uses the transformation matrix obtained in the hand-eye calibration step and the pose data of the robot arm during each acquisition to transform each frame of local point cloud from its own camera coordinate system to a unified robot arm base coordinate system.
[0058] After all local point clouds are unified to the same coordinate system, they are finely registered using the Iterative Closest Point (TLP) algorithm. The TLP algorithm precisely aligns the local point clouds by iteratively finding corresponding point pairs within the overlapping regions of adjacent point clouds and calculating a rigid transformation that minimizes the sum of squared distances between these corresponding point pairs. By applying this fine registration transformation to each local point cloud, minor deviations introduced by factors such as robot positioning errors or vibrations can be corrected.
[0059] Finally, all the transformed and finely registered local point cloud data were merged to form a high-density complete point cloud of the electrode rod surface, representing the complete three-dimensional shape of the electrode rod under test, providing a data foundation for subsequent preprocessing and segmentation steps.
[0060] See attached document Figure 3 After fusing multiple frames of local point clouds into a complete point cloud of the electrode rod surface, the point cloud needs to be preprocessed (step S3), with noise reduction being the primary step. Due to the influence of the line laser camera acquisition process and environmental factors, the fused point cloud data inevitably contains random noise points and outliers, which will interfere with subsequent segmentation and size assessment.
[0061] This embodiment employs bilateral filtering for noise reduction to smooth the point cloud on the complete electrode rod surface. The core of this process lies in considering not only the spatial positions of its neighboring points but also the normal vector characteristics of these points when calculating the new position of a point.
[0062] Specifically, for each point in the point cloud, a set of neighboring points within its neighborhood is first determined. Then, a new 3D coordinate is calculated for that point, which is a weighted average of the coordinates of all its neighboring points. The weight of each neighboring point is determined by two independent weight components. The first weight component is based on spatial distance; the closer the neighboring point is to the current processing point, the higher its weight. The second weight component is based on the similarity of normal vectors; the closer the surface normal vector of a neighboring point is to the surface normal vector of the current processing point, the higher its weight. The final weight of each neighboring point is the product of these two weight components.
[0063] In this way, bilateral filtering denoising achieves selective smoothing. For points located on the smooth surface of the electrode rod, their neighboring points are spatially close and have the same normal vector direction, thus receiving high weights and effectively filtering out random noise in that area. However, for points located on the edge of the electrode rod or at structural changes, although their neighboring points on the other side are spatially close, their normal vector directions change significantly, resulting in low weights for their normal vector similarity components and ultimately low weights. Therefore, these points on different surfaces contribute very little to the smoothing calculation of the current point, effectively removing noise while completely preserving the edge structure of the electrode rod, providing high-quality point cloud data for subsequent processing steps.
[0064] After completing the bilateral filtering noise reduction process, the next step in the preprocessing workflow is to perform uniform density downsampling on the point cloud data. The purpose of this step is to reduce the total amount of point cloud data while maintaining the key shape characteristics of the electrode rod, and to make the distribution density of the point cloud in three-dimensional space more uniform, so as to eliminate the local density unevenness caused by different acquisition distances and angles.
[0065] In this embodiment, the uniform density downsampling process first estimates the local point cloud density of the denoised point cloud. To perform this step efficiently, a KD-Tree spatial index structure is first established for the entire point cloud data. Based on the KD-Tree spatial index structure, a radius neighborhood search is performed on each point in the point cloud, and the number of neighboring points within a preset radius is counted. This number is defined as the local point cloud density of that point.
[0066] After obtaining the local point cloud density for each point, the sampling probability of each point is calculated based on this density and a pre-defined target density. Determined by the following formula:
[0067] ;
[0068] in, It is a point The probability of being retained during this downsampling process; It is a point The local point cloud density at the location is calculated by the aforementioned neighborhood search method based on KD-Tree; It is a preset target density value, representing the average density of the point cloud expected after downsampling; This represents the difference between the local density and the target density. When the local density is higher than the target density, this ratio is less than 1; conversely, when the local density is lower than the target density, this ratio is greater than or equal to 1. The function is used to select the smaller of the two values within parentheses. This function ensures that the calculated sampling probability is accurate. It will not exceed 1. Specifically, for points where the local density is lower than or equal to the target density (i.e., points located in sparse regions), the ratio is... Greater than or equal to 1, then through The function forces its sampling probability to be set to 1 to ensure that these points are completely preserved.
[0069] Finally, based on the sampling probability calculated for each point The entire point cloud is traversed once, and each point is randomly sampled to determine whether to retain it. After this process, a point cloud model with fewer points and a more uniform spatial distribution is obtained, providing more ideal input data for subsequent segmentation algorithms.
[0070] See attached document Figure 2 and attached Figure 4 After performing preprocessing steps such as noise reduction and uniform density downsampling on the point cloud, the preprocessed point cloud of the electrode rod surface is input into an improved PointNet++ network for semantic segmentation, thereby accurately extracting the point cloud part belonging to the electrode rod surface, i.e. step S4.
[0071] The improved PointNet++ network's main structure is based on PointNet++'s hierarchical feature learning framework, consisting of a feature extraction layer and a feature propagation layer. Both the feature extraction and feature propagation layers incorporate a LAM attention mechanism module, and element-wise addition is used to combine the optimized features from this module with the original input features from the shortcut connections.
[0072] The LAM attention mechanism module receives feature maps from the previous level of the PointNet++ network as input, and processes them sequentially through a channel attention submodule and a spatial attention submodule.
[0073] The channel attention submodule aims to achieve local cross-channel interactions by adaptively learning the importance between channels. For an input feature map, this submodule first performs global average pooling, compressing the spatial information of each channel into a single value, resulting in a channel descriptor. Subsequently, the channel descriptor is fed into a one-dimensional convolutional layer to capture local cross-channel interaction information. The kernel size of the one-dimensional convolutional layer... It is based on channel dimension The adaptive determination avoids dimensionality reduction operations. (Convolution kernel size) The calculation method is as follows:
[0074] ;
[0075] in, It is the size of the one-dimensional convolution kernel of a one-dimensional convolutional layer; This is the number of channels in the input feature map; and It is a hyperparameter used to adjust the mapping relationship between the convolution kernel size and the number of channels; This means taking the closest odd number to ensure that the convolution kernel has a center point.
[0076] After one-dimensional convolution, the result is fed into a sigmoid activation function to generate the final channel attention weights, which are then multiplied element-wise with the original input feature map to obtain an intermediate feature map that has been weighted by the channel dimension.
[0077] Subsequently, this intermediate feature map is fed into the spatial attention submodule. This submodule first performs average pooling and max pooling operations along the channel dimension on the input intermediate feature map, generating two two-dimensional spatial descriptors. These two descriptors are concatenated along the channel dimension and then fed into a convolutional unit consisting of two cascaded 3×3 convolutional layers for processing. This cascaded convolutional structure is used to capture richer spatial detail information. Finally, the convolution result is fed into a sigmoid activation function to generate the final two-dimensional spatial attention weight map, which is then multiplied element-wise with its intermediate input feature map to obtain the final optimized features.
[0078] The optimized feature map is fused with the module's initial input feature map (from a shortcut connection) via element-wise addition. The fused result is then processed through a ReLU activation function to efficiently transfer features. By embedding this LAM module into the network, global contextual semantics and local spatial attention can be combined to adaptively adjust feature weights, thereby maintaining deeper and more accurate feature representations across multiple receptive field scales.
[0079] After processing with the improved PointNet++ network described above, the network outputs a probability value for each point in the point cloud indicating that it belongs to the foreground (i.e., the electrode rod). The subsequent segmentation and post-processing steps aim to accurately separate the clean point cloud of the electrode rod surface. This process first applies a preset probability threshold to the point-by-point probability values output by the network to initially separate foreground and background points and remove low-confidence points.
[0080] Next, clustering is performed on the selected foreground point cloud to remove spatially isolated small noise regions caused by segmentation errors or sensor noise. After clustering, the geometric features (e.g., normal vector, curvature, density) and optical statistics (e.g., color mean, variance) of the retained foreground points are calculated. Then, a graph model is constructed to jointly optimize the label consistency of geometrically adjacent points using the calculated features, resulting in smoother and more accurate boundaries of the finally segmented electrode rod surface in regions with continuous shape and color.
[0081] After completing all the above processing steps, the final result is a clean and complete point cloud of the electrode rod surface, which will be used for subsequent axis fitting and straightness evaluation.
[0082] After obtaining a clean and complete point cloud of the electrode rod surface through segmentation and post-processing, the method of this invention then processes the point cloud to extract its central axis. The first step of this processing is attitude correction and depth map generation, which aims to eliminate the attitude tilt introduced by the arbitrary placement of the electrode rod during acquisition, and to provide a standardized input for subsequent two-dimensional image processing.
[0083] The attitude correction process employs principal component analysis to process the point cloud on the electrode rod surface. This process first calculates the covariance matrix of the point cloud. For a given point cloud containing... Points For a point cloud set, first calculate its centroid. Subsequently, its 3x3 covariance matrix... Build it as follows:
[0084] ;
[0085] in, It is the total number of points in the point cloud; It is the first in point cloud One point; These are the centroid coordinates of the entire point cloud; It is a point The deviation vector relative to the centroid; It is the transpose of the deviation vector.
[0086] For the calculated covariance matrix Eigenvalue decomposition is performed to obtain the eigenvector corresponding to the largest eigenvalue, which is the principal axis direction of the electrode rod point cloud. Subsequently, a rotation matrix is constructed to rotate the entire electrode rod surface point cloud so that its principal axis direction is parallel to a standard coordinate axis (e.g., the X-axis) of the coordinate system.
[0087] After attitude correction, a depth map generation method is used to project the 3D point cloud of the corrected electrode rod surface onto a 2D plane to generate a depth map. First, the pixel size is set according to the required detection accuracy. And determine the coordinate range of the point cloud on the projection plane (e.g., the XY plane), i.e., the minimum coordinate value. and For each point in the point cloud Its two-dimensional pixel coordinates on the depth map Calculated using the following formula:
[0088] ;
[0089] ;
[0090] in, It is a point The pixel coordinates corresponding to the projection onto the depth map; It is a point Coordinate components on the projection plane; These are the minimum coordinate values of the entire point cloud on the X and Y axes, respectively; It is the preset pixel resolution, representing the size of a pixel in the depth map in actual space; This represents the rounding operation, which maps the calculation result to discrete pixel indices.
[0091] After calculating the pixel coordinates, the depth information of the point is... Stored in the depth map matrix The corresponding position The storage method for depth values can be selected as needed, and its calculation method is as follows:
[0092] ;
[0093] in, Pixel coordinates in the depth map The depth value stored therein; It is a point The original coordinate values in the depth direction (e.g., the Z-axis); and These are the minimum and maximum coordinates of the entire point cloud in the depth direction, respectively.
[0094] The formula provides two storage methods: the first is to directly store the original depth coordinates. The second method is to normalize the depth values to the range of 0 to 255 to generate an 8-bit grayscale image.
[0095] Reference Appendix Figure 5 After generating a depth map reflecting the surface morphology of the electrode rod, the method of the present invention then processes the depth map to extract a series of two-dimensional coordinate points representing the central axis of the electrode rod.
[0096] The process first uses a global thresholding method to binarize the depth map. This step aims to separate the region representing the electrode rod (foreground) from the background region in the depth map. This embodiment uses Otsu's method to automatically determine an optimal global threshold. This method achieves its goal by finding a threshold that maximizes the inter-class variance between the segmented foreground and background pixels. The calculation formula is:
[0097] ;
[0098] in, It is the optimal global threshold for grayscale; At the optimal global threshold At that time, the inter-class variance of pixels in the foreground and background classes; and They are respectively at the optimal global threshold of At that time, the ratio of foreground pixels to background pixels to the total number of pixels; and They are respectively at the optimal global threshold of At that time, the average grayscale value of the foreground and background pixels.
[0099] Based on the calculated optimal global threshold Depth map is obtained by using a global thresholding method. Convert to binary image The conversion process is as follows:
[0100] ;
[0101] in, It is the pixel coordinates of the binarized image. The value at; Pixel coordinates in the depth map The depth value stored therein; It is the optimal global threshold for grayscale.
[0102] After obtaining the binarized image, its axis coordinates are calculated. Since the distance between the upper and lower edges perpendicular to the axis is the shortest in the cross-section of the electrode rod, the axis position can be determined by locating the edge points. First, edge detection and extraction are performed on the binarized image. For each valid cross-sectional position in the image, the upper edge point of the electrode rod contour is determined. and the corresponding lower edge point The corresponding point is the one that satisfies the condition of the point. The goal of this search process is to minimize the Euclidean distance D between two points, which is calculated using the following formula:
[0103] ;
[0104] in, , Represents the x and y coordinates of the selected upper edge point in the binarized image; , Represents the x and y coordinates of the corresponding lower edge point in the binarized image; This represents the minimum distance between the top edge point and the bottom edge point.
[0105] By analyzing each upper edge point By performing the minimum distance search described above, a uniquely paired lower edge point can be found. Ensure that the selected upper and lower edge points are the endpoints of the cross section perpendicular to the local axis of the electrode rod.
[0106] After determining the pair of upper and lower edge points with the shortest distance, their arithmetic center point is the central axis point of the electrode rod at that cross-section. The coordinates of this central axis point are... The calculation method is to take the average of the coordinates of the corresponding points on the upper and lower edges, and the calculation formula is as follows:
[0107] ;
[0108] ;
[0109] in, and Represents the x and y coordinates of a point on the central axis; , Represents the x and y coordinates of the selected upper edge point in the binarized image; , This represents the x and y coordinates of the corresponding lower edge point in the binarized image.
[0110] By traversing all valid areas of the electrode rod contour through the above process, a set of discrete coordinate points is obtained, which initially represents the central axis of the electrode rod. Finally, outlier removal is performed on this initial set of axis coordinate points. A reasonable deviation threshold is set based on the overall distribution of the basic data points, and coordinate points that significantly deviate from the main distribution trend are removed, retaining only normal coordinate points. After the above binarization, axis coordinate calculation, and outlier removal steps, a clean set of discrete coordinate points describing the central axis of the electrode rod is finally formed, providing an accurate data foundation for subsequent line fitting and straightness error assessment using the least squares method.
[0111] See attached document Figure 6 and attached Figure 7 After obtaining a pure set of axis scatter coordinates describing the center of the electrode rod cross section through step S5 (including binarization, edge sampling and outlier removal), the method of the present invention then uses the least squares method to linearly fit these discrete points in order to construct a mathematical model of the center axis of the electrode rod, i.e., step S6.
[0112] The core objective of step S6 is to find an ideal straight line that minimizes the sum (or sum of squared distances) of all axial discrete points to this line, thus mathematically optimally representing the axial extension trend of the electrode rod. This involves obtaining the coordinates of the normal axial discrete points from step S6, after deviation detection and outlier removal. The least squares method is used to fit it into a straight line. .
[0113] The straight line obtained by the fitting is the central axis of the electrode rod. The equation is shown below:
[0114] ;
[0115] in, The ideal reference line obtained by fitting represents the central axis of the electrode rod; The vertical coordinate of a point on a straight line (usually corresponding to the row coordinate of the image in the depth map coordinate system); The x-coordinate of a point on a straight line (usually corresponding to the column coordinate of the image in the depth map coordinate system); It is the slope of the fitted straight line, reflecting the slight inclination of the electrode rod axis relative to the horizontal axis of the image coordinate system (although it has undergone coarse correction by principal component analysis, the slight residual inclination will still be reflected by this parameter). It is the Y-intercept of the fitted line, representing the offset of the line at the origin.
[0116] The straight line determined by the above least squares fitting method This will serve as the baseline for subsequent straightness error assessment. It represents the axial position of the electrode rod under ideal conditions, and subsequent steps will calculate the actual measurement point relative to the ideal straight line. The deviation is used to accurately quantify the straightness error of the electrode rod.
[0117] After determining the ideal reference straight line (i.e., the central axis model) of the electrode rod using the least squares method, the method of this invention then uses this reference straight line to quantitatively evaluate the straightness error of the electrode rod in a given plane. This embodiment adopts the minimum containment region method, that is, finding a region that can contain all the actual axis points and has the minimum distance between two parallel lines, and using this distance as the straightness error.
[0118] To determine this minimum containment area, it is first necessary to calculate the coordinate deviation of each actual axis discrete point relative to the ideal reference line. Based on the straight line equation fitted in step S6, for each point in the axis scatter set... Its distance from the line in the Y-axis direction coordinate deviation Calculated using the following formula:
[0119] ;
[0120] in, It is the first The scatter points of the axis relative to the fitted line Coordinate deviation value in the Y-axis direction; It is the first The ordinate values of the scattered points on the axis; It is the first The x-coordinate values of the scattered points on the axis; It is a fitted straight line The slope; It is a fitted straight line The intercept.
[0121] After calculating the deviation values of all measurement points, the maximum deviation value was identified. and minimum deviation value . respectively through the corresponding and Draw two lines parallel to the fitted line from the points. straight line and These two straight lines form the upper and lower boundaries of the initial bounding region, at which point all measurement points are contained within it. and between.
[0122] To obtain accurate straightness error, it is necessary to further determine a pair of parallel lines with the smallest distance. and This ensures that all measurement points are still included. and Between. In this process, the phase criterion is used to determine... and Does it constitute the minimum containment area? This criterion requires that the two parallel straight lines constituting the minimum containment area must contact at least three measured points, and these contact points must be alternately located on the two straight lines (e.g., an up-down-up or down-up-down distribution pattern).
[0123] If the parallel line is found and If the phase-to-phase criterion is satisfied, then the perpendicular distance between these two straight lines is determined as the straightness error of the electrode rod. Finally, the calculated straightness error Compared with the preset qualified threshold Comparison: If If the straightness of the electrode rod meets the requirements, then the straightness of the electrode rod is determined to be satisfactory; if If the straightness requirement is not met, it is determined that the straightness requirement is not met. Through this process, the precise and automated evaluation of the geometric quality of the electrode rod is achieved.
[0124] See attached document Figure 8 and attached Figure 9 To verify the effectiveness, accuracy, and efficiency of the point cloud-based electrode rod straightness detection method proposed in this invention, this embodiment first constructs a dedicated electrode rod point cloud dataset and conducts multi-dimensional comparative experiments based on it.
[0125] Data collection and dataset creation:
[0126] A data acquisition system was built using a line laser camera to collect point cloud data from the surface of the electrode rods. To improve the model's generalization ability in complex industrial environments, data augmentation techniques were used to process the raw point cloud data, simulating point cloud performance under different lighting, angles, and noise conditions, thereby effectively expanding the data scale. Simultaneously, manual or semi-automatic annotation tools were used to perform pixel-level annotation on the electrode rods (foreground) and background in the point cloud data, generating ground truth values required for training. This completed the dataset creation, providing high-quality training samples for the improved PointNet++ network.
[0127] Experimental comparison and effect analysis:
[0128] To objectively evaluate the advantages of this invention in point cloud segmentation accuracy and overall detection performance, two sets of comparative experiments were set up.
[0129] Group 1: Comparison of Point Cloud Segmentation Accuracy
[0130] The improved PointNet++ algorithm proposed in this invention was tested against the traditional region growing algorithm and the original PointNet++ algorithm on the same dataset. Precision, recall, and F1 score were used as evaluation metrics. The experimental results are as follows:
[0131] The traditional region growing algorithm achieves a segmentation precision of 84.6%, a recall of 81.3%, and an F1 score of 82.9%. However, this method is limited by its sensitivity to noise and is prone to missegmentation at complex edges.
[0132] For the original PointNet++ algorithm, the segmentation precision is 90.2%, the recall is 87.5%, and the F1 score is 88.8%. Although it is an improvement over traditional methods, it still has some shortcomings in handling the fine texture boundaries of the electrode rods.
[0133] The improved PointNet++ algorithm of this invention benefits from the local cross-channel interaction and spatial detail capture capabilities introduced by the LAM attention mechanism module, achieving a segmentation accuracy of 95.8%, a recall rate of 93.1%, and an F1 score as high as 94.4%. Data shows that the method of this invention can improve the recognition ability of electrode rod features and effectively reduce boundary ambiguity and local misclassification.
[0134] Group 2: Comparison of Straightness Detection Results
[0135] The method of this invention was compared with existing traditional stylus methods and optical methods in a practical testing scenario. Evaluation metrics included testing efficiency (time per item), testing accuracy, and computational load. The experimental results are as follows:
[0136] Traditional stylus method: Its detection efficiency is low, with an average time of 4 minutes per piece; the detection accuracy is 96.8%; and due to the mechanical contact scanning involved, its detection computation (mainly referring to the system processing complexity) is relatively high, at 1.6 gflops.
[0137] Optical method (based on image edge extraction): Its detection efficiency is improved to 3 minutes / item; the detection accuracy is 97.5%; and the computational cost is 0.9 gflops. Although this method is non-contact, it is still limited by image quality and ambient lighting, resulting in significant computational redundancy.
[0138] The method of this invention achieves a qualitative leap in detection efficiency, with an average time of only 1 minute per piece, meeting the real-time detection needs of industrial production lines; the detection accuracy reaches 98.3%, which is better than the comparison method; at the same time, thanks to the efficient feature transfer and graph model optimization of the improved algorithm, the detection computation is greatly reduced to 0.3 gflops.
[0139] In summary, the method of the present invention reduces computational resource consumption and significantly shortens the detection time while ensuring extremely high detection accuracy, thus achieving efficient, accurate, and automated detection of electrode rod straightness.
[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting the straightness of an electrode rod based on point clouds, characterized in that, The point cloud-based electrode rod straightness detection method includes the following steps: S1. Obtain the transformation matrix between the coordinate system of the robot base, robot end effector, line laser camera and electrode rod through hand-eye calibration technology to complete the positioning of the surface of the electrode rod to be tested; S2. The mobile robotic arm drives the line laser camera to rotate around the electrode rod under test, collects multiple frames of electrode rod point cloud data, and uses the transformation matrix and registration algorithm to fuse the multiple frames of electrode rod point cloud data to generate a complete electrode rod surface point cloud. S3. Perform noise reduction and downsampling preprocessing on the point cloud on the surface of the complete electrode rod; S4. Use the improved PointNet++ algorithm to segment the preprocessed point cloud on the surface of the electrode rod and extract the point cloud on the surface of the electrode rod. S5. Project the point cloud onto the surface of the electrode rod to generate a depth map, perform binarization on the depth map, and then calculate and fit the axis of the electrode rod. S6. The straightness of the electrode rod is evaluated using the minimum containment area method, and the straightness error of the electrode rod is determined according to the phase-to-phase criterion.
2. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, In step S1, the hand-eye calibration technology obtains the transformation matrix by solving the standard hand-eye calibration matrix equation, which is calculated based on the motion parameters of the manipulator at different positions.
3. The method for detecting the straightness of an electrode rod based on point clouds according to claim 1, characterized in that, In step S2, the acquisition of multi-frame point cloud data of the electrode rod to be tested includes taking a point cloud image every 60 degrees around the electrode rod, for a total of 6 point cloud images. The edges of two adjacent point cloud images have overlapping areas, and the registration algorithm is the iterative nearest point algorithm.
4. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, In step S3, the noise reduction preprocessing includes bilateral filtering noise reduction processing. The bilateral filtering noise reduction processing removes noise points while preserving the edge structure by considering the spatial coordinates and normal vector characteristics of the point cloud on the electrode rod surface.
5. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, In step S3, the downsampling preprocessing includes uniform density downsampling processing. The uniform density downsampling processing estimates the local point cloud density by accelerating neighborhood search using KD-Tree, and calculates the sampling probability based on the local point cloud density and the target density to perform downsampling, thereby completing the uniformization of the point cloud spatial distribution.
6. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, In step S4, the segmentation specifically involves: The probability threshold output by the improved PointNet++ algorithm is used to segment the preprocessed point cloud on the electrode rod surface to separate the foreground and background. The foreground is the point cloud of the pre-treated electrode rod surface, and the background is the point cloud that does not belong to the pre-treated electrode rod surface. The foreground is then clustered to remove isolated noise regions and the point cloud on the surface of the electrode rod is extracted.
7. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, In step S4, the improved PointNet++ algorithm includes a feature extraction layer and a feature propagation layer, wherein the feature extraction layer and the feature propagation layer incorporate an LAM attention mechanism module; The LAM attention mechanism module utilizes the local cross-channel interaction of channel attention and the spatial detail capture of spatial attention to adaptively adjust the feature weights of the point cloud data, and uses element-wise addition to combine the adjusted features with shortcuts.
8. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, In step S5, before calculating and fitting the axis of the electrode rod, principal component analysis is used to obtain the principal axis of the point cloud on the surface of the electrode rod, and the orientation of the point cloud on the surface of the electrode rod is adjusted so that the principal axis is parallel to the coordinate axis. The binarization process uses an algorithm that maximizes the variance between foreground and background classes to determine the binarization threshold.
9. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, The method for calculating and fitting the electrode rod axis includes: In the binarized image, the upper edge point and the corresponding lower edge point of the cross-section of the electrode rod are extracted. The corresponding lower edge point is the point with the smallest Euclidean distance to the upper edge point. The midpoint between the upper edge point and the lower edge point is defined as the axis coordinate. The axis of the electrode rod is fitted by the least squares method.
10. The method for detecting the straightness of an electrode rod based on point cloud as described in claim 1, characterized in that, In step S6, determining the straightness error of the electrode rod according to the phase-to-phase criterion specifically includes: Calculate the vertical distance deviation from the coordinate point of the axis to the axis of the electrode rod; An initial containment region is formed by drawing straight lines parallel to the axis of the electrode rod through the maximum and minimum points of the vertical distance deviation. Determine a pair of parallel lines with the minimum distance, the pair of parallel lines with the minimum distance satisfying the alternation criterion, the alternation criterion requiring that the pair of parallel lines with the minimum distance contact at least three coordinate points of the axis, the three coordinate points of the axis being alternately located on the pair of parallel lines with the minimum distance; The straightness error of the electrode rod is the distance between the pair of parallel lines with the smallest distance.
Citation Information
Cited By
Mold electrode modeling method based on topological point cloud sampling and pointnet++
CN122289611A