Welding spot detecting and positioning method based on binocular vision and clustering algorithm
By combining binocular vision with K-means and DBSCAN clustering algorithms, automatic and accurate detection and three-dimensional positioning of weld points are achieved, solving the problems of real-time tracking of weld seams and handling weld point reflection and occlusion in welding robots, thus improving welding quality and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-03-31
AI Technical Summary
Existing welding robots struggle to automatically track weld information in real time, resulting in incomplete weld point detection and low positioning accuracy, leading to unstable welding quality. Furthermore, traditional methods cannot effectively address the issue of feature loss caused by weld point reflection and occlusion.
By employing a binocular vision system combined with K-means and DBSCAN clustering algorithms, and through image preprocessing, coarse extraction of solder joints, precise extraction, edge completion, and 3D coordinate calculation, automatic and accurate detection and positioning of solder joints are achieved.
It improves the robustness and positioning accuracy of weld point detection, effectively overcomes interference from weld point reflection and obstruction, ensures automatic tracking and real-time adjustment during the welding process, and improves welding quality and efficiency.
Smart Images

Figure CN121767449A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of solder joint detection technology, and in particular to a solder joint detection and localization method based on binocular vision and clustering algorithms. Background Technology
[0002] Welding technology is widely used in manufacturing as an important joining process due to its advantages of precision, efficiency and low cost. Welding technology is used in all places where metal connections are involved, so ensuring the strength and safety of welded components is of great significance.
[0003] Currently, my country's welding production model is primarily manual welding, supplemented by robotic welding. While manual welding offers advantages such as flexibility and ease of adjustment, prolonged manual welding places a significant physical burden on workers, requiring frequent breaks and resulting in low overall welding efficiency. Furthermore, variations in welder skill levels make it difficult to standardize welding quality and control precision. In addition, the arc light, fumes, electromagnetic radiation, and harmful gases released during welding pose serious threats to the health of operators. With technological advancements and rising product quality standards, traditional manual welding methods can no longer meet the demands of modern industry for efficient and high-quality production. Currently, with the continuous development and widespread adoption of industrial robot technology, intelligent welding robots with high levels of automation and strong environmental adaptability are gradually replacing manual operations and becoming the mainstream development model in my country's welding manufacturing industry.
[0004] However, existing welding robots often experience welding trajectory deviations in practical applications, affecting welding quality. The main reason for this is the lack of real-time feedback and adaptive adjustment capabilities in the robot system when there are production or assembly errors in the welded parts, or changes in the welding environment. This makes it difficult to automatically and accurately acquire and track weld seam or weld point information, often requiring manual intervention and adjustments. Traditional weld point detection relies heavily on monocular vision or laser ranging technology, which struggles to provide high-precision 3D positioning information. Furthermore, weld point extraction schemes using single clustering algorithms suffer from missed detections and insufficient positioning accuracy when dealing with feature loss due to metal weld point reflections and partial occlusion, failing to meet the real-time operational requirements of intelligent welding robots. Therefore, a weld point detection and positioning scheme that integrates the advantages of multiple algorithms with binocular vision 3D ranging capabilities is urgently needed. Summary of the Invention
[0005] The purpose of this invention is to provide a weld point detection and positioning method based on binocular vision and clustering algorithms, which solves the problems of lagging weld seam information acquisition, incomplete weld point detection, and low positioning accuracy in the existing technology of welding robots. It realizes automatic and accurate detection and three-dimensional coordinate positioning of weld points, provides accurate guidance information for welding robots, and thus realizes automatic trajectory tracking and real-time adjustment.
[0006] To achieve the above objectives, the present invention provides the following solution: A solder joint detection and localization method based on binocular vision and clustering algorithms includes the following steps: S1, Image Acquisition: Simultaneously acquire the left and right views of the weld area of the workpiece under test through a binocular vision system; S2, Image preprocessing: Noise removal and contrast enhancement are performed on the acquired image; S3, Coarse extraction of solder joints: The K-means clustering algorithm is applied to the preprocessed image to perform color feature-based clustering, and the solder joints and background are initially classified to obtain candidate regions for solder joints; S4, precise extraction and separation of solder joints: regions that meet the characteristics of solder joints are selected from the candidate regions of solder joints, and spatially adjacent pixels are aggregated using the DBSCAN density clustering algorithm to distinguish individual solder joints. S5, Solder joint edge completion: For the point cloud data of each independent solder joint, the Alpha Shapes algorithm is used to extract its boundary contour and to complete the contour loss caused by reflection. S6, Solder joint coordinate confirmation: Perform circular fitting on the completed solder joint contour point set to determine the two-dimensional coordinates of each solder joint in the image; S7, 3D coordinate calculation: Combining the calibration parameters of the binocular vision system, the left and right views obtained in step S1, and the two-dimensional coordinates of the solder joint obtained in step S6, the three-dimensional spatial coordinates of the solder joint in the world coordinate system are calculated through stereo matching and triangulation principles.
[0007] Furthermore, in S1, the binocular vision system uses a binocular camera, which is installed below the workpiece to be tested to acquire an image containing weld point information; wherein, the binocular camera captures the same scene from different perspectives.
[0008] Furthermore, in S2, the image preprocessing specifically includes: using a LoG filter for smoothing, denoising, and edge enhancement, and removing small connected regions in the image.
[0009] Furthermore, in step S3, the K-means clustering algorithm is applied to the preprocessed image to perform color feature-based clustering, initially segmenting the candidate regions for solder joints, specifically including: The number of clusters K and the initial cluster centers are set according to the color differences in the images. K determines how many clusters the clustering result consists of. Through iterative optimization, each pixel is assigned to the nearest cluster center, and the cluster centers are updated until convergence. The K-means clustering algorithm iteratively optimizes the algorithm by minimizing the sum of distances from points within a cluster to the cluster center, i.e., minimizing the sum of the squares of the distances from each point to its cluster center, as shown in the following formula:
[0010] in, Indicates the number of clusters, Indicates the first The point set of a cluster, Indicates belonging to Data points, Indicates the first The centroid of a cluster, Representing data points With cluster center The square of the Euclidean distance between them.
[0011] Further, in step S4, selecting regions that meet the solder joint features from the candidate solder joint regions includes: calculating the pixel value of each cluster obtained by the initial clustering after processing by the K-means clustering algorithm, extracting the clusters that meet the solder joint features according to the solder joint features, and obtaining the solder joint information that needs to be located. The method of using the DBSCAN density clustering algorithm to aggregate spatially adjacent pixels to distinguish individual solder joints includes: Based on the solder joint image size, set the neighborhood radius ε and minimum number of points MinPts parameters for the DBSCAN density clustering algorithm, where the neighborhood radius... The minimum number of points, MinPts, determines the density threshold of a cluster, which in turn determines the neighborhood range of a point. Based on the set neighborhood radius ε and minimum number of points MinPts, the edge points are divided into several clusters, and noise points are marked at the same time.
[0012] Furthermore, in step S5, the Alpha Shapes algorithm completes the solder joint edges through the following steps: The weld point cloud is triangulated using Delaunay triangulation to form a set of non-overlapping triangles; the circumcircle radius of each triangle is calculated; all triangles with circumcircle radii greater than a given radius parameter threshold α are removed; the outer edges of the remaining triangles are connected to form the completed weld point boundary, resulting in the completed weld point contour point set.
[0013] Furthermore, the formula for calculating the coordinates of the center of the circumcircle of the triangle is as follows:
[0014]
[0015] in, , ; , These represent the coordinates of two two-dimensional vertices of the triangle, respectively. Based on the obtained coordinates of the center of the circle The radius R of the circumcircle can then be obtained using the following formula: .
[0016] Furthermore, in step S6, a random sampling consistency algorithm is used to fit the completed weld point contour point set into a circle. By iteratively sampling edge points, the optimal circular model is fitted to obtain the center coordinates and radius.
[0017] Furthermore, in step S7, the stereo matching uses a semi-global block matching algorithm to calculate the disparity map and obtain the disparity value of the solder joint; the three-dimensional spatial coordinates of the solder joint in the world coordinate system are obtained by solving the following composite matrix equation:
[0018] In the formula, Let be the two-dimensional coordinates of the weld point on the workpiece under test at the i-th shooting angle; A is the set intrinsic parameter matrix. Let be the extrinsic parameter matrix for each shooting angle, where For rotation matrix, It is a translation vector; As a scale factor, The coordinates are the three-dimensional coordinates of the weld point on the workpiece to be tested.
[0019] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the solder joint detection and positioning method based on binocular vision and clustering algorithm as described above.
[0020] As can be seen from the above technical solution, compared with the prior art, the solder joint detection and localization method based on binocular vision and clustering algorithm provided by the present invention has the following beneficial effects: (1) Significant advantages of algorithm combination: It innovatively combines K-means and DBSCAN clustering algorithms. The K-means algorithm is suitable for global color segmentation and is used for preliminary segmentation of solder joints and background based on color features; the DBSCAN algorithm is advantageous in handling noisy and complex solder joints and is used to further refine the extraction of solder joints based on the density of the points. This combination fully utilizes the advantages of the two algorithms, avoids the limitations of using only a single clustering algorithm in traditional methods, and improves the robustness and accuracy of solder joint extraction.
[0021] (2) Strong anti-interference ability: Through preprocessing such as LoG filtering and small region removal, and the completion of reflective missing areas by the Alpha Shapes algorithm, the interference of metal solder joint reflection and noise is effectively overcome, ensuring the integrity of solder joint information. When solder joints are missing due to reflection or occlusion, traditional methods often cannot effectively complete these missing parts. However, this invention uses the Alpha Shapes algorithm, which, through Delaunay triangulation and circumcircle radius filtering, can complete the missing solder joint data, ensuring the integrity of solder joint information.
[0022] (3) Higher positioning accuracy: Traditional weld point detection methods mostly rely on monocular vision or laser ranging technologies, which cannot provide sufficiently accurate three-dimensional positioning information. This invention uses a binocular vision system and utilizes the stereo matching SGBM algorithm to capture two images from different angles, calculate the disparity map, and combine it with camera calibration to accurately calculate the three-dimensional coordinates of the weld point. For the welding robot, the three-dimensional coordinates of the weld point are obtained after processing the images captured by the binocular camera. This coordinate is then input into the robot to drive the robotic arm to achieve automatic welding, realizing automatic tracking and real-time adjustment of the welding process. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram of the solder joint detection and localization method based on binocular vision and clustering algorithm of the present invention. Figure 2 The image result obtained in the coarse extraction stage of this embodiment of the invention; Figure 3 This is a clustering result diagram of different solder joints obtained in the solder joint extraction stage of the present invention. Figure 4 This is a schematic diagram of the point cloud after edge extraction and completion according to the present invention; wherein, (a) is the edge point extraction result of the relatively complete weld point point cloud, (b) is the weld point circle fitting result of the relatively complete weld point point cloud and the corresponding weld point center position, (c) is the edge point extraction result of the incomplete weld point point cloud, and (d) is the weld point circle fitting result of the incomplete weld point point cloud and the corresponding weld point center position. Figure 5 This invention provides the input image, the corresponding weld point extraction results, and the corresponding three-dimensional coordinates of the center point. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below 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.
[0026] The purpose of this invention is to provide a weld point detection and localization method based on binocular vision and clustering algorithms, aiming to address the shortcomings of existing technologies, such as the difficulty of welding robots in automatically tracking and acquiring weld information in real time, and the need for manual operation. This method uses image acquisition and extraction technology to detect weld points based on image data acquired in real time by a binocular camera. The detection results are then used as features to perform coordinate transformation and infer the robot's three-dimensional coordinates in the real world, achieving robot hand-eye calibration. This allows for real-time detection of the weld point positions of various parts, improving the welding robot's automatic trajectory tracking and real-time adjustment capabilities during welding.
[0027] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Example 1 like Figure 1 As shown, the present invention provides a solder joint detection and localization method based on binocular vision and clustering algorithms, comprising the following steps: S1, Image Acquisition: Simultaneously acquire the left and right views of the weld area of the workpiece under test (taking an electric meter as an example in this embodiment) through a binocular vision system; S2, Image preprocessing: Noise removal and contrast enhancement are performed on the acquired image; S3, Coarse Extraction of Solder Joints: The K-means clustering algorithm is applied to the preprocessed image to perform color feature-based clustering, initially classifying the solder joints and background, resulting in the following... Figure 2 The candidate area for solder joints is shown below; S4, Precise Extraction and Separation of Solder Joints: Regions matching the characteristics of solder joints are selected from the candidate solder joint regions, and spatially adjacent pixels are clustered using the DBSCAN density clustering algorithm, such as... Figure 3 The diagram distinguishes individual solder joint point cloud clusters. S5, Solder Joint Edge Completion: For the point cloud data of each individual solder joint, the Alpha Shapes algorithm is used to extract its boundary contour; such as... Figure 4 As shown in (a) and (c), the edge point extraction results of the relatively complete weld point cloud and the incomplete weld point cloud are respectively represented. Blue represents the original point cloud and red represents the extracted edge points. S6, Solder joint coordinate confirmation: Perform circular fitting on the completed solder joint contour point set, such as... Figure 4 As shown in (b) and (d), the circular fitting results of the solder joint point clouds for complete and incomplete solder joints and the corresponding center point positions of the solder joints are represented, respectively. The green dashed box represents the circular fitting result, and the red cross represents the corresponding center point position. Based on the center point position, the two-dimensional coordinates of each solder joint in the image are further determined. S7, 3D Coordinate Calculation: Combining the calibration parameters of the binocular vision system, the left and right views obtained in step S1, and the 2D coordinates of the solder joints obtained in step S6, the 3D spatial coordinates of the solder joints in the world coordinate system are calculated using stereo matching and triangulation principles. Figure 5 The image shows the three-dimensional spatial coordinates of the solder joint center on the input image.
[0029] Specifically, the detailed explanation of each step is as follows: S1, Image Acquisition: By mounting a binocular camera below the meter under test, images of the workpiece surface containing weld point information are acquired. The binocular camera simultaneously captures two images of the same scene from different perspectives, providing foundational data for subsequent parallax calculation and 3D reconstruction. Existing industrial welding robots often suffer from welding trajectory deviations, affecting the welding quality of the meter. This is because the welding robot lacks feedback and adjustment when production or assembly errors occur in the welded parts or when the real-time welding environment changes. To address this issue, the binocular camera uses coordinate transformation to infer the robot's 3D coordinates in the real world from the captured images, achieving robot hand-eye calibration. This ensures that the positional relationship of the weld point information on the meter is transformed, allowing the system to accurately move the welding torch to the weld point position, achieving automatic trajectory tracking and real-time adjustment capabilities during welding.
[0030] S2, Image Preprocessing: Image preprocessing operations such as LoG filtering and small connected region removal are used to remove noise from the image and improve the contrast between the desired solder joints and the background; this enhances the subsequent solder joint extraction capability. Image preprocessing operations include: (1) LoG Filtering: Combining the advantages of Gaussian smoothing and Laplacian edge detection, it is often used for noise removal and edge detection in images. Since the solder joints of smart meters are made of metal, there are certain reflection problems depending on the shooting angle, which manifest as high-brightness areas or local strong reflections. These noises will lead to a decrease in the recognition effect of solder joint features. Among them, Gaussian smoothing is used to reduce high-frequency noise in the image, especially the high-brightness noise in reflective areas. While using the Laplacian operator to detect edge information in the image, since the edges of reflective metal materials are usually relatively clear, LoG filtering can highlight these edges while suppressing noise.
[0031] Gaussian smoothing in LoG filtering uses a Gaussian kernel function to blur the image through a convolution operation. The formula is as follows:
[0032] In the formula, This represents the standard deviation of the Gaussian kernel, controlling the degree of smoothing. x, y The coordinates represent the relative coordinates within the convolution kernel, i.e., the position offset relative to the center of the Gaussian kernel, used to calculate the Gaussian weights at that position, rather than the global coordinates of the image.
[0033] The Laplacian operator in filtering is a second-order differential operator used to detect edges in an image. Its formula is:
[0034] (2) Small connected region removal: Small noise regions, such as bright spots or isolated pixels, often appear in the reflective areas of the weld. Small connected region removal can effectively eliminate these noises while preserving the main target areas in the image, such as the weld seam.
[0035] S3, Coarse Solder Joint Extraction: Using the K-means clustering algorithm, clustering is performed based on the color of the input image, grouping pixels with adjacent colors into one cluster, resulting in a preliminary classification of the solder joints and background image in the input image. The K-means clustering algorithm is used to perform preliminary classification of the solder joints and background based on the color features of the input image, including: setting the number of clusters K based on the color differences in the image and initializing the cluster centers. The determination of K determines the number of clusters in the clustering result. Then, through iterative optimization, each pixel is assigned to the nearest cluster center, and the cluster centers are updated until convergence. The principle of K-means clustering is to complete the segmentation by minimizing the sum of the distances from points within a cluster to the cluster center, i.e., the sum of the squares of the distances from each point to its respective cluster center, as shown in the formula below:
[0036] in, Indicates the number of clusters, Indicates the first The point set of a cluster, Indicates belonging to Data points, Indicates the first The centroid of a cluster, Representing data points With cluster center The square of the Euclidean distance between them.
[0037] S4, Precise Solder Joint Extraction and Separation: Calculate the pixel values of the clusters obtained from each initial clustering. Extract clusters that match the solder joint features to obtain the solder joint information to be located. Calculate the pixel values of the clusters obtained from each initial clustering using K-means clustering results. Extract clusters that match the solder joint features to obtain the solder joint information to be located. Then, use the DBSCAN density clustering algorithm to distinguish different solder joints. For the DBSCAN algorithm, the neighborhood radius parameter needs to be manually set. And the minimum number of points MinPts, where the neighborhood radius The neighborhood range of a point is determined, and the minimum number of points, MinPts, determines the density threshold of a cluster. Next, the DBSCAN algorithm is used to cluster the standardized edge points. The algorithm is based on a set... Along with MinPts, edge points are divided into several clusters, while noise points are marked. DBSCAN determines whether points belong to the same cluster based on the density of points within their neighborhood, offering the advantage of detecting clusters of arbitrary shapes, making it suitable for complex edge structures in crack detection. Preferably, since the captured images are similar in size, the neighborhood radius in DBSCAN density clustering is set empirically. The minimum number of points is 50, and the minimum number of points, MinPts, is 100.
[0038] S5, Solder Joint Edge Completion: Missing solder joints are completed based on their circular shape. The DBSCAN clustering results are used to fill in missing solder joints caused by reflections, thus obtaining complete solder joint information. First, the Alpha Shapes function is used to extract the edge points of the current cluster, by defining a radius parameter. To extract the point cloud boundary, a convex or concave hull is constructed to enclose the point set. First, Delaunay triangulation is performed on the point set to ensure that the points are logically connected and form a set of non-overlapping triangles. Then, the radius of the circumcircle of each generated triangle is calculated. The formula for calculating the coordinates of the center of the circle is as follows:
[0039]
[0040] in, , ; , These represent the coordinates of two two-dimensional vertices of the triangle.
[0041] Based on the obtained coordinates of the center of the circle The radius R of the circumcircle can then be obtained using the following formula: .
[0042] Then according to the user settings Value filtering removes spheres with a radius greater than 1. The triangle, and retaining the circumcircle radius less than or equal to The points are either triangles or tetrahedrons. Finally, the retained triangles after filtering are combined to form a shape, and the extracted boundary edges represent the boundaries of the point set. (In the parameters...) During the setup process, it determines the complexity of the boundary shape. The smaller the value, the better it can capture concave areas with concentrated points, i.e., more complex shapes. When the value approaches 0, the Alpha Shapes result may contain all points, and the shape may become disconnected.
[0043] S6, Solder Joint Coordinate Confirmation: Confirm the solder joint coordinates obtained after solder joint completion in S5. Use the Random Sample Consensus Algorithm (RANSAC) to perform circular fitting on the edge points obtained in step S5. The RANSAC algorithm iteratively samples edge points to fit the optimal circular model, obtaining the center and radius R.
[0044] S7, 3D coordinate calculation: The intrinsic and extrinsic parameters of the binocular camera are calibrated using a calibration board to obtain the camera's focal length, principal point coordinates, distortion coefficients, rotation matrix and translation vector between the two cameras. Then, the disparity map is calculated using the stereo matching algorithm SGBM to obtain the disparity value of the solder joint. Finally, the 3D coordinates (world coordinate system) of the solder joint are calculated based on the disparity map and camera parameters.
[0045] The shooting angles for the multi-angle images of the solder joints acquired by the binocular camera are set as follows: , ; Set the two-dimensional coordinates of the solder joint of the chip to be inspected at the i-th shooting angle as Set the intrinsic parameter matrix A and the extrinsic parameter matrix for each shooting angle. ,in, For rotation matrix, The translation vector represents the two-dimensional coordinates of the solder joints of the chip under inspection at the i-th shooting angle. The intrinsic and extrinsic parameter matrix A under the i-th shooting angle and By combining these elements, the following composite matrix equation can be established:
[0046] in, As a scale factor, The coordinates are the three-dimensional coordinates of the solder joints on the chip to be inspected.
[0047] In summary, this invention first acquires images containing solder joint information using a binocular camera, and then uses Gaussian filtering for noise reduction to minimize interference. The noise-reduced solder joint images are then used to improve the accuracy of solder joint location. Image segmentation techniques are employed to extract the approximate solder joint regions, and K-means clustering is used for initial solder joint extraction to segment the positions of all solder joints. DBSCAN is then used to classify all solder joints into different clusters. Finally, an improved RANSAC algorithm is used to fit the positional framework of each solder joint, achieving automatic solder joint location. This improves detection efficiency and reduces detection costs. Through this binocular vision-based solder joint detection and location technology for electric meters, automatic solder joint location can be achieved.
[0048] Furthermore, embodiments of the present invention provide a computer-readable storage medium storing executable instructions, which, when executed, cause a processor to perform the solder joint detection and positioning method based on binocular vision and clustering algorithm described in Embodiment 1.
[0049] The welding robot can be equipped with the aforementioned computer-readable storage medium to execute the weld point detection and positioning method based on binocular vision and clustering algorithm described in Example 1.
[0050] Matters not covered in this invention are common knowledge.
[0051] Those skilled in the art will understand that, in addition to implementing the system, apparatus, and their modules provided by this invention in purely computer-readable program code, the same program can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system, apparatus, and their modules provided by this invention can be considered a hardware component, and the modules included therein for implementing various programs can also be considered structures within the hardware component; alternatively, modules for implementing various functions can be considered both software programs implementing the method and structures within the hardware component.
[0052] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for solder joint detection and localization based on binocular vision and clustering algorithms, characterized in that, Includes the following steps: S1, Image Acquisition: Simultaneously acquire left and right views of the weld area of the workpiece under test through a binocular vision system; S2, Image preprocessing: Noise removal and contrast enhancement are performed on the acquired image; S3, Coarse extraction of solder joints: The K-means clustering algorithm is applied to the preprocessed image to perform color feature-based clustering, and the solder joints and background are initially classified to obtain candidate regions for solder joints; S4, precise extraction and separation of solder joints: regions that meet the characteristics of solder joints are selected from the candidate regions of solder joints, and spatially adjacent pixels are aggregated using the DBSCAN density clustering algorithm to distinguish individual solder joints. S5, Solder joint edge completion: For the point cloud data of each independent solder joint, the Alpha Shapes algorithm is used to extract its boundary contour and to complete the contour loss caused by reflection. S6, Solder joint coordinate confirmation: Perform circular fitting on the completed solder joint contour point set to determine the two-dimensional coordinates of each solder joint in the image; S7, 3D coordinate calculation: Combining the calibration parameters of the binocular vision system, the left and right views obtained in step S1, and the two-dimensional coordinates of the solder joint obtained in step S6, the three-dimensional spatial coordinates of the solder joint in the world coordinate system are calculated through stereo matching and triangulation principles.
2. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 1, characterized in that, In S1, the binocular vision system uses a binocular camera, which is installed below the workpiece to be tested to acquire an image containing weld point information; wherein, the binocular camera captures the same scene from different perspectives.
3. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 1, characterized in that, In step S2, image preprocessing specifically includes: using a LoG filter for smoothing, denoising, and edge enhancement, and removing small connected regions in the image.
4. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 1, characterized in that, In step S3, the K-means clustering algorithm is applied to the preprocessed image to perform color feature-based clustering, initially segmenting the candidate regions for solder joints, specifically including: The number of clusters K and the initial cluster centers are set according to the color differences in the images. K determines how many clusters the clustering result consists of. Through iterative optimization, each pixel is assigned to the nearest cluster center, and the cluster centers are updated until convergence. The K-means clustering algorithm iteratively optimizes the algorithm by minimizing the sum of distances from points within a cluster to the cluster center, i.e., minimizing the sum of the squares of the distances from each point to its cluster center, as shown in the following formula: in, Indicates the number of clusters, Indicates the first The point set of a cluster, Indicates belonging to Data points, Indicates the first The centroid of a cluster, Representing data points With cluster center The square of the Euclidean distance between them.
5. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 1, characterized in that, In step S4, selecting regions that meet the solder joint features from the candidate solder joint regions includes: calculating the pixel value of each cluster obtained by the initial clustering after processing by the K-means clustering algorithm, extracting the clusters that meet the solder joint features based on the solder joint features, and obtaining the solder joint information that needs to be located. The method of using the DBSCAN density clustering algorithm to aggregate spatially adjacent pixels to distinguish individual solder joints includes: Based on the solder joint image size, set the neighborhood radius ε and minimum number of points MinPts parameters for the DBSCAN density clustering algorithm, where the neighborhood radius... The minimum number of points, MinPts, determines the density threshold of a cluster, which in turn determines the neighborhood range of a point. Based on the set neighborhood radius ε and minimum number of points MinPts, the edge points are divided into several clusters, and noise points are marked at the same time.
6. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 1, characterized in that, In step S5, the Alpha Shapes algorithm completes the solder joint edges through the following steps: The weld point cloud is triangulated using Delaunay triangulation to form a set of non-overlapping triangles; the circumcircle radius of each triangle is calculated; all triangles with circumcircle radii greater than a given radius parameter threshold α are removed; the outer edges of the remaining triangles are connected to form the completed weld point boundary, resulting in the completed weld point contour point set.
7. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 6, characterized in that, The formula for calculating the coordinates of the center of the circumcircle of the triangle is as follows: in, , ; , These represent the coordinates of two two-dimensional vertices of the triangle, respectively. Based on the obtained coordinates of the center of the circle The radius R of the circumcircle can then be obtained using the following formula: 。 8. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 1, characterized in that, In step S6, a random sampling consistency algorithm is used to fit the completed weld point contour point set into a circle. By iteratively sampling edge points, the optimal circular model is fitted, and the center coordinates and radius are obtained.
9. The solder joint detection and localization method based on binocular vision and clustering algorithm according to claim 1, characterized in that, In step S7, the stereo matching uses a semi-global block matching algorithm to calculate the disparity map and obtain the disparity value of the solder joint; the three-dimensional spatial coordinates of the solder joint in the world coordinate system are obtained by solving the following composite matrix equation: In the formula, Let be the two-dimensional coordinates of the weld point on the workpiece under test at the i-th shooting angle; A is the set intrinsic parameter matrix. Let be the extrinsic parameter matrix for each shooting angle, where For rotation matrix, It is a translation vector; As a scale factor, The coordinates are the three-dimensional coordinates of the weld point on the workpiece to be tested.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the solder joint detection and positioning method based on binocular vision and clustering algorithm as described in any one of claims 1 to 9.