A surface defect detection method based on point cloud clustering
By analyzing the local point density characteristics of point clouds and automatically calculating DBSCAN parameters, the problems of low detection efficiency and reliance on manual parameter tuning in existing technologies are solved, achieving efficient and automated surface defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2026-04-03
AI Technical Summary
Existing defect detection methods based on 3D point clouds suffer from low detection efficiency, reliance on manual parameter tuning, and poor versatility when no reference 3D model is available, making it difficult to achieve efficient and automated defect identification.
By analyzing the local point density feature changes in the surface defect region, the defect location is quickly located using the KNN feature values of the regional points, and the input parameters of the DBSCAN algorithm are automatically calculated to achieve automated clustering and separation of the point cloud. Defect detection is then performed by combining the KNN feature curves and the DBSCAN algorithm.
It enables rapid and automated detection of surface defects without the need for a 3D model, improving detection efficiency and reducing the tedious process of manual parameter adjustment, making it suitable for rapid industrial inspection.
Smart Images

Figure CN116385389B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of detection technology and automation devices, and relates to a surface defect detection method based on point cloud clustering. Background Technology
[0002] Surface defects are unavoidable in product manufacturing. They not only affect the product's appearance but also weaken its mechanical properties, reduce its reliability, and impact its functionality; they can even pose safety hazards and cause serious losses. Therefore, surface defect detection is a crucial part of the production process.
[0003] In traditional manufacturing processes, surface defects are identified by workers visually inspecting the machined surfaces of products using mechanical measuring tools. However, the human eye has limited resolution, leading to subjective misjudgments and low inspection efficiency. In precision / ultra-precision manufacturing, high-precision coordinate measuring systems (CMMs) or roughness testers are also used to detect surface defects. However, their measurement speed is extremely slow and they cannot be used to detect larger surface defects. Currently, visual inspection methods based on two-dimensional images are common in industrial defect detection. These methods utilize grayscale changes in defect areas for detection, such as edge detection, Hough transform, and grayscale statistics, and perform well in large-scale on-machine inspection of planar objects. However, due to the lack of height / depth information, two-dimensional image-based visual inspection methods are susceptible to the effects of natural light, shadows, surface water, and stains, leading to incorrect defect identification. Furthermore, surface defects are often accompanied by height anomalies such as pits and bumps, and high-reflectivity spots and dark areas appear in two-dimensional images under different lighting conditions, hindering accurate defect identification.
[0004] With the rapid development of optical measurement and visual perception technologies, various 3D measurement technologies have emerged and are widely used in mechanical processing, film and television special effects production, and virtual reality. A 3D point cloud refers to a collection of points formed by the spatial coordinates of each sampling point on the surface of an object obtained by a 3D measurement device. It is the carrier of 3D measurement data and has gradually become an important data processing format in the field of computer vision. The introduction of depth information into 3D point clouds greatly expands the space for subsequent algorithm processing, and is particularly advantageous in industrial inspection, especially for high-precision inspection tasks targeting high-quality surfaces.
[0005] Existing 3D point cloud-based defect detection methods can be broadly categorized into two types based on the presence or absence of a reference 3D model: surface defect identification with a reference 3D model and surface defect identification without a reference 3D model. For surface defect identification with a reference 3D model, current research primarily employs registration-based methods, matching the point cloud acquired by the 3D measurement system with the reference target's CAD model in the current production stage, and marking any mismatches as potential defects. The iterative closet point (ICP) algorithm proposed by Besl et al. [Besl PJ, McKay H D. A method for registration of 3D shapes[J].IEEE Transactions on Pattern Analysis and Machine Intelligence,1992,14(2):239] has become the most classic and commonly used point cloud fine registration method. Although this method is widely used in large-scale surface in-machine inspection and complex part deformation control, it is only suitable for product surface quality inspection where an accurate 3D model can be obtained. For surface defect identification without a reference 3D model, it can be divided into defect detection based on local features and defect detection based on clustering. The former generally extracts local features based on the characteristics of industrial defects and combines them with simple rules or classifiers for detection. For example, Burcu et al. [BurcuGuldurErkal, Jerome F Hajjar. Laser-based surface damage detection and quantification using predicted surface properties[J]. Automation in Construction, 2017, 83:285] proposed a damage detection and quantification method based on surface normals. This method uses local normal vectors, curvature, and color information extracted from a laser scanner to detect damage types such as cracks, corrosion, and related surface defects. However, this type of method has limitations because as the defect size decreases, the change in surface features diminishes while the influence of point cloud noise amplifies, leading to an increased false recognition rate. Cluster-based defect detection, on the other hand, distinguishes some objects in the point cloud from the defect region based on specific constraints, rules, or prior knowledge, thereby locating and extracting the defect target.The data density-based classification method DBSCAN (Density-Based Spatial Clustering of Application with Noise), proposed by Martin et al. [Ester M, Kriegel HP, Sander J, et al. A density-based algorithm for discovering clusters in large spatial databases with noise[C] / / kdd.1996,96(34):226-231], has been widely used in point cloud noise separation and defect extraction tasks. However, this method is slow in processing large-scale point clouds and its clustering effect depends on repeated manual parameter tuning, and still has certain limitations.
[0006] In summary, point cloud clustering-based defect detection is a method with great potential for practical applications, but it still needs to overcome problems such as the need for repeated manual adjustments and poor versatility of traditional clustering methods. Summary of the Invention
[0007] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention provides a surface defect detection method based on point cloud clustering. This method fully utilizes the high accuracy and high information content of three-dimensional point clouds. By analyzing the changes in local point density features in the surface defect region, and using the feature values of the K-Nearest Neighbor (KNN) algorithm, it quickly achieves coarse localization of the point cloud defect location. Simultaneously, it automatically calculates the optimal input parameters for the current point cloud clustering segmentation DBSCAN, realizing automated clustering identification of normal and defective regions of the point cloud, thereby achieving defect detection.
[0008] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0009] A surface defect detection method based on point cloud clustering is proposed. This method fully utilizes the high accuracy and high information content of 3D point clouds. By analyzing the changes in local point density characteristics in the surface defect region, and using the KNN feature values of the region points, the approximate location of the defect can be quickly located from the point cloud. The method then uses the data from the KNN feature value calculation process to predict the input parameters of the current point cloud clustering segmentation DBSCAN, achieving automated clustering and separation of surface defects. The method includes the following steps:
[0010] S1: Acquire the point cloud of the surface to be tested and perform preprocessing. Radius Outlier Removal is used to remove free noise points from the original point cloud. Then, based on the longest side length and point cloud density of the surface to be tested in the X and Y directions, the point cloud is divided into N m×n sub-blocks R = {ri , i = 1, 2, … N} and its corresponding point set P = {p i , i = 1, 2, … N}.
[0011] S2: For each block r segmented in step S1 i , visit the points within the block one by one , sort them in ascending order of distance, and take the first k points with the smallest distance (where k is the number of target neighborhood points, usually k < 20), calculate the Euclidean distance between point and point (Euclid Distance), and take its average value as the KNN eigenvalue of this point By arranging all the p i points within the block in ascending order of the KNN eigenvalue, obtain the KNN feature curve of this block R i , and determine whether there are surface defects in block R i according to the morphological characteristics of the KNN feature curve, obtain the defective blocks and non-defective blocks, perform pre-positioning, and mark M (M < N) defective blocks among them.
[0012] S3: Use the density characteristics of all non-defective blocks obtained in step S2 to calculate the parameters Epsilon and MinPts.
[0013] S4: For all M (M < N) defective blocks marked in step S2, use the parameters Epsilon and MinPts obtained in step S3 as the input parameters of DBSCAN, and adopt the DBSCAN density clustering algorithm to separate the non-defective point cloud and defective point cloud in the M defective blocks, perform precise positioning, and realize the detection of surface defects to be measured.<s
[0014] Furthermore, in step S2, the specific process of constructing the KNN feature curve of block R i and using the KNN feature curve to determine the defective block is as follows:
[0015] 2.1) Construct the Euclidean distance matrix between any two points within block R i :
[0016]
[0017] where
[0018]
[0019] Then, the average value of the distances to the k nearest points to a point i within block R is the KNN eigenvalue of the current point:
[0020]
[0021] 2.2) Transfer block R i All inside p i The points are arranged from low to high according to their KNN values, resulting in a curve that increases along the positive x-axis, which represents the R value of the block. i The KNN characteristic curve.
[0022] 2.3) Construct a straight line L: y = kx + b connecting the leftmost and rightmost endpoints of the KNN feature curve, and compare it with the original feature curve. When the number of points on the original curve that are higher than the straight line L at the same X coordinate exceeds the detection threshold T, it is considered that a left inflection point has appeared at the left end of the curve, and the current block R... i The area will be marked as a ROI block (i.e., a defect block containing defect point clouds), and the block R... i The four adjacent blocks above, below, to the left, and to the right of the current block will also be marked as ROI blocks; otherwise, the current block ROI will be marked as an ROI block. i It is marked as a non-ROI block.
[0023] Furthermore, in step S3, the specific process of calculating the DBSCAN input parameters using the density features of non-ROI blocks is as follows:
[0024] Divide the KNN feature curve of a non-ROI block into two parts, left and right, at a point x = c: L C Containing points x = 1, ..., c, R C Containing points x = c + 1, ..., p i Let the total root mean square difference be RMSE. C :
[0025]
[0026] Then make RMSE C The right inflection point of the KNN feature curve for the non-ROI block is obtained at the minimum value x = c.
[0027] The average value of the KNN feature values at the inflection points of the KNN feature curves of all non-ROI blocks is calculated and multiplied by an adjustment factor a1 to obtain the estimated value of the DBSCAN input parameter Epsilon. The adjustment factor a1 is set based on experience. R points are randomly selected from all non-ROI regions (R is a manually set number of random points, which can be 5% of the original point cloud points), and the number of neighboring points Pts within the Epsilon range of these R points is counted. i The average value is used as an estimate of the input parameter MinPts for DBSCAN:
[0028]
[0029] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects:
[0030] This invention does not rely on a 3D model; it directly performs defect detection based on the density features of point clouds rather than geometric features. By generating block KNN feature curves, it can not only determine whether the current region contains defects, but also use these curves to estimate input parameters for DBSCAN, thus avoiding tedious parameter tuning and automating the process. Furthermore, by performing the KNN discrimination-DBSCAN defect contour extraction process in parallel on multiple sub-blocks, the efficiency of the algorithm can be greatly improved, enabling it to meet the needs of rapid on-machine inspection in industry. Attached Figure Description
[0031] Figure 1 This is a flowchart of surface defect detection based on point cloud clustering provided in an embodiment of the present invention;
[0032] Figure 2 A schematic diagram of the defect pre-location principle based on block KNN feature curves provided in this embodiment of the invention; Figure 2 (a) is a point cloud of defect-free blocks; Figure 2 (b) shows the KNN characteristic curve of the defect-free block; Figure 2 (c) is the point cloud of the defective block; Figure 2 (d) is the KNN characteristic curve of the defect block;
[0033] Figure 3 This is a diagram illustrating the effect of KNN-based defect pre-location provided in an embodiment of the present invention.
[0034] Figure 4 The diagram shows the adaptive DBSCAN clustering results provided in this embodiment of the invention. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0036] Figure 1 The flowchart for detecting defects on the outer surface of an automobile fuel tank cap based on point cloud clustering provided in this embodiment of the invention includes the following specific steps:
[0037] The first step is to obtain the three-dimensional point cloud of the outer surface of the fuel tank cap to be tested.
[0038] The second step is to preprocess the point cloud of the surface to be tested by removing free noise points in the original point cloud using the Radius Outlier Removal method.
[0039] The third step is to divide the point cloud of the surface under test into N sub-blocks R = {r_n} based on the longest side length and point cloud density in the X and Y directions. i The set of points P = {p, i = 1, 2, ..., N} and the corresponding point set P = {p i ,i=1,2,…N}.
[0040] Fourth step, for each block r split in the third step i Visit each point in the block one by one Sort by distance from smallest to largest, find the k points with the smallest distance. (Where k is the number of target neighborhood points, which is set to 5 based on experience in this example), calculate points With point Euclidean distance (Euclid Distance), Component Block R i Euclidean distance matrix between any two points in the interior:
[0041]
[0042] in,
[0043]
[0044] Then go to block R i inside The average distance of the k nearest points is the KNN feature value of the current point.
[0045]
[0046] Block R i All inside p i The points are arranged from low to high according to their KNN values, resulting in a curve that increases along the positive x-axis, which represents the R value of the block. i The KNN characteristic curve.
[0047] The fifth step is to construct a straight line L: y = kx + b connecting the leftmost and rightmost endpoints of the KNN feature curve, and compare it with the original feature curve. (See attached diagram.) Figure 2 As shown, when the number of points on the original curve that are higher than the straight line L at the same X coordinate exceeds the detection threshold T, it is considered that a left inflection point has appeared at the left end of the curve, and the current block R... i This will be marked as a ROI block (i.e., containing defects). Meanwhile, block R... iThe four adjacent blocks above, below, to the left, and to the right of the current block will also be marked as ROI blocks; otherwise, the current block ROI will be marked as an ROI block. i Blocks marked as non-ROI. Passing through block R... i The effect of using KNN feature curves to locate defects from point clouds is shown in the attached figure. Figure 3 As shown, through Figure 3 As can be seen, the defective block and its adjacent blocks are marked in dark.
[0048] Step 6: Divide the KNN feature curve of a non-ROI block marked in step 3 into two parts, left and right, with a point x = c: L C Containing points x = 1, ..., c, R C Containing points x = c + 1, ..., p i Let the total root mean square difference be RMSE. C :
[0049]
[0050] According to the L-method [S. Salvador and P. Chan, "Determining the number of clusters / segments in hierarchical clustering / segmentation algorithms," in 16th IEEE International Conference on Tools with Artificial Intelligence. IEEE Comput. Soc, 2004], the point on the curve where the line connecting the first and last points of the curve has the minimum root mean square difference with the original curve is the inflection point of the curve. Therefore, to achieve RMSE... C The right inflection point of the KNN feature curve for the non-ROI block is obtained at the minimum value x = c.
[0051] The average value of the KNN feature values at the inflection points of the KNN feature curves in all non-ROI blocks is calculated and multiplied by an adjustment factor a1 to obtain the estimated value of the DBSCAN input parameter Epsilon. The adjustment factor a1 is an empirically set adjustment factor with a value of 0.7. After obtaining the Epsilon, R points are randomly selected from all non-ROI regions (R is a manually set number of random points; in this example, the original point cloud contains 22,000 data points, so R = 1000 is set here), and the number of neighboring points Pts within the Epsilon range of these R points is counted. i The average value is used to obtain an estimate of the DBSCAN input parameter MinPts.
[0052]
[0053] Step 7: For all M (M < N) defective blocks marked in Step 5, using the input parameters generated in Step 6, the DBSCAN density clustering algorithm is used to separate the non-defective and defective part point clouds of each sub-block, and the point clouds of the defective parts are marked to achieve the detection of the surface defects of the fuel tank cap to be measured. The content output by the algorithm is the extracted defective morphology. As shown in the appendix Figure 4 shown, through Figure 4 it can be seen that the point clouds of the defective parts are marked as dark colors.
[0054] The present invention provides a surface defect detection method based on point cloud clustering. This method makes full use of the characteristics of high precision and high information volume of three-dimensional point clouds. By analyzing the local point density feature changes in the surface defect area and using the regional point KNN eigenvalue, the approximate position of the defect is quickly located from the point cloud; the input parameters of the current point cloud clustering segmentation DBSCAN are predicted by calculating the process data using the regional point KNN eigenvalue, realizing the automatic clustering separation of surface defects.
[0055] It is easy for those skilled in the art to understand that the above is only a preferred embodiment of the present invention and is not used to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A surface defect detection method based on point cloud clustering, characterized in that, The detection method described above utilizes the high accuracy and high information content of three-dimensional point clouds. By analyzing the changes in local point density characteristics in the surface defect region, and using the regional point KNN feature values, it can quickly locate the approximate location of the defect from the point cloud. Using the data from the calculation process of the regional point KNN feature values, it predicts the input parameters of the current point cloud clustering and segmentation DBSCAN, thereby realizing the automated clustering and separation of surface defects. Includes the following steps: S1: Acquire the point cloud of the surface to be tested and perform preprocessing to remove free noise points from the original point cloud; based on the surface to be tested... and The longest side length and point cloud density in the direction divide the point cloud of the surface to be measured into... indivual Sub-blocks of size and its corresponding set of points ; S2: For each block segmented in step S1 Visit each point in the block one by one Sort by distance from smallest to largest, and take the first one with the smallest distance. Points in To calculate the number of points in the target neighborhood, calculate the points. With point Euclidean distance between The average value is taken as the KNN feature value of that point. By fully utilizing the block The points are arranged in ascending order of KNN feature values to obtain the block. The KNN feature curve is used to determine the blocks based on the shape characteristics of the KNN feature curve. To determine if surface defects exist, defective and non-defective blocks are identified, pre-positioned, and then... Defective blocks are marked; S3: Using the density characteristics of all non-defective blocks obtained in step S2, calculate the parameters. and ; S4: For all those marked in step S2 Each defective block will have the parameters obtained in step S3. and As input parameters to DBSCAN, the DBSCAN density clustering algorithm is used to separate... The non-defect point cloud and defect point cloud in a defective block are accurately located to achieve the detection of defects on the surface to be tested.
2. The surface defect detection method based on point cloud clustering according to claim 1, characterized in that, In step S2, the block is constructed. The specific process of obtaining the KNN characteristic curve and using it to determine defective blocks is as follows: 2.1) Constructing blocks Euclidean distance matrix between any two points in the interior: ; in, ; Then proceed to block inner point Recent The average distance between all points is the KNN feature value of the current point. ; 2.2) Block All contents included The points are arranged from low to high according to their KNN values to obtain a line along... The curve that increases in the positive direction of the axis represents the block. KNN feature curve; 2.3) Construct a straight line connecting the leftmost and rightmost endpoints of the KNN feature curve. And compare it with the original characteristic curve; when the original curve shows a value higher than the same... Straight line in coordinates The number of points exceeded the detection threshold. At that time, it is considered that a left inflection point has appeared at the left end of the curve, and the current block... These will be marked as ROI blocks, i.e., defective blocks containing defect point clouds, and will also be... The four adjacent blocks above, below, left, and right are marked as ROI blocks; otherwise, the current block is marked as an ROI block. It is marked as a non-ROI block.
3. The surface defect detection method based on point cloud clustering according to claim 1, characterized in that, In step S3, the specific process of calculating the DBSCAN input parameters using the density features of non-ROI blocks is as follows: The KNN feature curve of a non-ROI block is plotted at a point. Divided into two parts: left and right: Contains points , Contains points Let the total root mean square difference be denoted as . : ; Then in making Take the minimum value The right inflection point of the KNN feature curve for the non-ROI block is obtained at this location; Calculate the average of the KNN eigenvalues at the inflection points of the KNN feature curves for all non-ROI blocks and multiply it by an adjustment factor. As DBSCAN input parameters The estimated value, the adjustment coefficient Adjustment factors set based on experience; randomly selected from all non-ROI regions. These points were counted. points Number of neighboring points within the range The average value is used as the input parameter for the DBSCAN algorithm. The estimated value: 。 4. The surface defect detection method based on point cloud clustering according to claim 3, characterized in that, R is taken as 5% of the original point cloud point count.
5. The surface defect detection method based on point cloud clustering according to claim 1, characterized in that, In step S1, free noise points in the original point cloud are removed by radius statistical filtering.
6. The surface defect detection method based on point cloud clustering according to claim 1, characterized in that, In step S2, the number of target neighborhood points .
Citation Information
Patent Citations
Plate surface defect detection method and system based on image and point cloud data fusion
CN115496746A