Defect Concavity / Concavity Detection Algorithm and Detection System Based on Height Map and Curvature Analysis
By combining height maps and curvature analysis, and employing an adaptive neighborhood curvature analysis algorithm, the problem of difficulty in obtaining depth information and poor adaptability in the detection of concave and convex defects in existing technologies is solved, achieving high-precision defect detection that is applicable to the detection of complex surfaces and different types of workpieces.
Patent Information
- Application Number
- CN202510920648.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-07-04
AI Technical Summary
Existing technologies struggle to accurately obtain depth information of defects in the detection of concave and convex defects. Traditional thresholding methods have poor adaptability, statistical analysis lacks description of local geometric features, and machine learning methods rely on large-scale datasets, limiting their generalization ability.
Combining height maps and curvature analysis, an adaptive neighborhood curvature analysis algorithm is adopted. Data is acquired through high-precision 3D measurement equipment, and then denoised, smoothed, and normalized to construct a local surface model. Curvature features are calculated and defects are classified. Adaptive curvature thresholds and multi-scale analysis are introduced, and GPU parallel computing is used to optimize detection efficiency.
It achieves micron-level precision in detecting concave and convex defects, improves adaptability and robustness to complex surfaces, meets the inspection needs of different types of workpieces, and enhances inspection accuracy and stability.
Smart Images

Figure CN120427644B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial defect detection technology, and more specifically to a defect concavity / convexity detection system and method based on height map and curvature analysis. Background Technology
[0002] In industrial product inspection, the unevenness of surface defects is a crucial indicator for evaluating product quality. Traditional defect detection methods primarily rely on two-dimensional image analysis, but due to the lack of depth information, it is difficult to accurately distinguish between different types of defects. Height maps are a commonly used three-dimensional surface characterization method that can provide depth information about surface morphology, making the detection of uneven defects more intuitive and accurate.
[0003] Currently, common methods for detecting concavity and convexity include: morphological analysis: using image processing techniques to extract morphological features of defect areas, such as area and perimeter, but it is difficult to accurately assess the depth features of defects; threshold segmentation: setting thresholds based on height information to distinguish normal areas from defect areas, but it is difficult to adapt to complex surface morphologies; statistical analysis methods: analyzing by calculating statistical features such as the mean and variance of the height distribution, but lacking description of local geometric features; machine learning methods: using deep learning and other techniques to train classification models, which can automatically identify defect types, but require a large amount of labeled data.
[0004] Existing technologies for detecting concave and convex defects suffer from the following problems: relying solely on two-dimensional images fails to accurately obtain depth information of the defects; traditional thresholding methods are ill-suited to different types of defects; statistical analysis methods lack the ability to analyze local features such as curvature; and machine learning methods depend on large-scale datasets, limiting their generalization ability. Therefore, there is an urgent need for a method that combines height maps and curvature analysis to improve the accuracy and robustness of concave and convex defect detection. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention aims to provide a defect convexity detection system and method based on height maps and curvature analysis to improve the accuracy of industrial surface defect detection. It can combine three-dimensional topographic data from height maps with curvature analysis to provide micron-level precision in detecting convexity defects, enabling the identification of minute surface defects. An adaptive neighborhood curvature analysis algorithm is employed to enhance the system's adaptability and robustness to complex surface morphologies (such as freeform surfaces and microstructured surfaces). A detection scheme suitable for industrial environments is constructed, with a focus on optimizing detection quality and stability to meet the surface detection needs of different types of workpieces.
[0006] This invention proposes a defect concavity / convexity detection algorithm based on height map and curvature analysis, comprising the following steps:
[0007] Step S1: Height data acquisition. Use high-precision three-dimensional measurement equipment to acquire surface height map data, ensuring that the resolution and accuracy of the data meet the detection requirements.
[0008] Step S2: Image preprocessing. The height map data is denoised, smoothed, and normalized to improve data quality. Targeted filtering algorithms are used to remove noise interference from the data, smoothing is used to suppress high-frequency noise, and normalization is used to unify the data scale, thus comprehensively improving data quality and providing a reliable data foundation for subsequent analysis.
[0009] Step S3: Curvature analysis. Based on the processed height map data, a local surface model is constructed, and the curvature characteristics are calculated. Using this model, the normal curvature of each surface point is calculated, and the curvature characteristics in the neighborhood of that point are analyzed to obtain complete curvature information.
[0010] Step S4: Defect classification. The normal vector is calculated through the local surface model. The concavity and convexity are calculated based on the curvature characteristics and the normal vector. The defects are classified based on the concavity and convexity. Specifically, the curvature characteristics and height distribution information obtained from curvature analysis are used as the basis for judgment. A professional classification algorithm is used to classify the detected surface defects and accurately distinguish different types of defects such as convexity and concavity.
[0011] Step S5: Output the results, generate a defect marker map, and calculate the relevant feature parameters of the defects. The algorithm calculates key feature parameters such as the depth and area of the defects, providing detailed data support for subsequent quality assessment.
[0012] As a further aspect of the present invention, in step S3: curvature feature calculation, the calculation includes: mean curvature normal operator K H (v j The formula for describing the average curvature contribution of vertex j on the local surface is as follows:
[0013] K H (v j )=2H(v j )•n(v j ); where K H (v j ) is vertex v j The mean curvature normal operator represents the contribution of the vertex to the mean curvature of the local surface, n(v j ) is vertex v j The unit normal vector represents the direction of the surface's normal at that point, and its calculation formula is: T k T j Represents all vertices containing v. j triangle, va ,v b ,v c Triangle T k The three vertices are arranged in counterclockwise order, H(v j ) is vertex v j The average curvature is calculated using the following formula: ;k1(v j ) and k2(v j ) is vertex v j The principal curvatures, denoted by , represent the curvatures of the surface in the directions of maximum and minimum curvature, respectively.
[0014] As a further aspect of the present invention, in step S4: defect classification includes concavity / convexity calculation, specifically including a single-point concavity / convexity calculation formula: Where Convex(v) is the concavity / convexity value of vertex v, used to quantify the degree of concavity / convexity of a local region; v is the current vertex; N(v) is the set of neighboring vertices of vertex v; K H (v j ) is a neighboring vertex v j Mean curvature normal operator; Normal(v j ) is a neighboring vertex v j The unit normal vector; |N(v)| is the number of neighboring vertices;
[0015] The formula for calculating the overall concavity / convexity of a region is: Where A(R) is the total area of region R, and A(v) is the total area of region R. k ) is vertex v k The Voronoi area, used for weighting, Convex(v k ) is vertex v k The local concavity / convexity value,
[0016] Orientation consistency analysis: The orientation consistency coefficient α(R) is used to evaluate the consistency of concavity and convexity directions within a region. Where: n(v) k ) is vertex v k The unit normal vector, Convex(v) k ) is vertex v k The local concavity / convexity value, α(R), ranges from [0,1], with a larger value indicating higher directional consistency; α th For the set directional threshold, if α(R)≥α th If the concave and convex directions of the region are consistent, and if α(R) < α th The region will then exhibit a chaotic pattern of concavity and convexity.
[0017] As a further aspect of the present invention, in step S2: filtering / smoothing is applied to the height map data I to remove noise.
[0018] I B =Filter(I);
[0019] The filter function can be any of the following:
[0020] Median filtering:
[0021] I B (x,y)=median{I(x+i,y+j)|-k≤i,j≤k};
[0022] Where x represents the horizontal coordinate of the image, y represents the vertical coordinate of the image, and i and j represent the relative coordinate offsets;
[0023] Mean filtering: ;
[0024] Gaussian filtering: Where G(i,j) is the Gaussian kernel function: The filter kernel size k and Gaussian standard deviation σ need to be selected based on the scale characteristics of the vertical stripes.
[0025] As a further aspect of the present invention, in step S3: based on the calculated curvature features and height distribution information, the defects are classified: if Convex(v k If Convex(v) is positive, it indicates that the region is convex; if Convex(v) is positive, it indicates that the region is convex. k If Convex(v) is negative, it indicates that the region is concave; if Convex(v) is negative, it indicates that the region is concave. k A value close to zero indicates that the region is flat or has a smooth surface.
[0026] As a further aspect of the present invention, step S3 further includes: introducing an adaptive curvature threshold adjustment mechanism, the specific steps of which are as follows: performing curvature distribution statistics on the normal area of the workpiece, and calculating the mean curvature μ. H and standard deviation σ H Based on statistical results, the curvature threshold is dynamically set: H th =μ H +α•σ H Where α is a user-defined adjustment coefficient used to determine the sensitivity of defect detection.
[0027] As a further aspect of the present invention, step S3 further includes: a multi-scale curvature analysis method, the specific steps of which are as follows: using a multi-scale analysis method, the height map is decomposed into images of different scales through Gaussian pyramid decomposition; curvature is calculated at different scales to obtain a set of multi-scale curvature maps K. s(x,y); By integrating curvature information at multiple scales, the ability to detect defects of different sizes is improved, especially the ability to effectively distinguish between large-scale deformations and small-scale defects.
[0028] This invention also provides a detection system based on a defect concavity / convexity detection algorithm using height maps and curvature analysis, comprising: a CCD, a projector, a 3D data acquisition unit, a data processing unit, and a display output unit; the CCD employs a high-resolution industrial area array camera; the projector employs a high-resolution digital projector, achieving structured light encoding through precise control of the projection pattern; the 3D data acquisition unit controls the structured light projection and camera to acquire data synchronously, adjusting camera exposure parameters, projection brightness, and trigger timing to ensure the accuracy and stability of point cloud data acquisition; the data processing unit includes preprocessing, concavity / convexity calculation, and defect classification functional modules; the display output unit displays the detection results, including defect location, depth, and area information, and generates a quality report.
[0029] In this invention, adaptive neighborhood selection is employed: Different parts of the surface exhibit varying degrees of complexity. To ensure the accuracy of concavity / convexity calculation, a dynamic neighborhood radius adjustment strategy is used. The algorithm monitors local surface curvature changes in real time. When the surface curvature changes drastically, the neighborhood radius is reduced to focus on details; when the surface is relatively smooth, the neighborhood radius is increased to improve computational efficiency. This adaptive selection of the neighborhood size for concavity / convexity calculation ensures computational accuracy. Multi-scale curvature calculation: Defects of different sizes exhibit varying characteristics on the surface. To achieve unified detection of defects at different scales, this invention utilizes a multi-scale curvature analysis method. By decomposing the height map at multiple scales, curvature calculations are performed at different scales, enabling the algorithm to capture both the macroscopic features of large-scale defects and the subtle features of small-scale defects. Region adaptive filtering: Considering the different curvature change characteristics of different regions on the surface, this invention designs a region adaptive filtering strategy. Based on the curvature change characteristics of each region, the most suitable filtering parameters are automatically selected. This effectively removes noise while preserving the key features of the surface to the greatest extent, providing high-quality data for subsequent analysis. Optimized Curvature Calculation Method: Noise is inevitably generated during the measurement process, affecting the stability of curvature estimation. Therefore, this invention employs methods such as weighted least squares fitting to optimize the curvature calculation of local surfaces. By assigning different weights to different data points, the impact of noisy data is reduced, making curvature estimation more stable and reliable. GPU-Based Parallel Computing: Tasks such as curvature calculation, concavity / convexity analysis, and connected component detection are computationally intensive. To meet real-time detection requirements, this invention utilizes parallel computing technologies such as CUDA / OpenCL to distribute these computationally intensive tasks across multiple GPU cores for simultaneous processing, significantly shortening algorithm runtime and greatly improving algorithm execution speed.
[0030] The present invention has the following beneficial effects: It combines three-dimensional topographic data of height maps with curvature analysis to achieve micron-level precision in detecting concave and convex defects, and can identify minute surface defects; it adopts an adaptive neighborhood curvature analysis algorithm to improve the system's adaptability and robustness to complex surface morphologies (such as free-form surfaces and microstructured surfaces), and enhances the generalization ability of the detection system; it constructs a detection scheme suitable for industrial environments, focusing on optimizing detection quality and stability, and meeting the surface detection needs of different types of workpieces.
[0031] Specifically, in the field of surface defect detection, many existing methods have significant shortcomings in terms of detection accuracy and adaptability. This invention, through an innovative technical approach, significantly overcomes these limitations. By organically integrating three-dimensional topographic data from height maps with curvature analysis technology, this invention achieves ultra-high precision detection of concave and convex defects at the micrometer level, accurately identifying extremely small surface defects and elevating detection accuracy to a new level.
[0032] To address complex industrial scenarios, this invention develops an adaptive neighborhood curvature analysis algorithm. This algorithm enables the detection system to dynamically adjust analysis parameters based on changes in surface morphology, significantly improving the system's adaptability and robustness to complex surface morphologies such as freeform surfaces and microstructured surfaces. It also comprehensively enhances the detection system's generalization ability and effectively broadens its application scope.
[0033] Considering the stringent requirements of industrial environments, this invention has meticulously developed a testing solution suitable for industrial settings. During the design process, testing quality and stability were prioritized as core optimization objectives. From hardware selection to algorithm design, every aspect was carefully considered to ensure that the solution can meet the surface testing needs of different types of workpieces. Whether it's metal parts, plastic casings, or high-precision optical components, reliable testing can be achieved, contributing to improved quality and optimized efficiency in industrial production.
[0034] To more clearly illustrate the structural features and effects of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0035] Figure 1 This is a schematic diagram of the system architecture of the present invention;
[0036] Figure 2 This is a flowchart of the algorithm of the present invention;
[0037] Figure 3 This is a schematic diagram of the concavity / convexity calculation results of the present invention. Detailed Implementation
[0038] The present invention will now be further described in conjunction with the accompanying drawings and relevant knowledge, and will be described clearly and completely. Obviously, the described applications are only some embodiments of the present invention, and not all embodiments.
[0039] This invention provides a defect convexity / concaveness detection algorithm based on height maps and curvature analysis, comprising the following steps: height data acquisition, image preprocessing, curvature analysis, defect classification, and result output. The height data acquisition step includes: acquiring surface height map data using high-precision 3D measurement equipment (such as structured light, laser scanners, etc.), ensuring the data resolution and accuracy meet detection requirements. The image preprocessing step includes: noise reduction: removing sensor noise using methods such as median filtering or Gaussian filtering to ensure data quality; smoothing: smoothing the height map using Gaussian filtering or mean filtering to eliminate high-frequency noise while maintaining the main curvature features; and normalization: normalizing the height map data to ensure the data is analyzed at a uniform scale. The curvature analysis step includes: constructing a local surface model for each surface point based on the height map data, calculating the normal curvature and its neighborhood curvature features. The defect classification step includes: analyzing and classifying surface defect types based on curvature features and height distribution information, wherein the defect types include, but are not limited to, protrusions, depressions, scratches, etc. The output steps include: generating a defect marker map, displaying the defect location, and calculating relevant feature parameters such as defect depth, area, and volume. It also includes a multi-scale analysis step, which improves the detection accuracy of defects of different sizes by calculating the curvature features at different scales, and an adaptive threshold selection step, which dynamically adjusts the threshold according to the curvature distribution of the workpiece surface, thereby improving the detection capability of minute defects.
[0040] Example 1: Refer to Figures 1-3 As shown, this invention provides a defect unevenness detection algorithm based on height map and curvature analysis. This algorithm effectively identifies and classifies surface unevenness defects through precise processing of the surface height map and curvature analysis. Through neighborhood curvature analysis, the algorithm can accurately detect minute unevenness defects on surfaces of different shapes and sizes, including the following steps:
[0041] Step S1: Height Data Acquisition: Use high-precision 3D measurement equipment to acquire surface height map data, ensuring that the resolution and accuracy of the data meet the detection requirements.
[0042] Step S2: Image preprocessing: Denoising, smoothing, and normalizing the height map to improve data quality; specifically, applying filtering / smoothing to height map I to remove noise.
[0043] I B =Filter(I);
[0044] The filter function can be any of the following:
[0045] Median filtering:
[0046] I B (x,y)=median{I(x+i,y+j)|-k≤i,j≤k}
[0047] Where x represents the horizontal coordinate of the image, y represents the vertical coordinate of the image, and i and j represent the relative coordinate offsets.
[0048] Mean filtering: ;
[0049] Gaussian filtering: Where G(i,j) is the Gaussian kernel function: The filter kernel size k and Gaussian standard deviation σ need to be selected based on the scale characteristics of the vertical stripes.
[0050] Step S3: Curvature Analysis: Based on heightmap data, construct a local surface model and calculate the normal curvature and neighborhood curvature characteristics of surface points. Specific curvature characteristic calculations...
[0051] Mean curvature normal operator K H (v j The formula for describing the average curvature contribution of vertex j on the local surface is as follows:
[0052] K H (v j )=2H(v j )•n(v j );
[0053] Where K is H (v j ) is vertex v j The mean curvature normal operator represents the contribution of the vertex to the mean curvature of the local surface, n(v j ) is vertex v j The unit normal vector is calculated using the following formula: Among them, T k T j Represents all vertices containing v. j triangle, v a ,v b ,v c Triangle T k The three vertices, arranged in counterclockwise order, represent the normal direction H(v) of the surface at that point. j ) is vertex v j The average curvature is calculated using the following formula: ;
[0054] k1(v j ) and k2(v j ) is vertex v j The principal curvatures are denoted by , which represent the curvatures of the surface in the directions of maximum and minimum curvature, respectively.
[0055] Step S4: Defect Classification: Based on curvature characteristics and height distribution information, classify defects (e.g., convexities, depressions, etc.). Concavity / convexity calculation:
[0056] The formula for calculating the concavity / convexity of a single point is: Where Convex(v) is the concavity / convexity value of vertex v, used to quantify the degree of concavity / convexity of a local region; v is the current vertex; N(v) is the set of neighboring vertices of vertex v; K H (v j ) is a neighboring vertex v j Mean curvature normal operator; Normal(v j ) is a neighboring vertex v j The unit normal vector; |N(v)| is the number of neighboring vertices.
[0057] The formula for calculating the overall concavity / convexity of a region is: Where A(R) is the total area of region R, and A(v) is the total area of region R. k ) is vertex v k The Voronoi area is used for weighting. Convex(v k ) is vertex v k The local concavity / convexity value.
[0058] Orientation consistency analysis: The orientation consistency coefficient α(R) is used to evaluate the consistency of concavity and convexity directions within a region. Where: n(v) k ) is vertex v k The unit normal vector, Convex(v) k ) is vertex v k The local concavity and convexity value, α(R), ranges from [0,1]. The larger the value, the higher the directional consistency.
[0059] α th This is a set directional threshold. If α(R) ≥ α th If the region's convexity and concavity are consistent (either convex or concave overall), and if α(R) < α th The area's unevenness is disordered (further detailed testing is required).
[0060] Step S5: Output Results: Generate a defect marker map and calculate the relevant characteristic parameters of the defects (such as depth, area, etc.).
[0061] Example 2: Refer to Figure 1As shown, this invention also provides a defect concavity / convexity detection system based on height map and curvature analysis, specifically comprising CCD 1, projector 2, 3D data acquisition unit 3, data processing unit 4, and display output unit 5, with marker 6 representing the object to be measured. Wherein:
[0062] CCD: Employing a high-resolution industrial area scan camera (at least 15 megapixels) equipped with a low-distortion lens to ensure sufficient resolution of surface defects; This invention selects a high-resolution industrial area scan camera with at least 15 megapixels, paired with a low-distortion lens. High pixel count ensures the camera's ability to capture minute details, while the low-distortion lens effectively reduces image distortion. Together, they ensure the camera has a strong ability to resolve surface defects, providing clear and accurate raw image data for subsequent inspection.
[0063] Projection System: Utilizing a high-resolution digital projector, structured light encoding is achieved through precise control of projection patterns (such as sinusoidal stripes or Gray code), improving the accuracy of 3D reconstruction. Simultaneously, the projection angle is optimized to reduce surface reflection interference, ensuring the accuracy of height map data. This invention is equipped with a high-resolution digital projector that achieves structured light encoding by precisely controlling projection patterns such as sinusoidal stripes and Gray code. Structured light encoding technology significantly improves the accuracy of 3D reconstruction, obtaining more precise 3D information about the product surface. Furthermore, the system optimizes the projection angle based on the product's surface material, shape, and other characteristics, minimizing surface reflection interference and ensuring the accuracy of height map data, laying a solid foundation for subsequent data processing.
[0064] 3D Data Acquisition Unit: Controls the synchronous acquisition of structured light projection and camera data, adjusting camera exposure parameters, projection brightness, and trigger timing to ensure the accuracy and stability of point cloud data acquisition. It is responsible for precisely controlling the synchronous acquisition of structured light projection and camera data. By reasonably adjusting camera exposure parameters, it ensures appropriate brightness in the acquired image; optimizes projection brightness to make the projected pattern clearly discernible; and accurately sets the trigger timing to achieve seamless cooperation between the camera and projector, comprehensively ensuring the accuracy and stability of point cloud data acquisition and providing a reliable data source for data processing.
[0065] Data processing unit: This unit runs the concavity / convexity detection algorithm of the present invention and includes functional modules such as preprocessing, concavity / convexity calculation, and defect classification. The preprocessing module removes noise from the collected data, improving data quality; the concavity / convexity calculation module determines the concavity / convexity properties of defects based on height maps and curvature analysis; and the defect classification module accurately classifies various defects based on the calculation results.
[0066] Display output unit: Displays the inspection results, including information such as defect location, depth, and area, and generates a quality report.
[0067] Example 3: A defect concavity / convexity detection algorithm based on height map and curvature analysis, comprising the following steps:
[0068] Reference Figures 2-3 As shown, height data acquisition involves using a high-precision structured light scanner to acquire surface point cloud data of the workpiece to be inspected. The point cloud data is then converted into a height map to ensure that the resolution and accuracy of the data meet the inspection requirements, providing high-quality raw data for subsequent processing.
[0069] Furthermore, a high-precision structured light scanner is used to comprehensively scan the surface of the workpiece to be inspected, acquiring surface point cloud data. This point cloud data records the three-dimensional coordinate information of the workpiece surface. Subsequently, a professional data conversion algorithm is used to convert the point cloud data into a height map. During this process, the parameters of data acquisition and conversion are strictly controlled to ensure that the resolution and accuracy of the height map data meet the inspection requirements, providing a high-quality raw data foundation for subsequent algorithm processing.
[0070] Image preprocessing: Median filtering is applied to the acquired height map data to remove noise generated by the sensor; Gaussian filtering is used for smoothing to eliminate high-frequency noise while preserving the main curvature features; height map is normalized to ensure that the data is analyzed at a uniform scale.
[0071] Curvature Analysis: Based on the processed heightmap data, a local surface model is constructed. For each surface point, its normal curvature and neighborhood curvature characteristics are calculated. For each surface point v... j Calculate its mean curvature H(v) j And neighborhood curvature characteristics. The specific calculation formula is as follows:
[0072] ;wherein, k1(v j ) and k2(v j Let be the principal curvature at that point, representing the curvature of the surface in the directions of maximum and minimum bending. To evaluate the concavity / convexity of the defect, the relationship between the curvature characteristics of the neighborhood at that point and the normal vector at that point is calculated, thereby obtaining the Convex(v) of the local region. k )value.
[0073] Defect classification: Based on the calculated curvature features and height distribution information, defects are classified as follows:
[0074] If Convex(v) k A positive value indicates that the area is raised;
[0075] If Convex(v) k A negative value indicates that the area is concave;
[0076] If Convex(v) kA value close to zero indicates that the region is flat or has a smooth surface.
[0077] Convex(v) at each point k The values are written into the image, and the defect area is determined by threshold segmentation. Further precise classification of the defect type is achieved by calculating features such as the defect area, depth, regional concavity / convexity, and concavity / convexity consistency.
[0078] In other words, preliminary classification involves determining the sign of the feature values of local regions. A positive feature value indicates a convex region; a negative feature value indicates a concave region; and a feature value close to zero indicates a flat or smooth region. Precise classification involves writing the feature values of each point into the image and using a threshold segmentation algorithm to determine the defect region. Further, by calculating detailed features such as the defect's area, depth, regional concavity / convexity, and consistency, precise classification of the defect type is achieved, providing comprehensive data support for subsequent quality assessment.
[0079] Results Output: The inspection results are output in the form of images or data tables, including detailed information for each defect area (such as location, size, depth, etc.). Visual reports are generated based on the inspection results to facilitate quality analysis and decision-making by engineers.
[0080] Example 4, based on Example 3, introduces an adaptive curvature threshold adjustment mechanism, the specific steps of which are as follows:
[0081] Perform curvature distribution statistics on the normal area of the workpiece and calculate the mean curvature μ. H and standard deviation σ H Based on statistical results, the curvature threshold is dynamically set: H th =μ H +α•σ H Where α is a user-defined adjustment coefficient used to determine the detection sensitivity of the defect. Other defect detection steps are the same as in Example 3.
[0082] Specifically, after curvature analysis, areas considered normal (without obvious defects) are selected from the height map for curvature distribution statistics. By collecting and analyzing the curvature values of all points within these normal areas, the mean curvature μ is calculated. H and standard deviation σ H Based on the above statistical results, the curvature threshold H is dynamically set. th The calculation formula is H th =μ H +α•σ HHere, α is an adjustment coefficient set by the user, which can determine the detection sensitivity of defects according to actual detection needs. When the value of α is large, the detection threshold is high, and the algorithm is more stringent in detecting defects, which may result in some small defects being missed; when the value of α is small, the detection threshold is low, and the algorithm is more sensitive to defects, but may produce more false detections.
[0083] This embodiment demonstrates that by introducing an adaptive curvature threshold adjustment mechanism, the defect concavity / convexity detection algorithm based on height map and curvature analysis can dynamically adjust the detection threshold according to the actual condition of the workpiece surface. This further improves the detection capability for minute defects, enhances the adaptability and accuracy of the algorithm, and provides stronger support for enterprises to improve their product quality control level.
[0084] Example 5, based on Examples 3 and 4, introduces a multi-scale curvature analysis method. The specific steps are as follows: Using a multi-scale analysis method, the height map is decomposed into images of different scales through Gaussian pyramid decomposition. Curvature is calculated at different scales to obtain a set of multi-scale curvature maps K. s (x,y). By integrating curvature information at multiple scales, the ability to detect defects of different sizes is improved, especially the ability to effectively distinguish between large-scale deformations and small-scale defects.
[0085] Specifically, a multi-scale analysis method is employed, using Gaussian pyramid decomposition to decompose the preprocessed height map into images of different scales. Gaussian pyramid decomposition is a downsampling process where the image resolution gradually decreases at each layer, resulting in image representations at different scales. Generally, it is decomposed into 3-5 layers to cover different defect scales. On each scale image, the curvature analysis steps from Example 3 are repeated to calculate the curvature features of each surface point, resulting in a set of multi-scale curvature maps. Curvature maps at different scales reflect features of different sizes; large-scale curvature maps mainly reflect large-scale deformations and macroscopic features, while small-scale curvature maps focus more on small-scale defects and detailed information. The curvature information from multiple scales is integrated, and the curvature features at different scales are fused and analyzed. Weighted summation and other methods can be used to combine curvature maps of different scales to improve the detection capability for defects of different sizes. In this way, large-scale deformations and small-scale defects can be effectively distinguished, avoiding interference from large-scale deformations on the detection of small-scale defects. This embodiment demonstrates that by introducing a multi-scale curvature analysis method, the defect concavity / convexity detection algorithm based on height maps and curvature analysis can more effectively detect defects of different sizes. In particular, it can accurately distinguish between large-scale deformations and small-scale defects, further improving the accuracy and reliability of detection and providing stronger support for enterprises to improve their product quality control.
[0086] The technical principles of the present invention have been described above with reference to specific embodiments, which are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments; all technical solutions falling within the scope of the present invention's concept are within its protection scope. Those skilled in the art can conceive of other specific embodiments of the present invention without creative effort, and these embodiments will all fall within the protection scope of the present invention.
Claims
1. A defect concavity / convexity detection algorithm based on height map and curvature analysis, characterized in that, Includes the following steps: Step S1: Height data acquisition, using high-precision three-dimensional measurement equipment to acquire surface height map data; Step S2: Image preprocessing, including denoising, smoothing, and normalizing the height map data; Step S3: Curvature analysis. Based on the processed height map data, a local surface model is constructed, and the curvature characteristics are calculated. Step S4: Defect classification. Calculate the normal vector using the local surface model, calculate the concavity / convexity based on the curvature characteristics and the normal vector, and classify the defects based on the concavity / convexity. Step S5: Output the results, generate a defect marker map, and calculate the relevant feature parameters of the defects. In step S4, defect classification includes concavity / convexity calculation, specifically including the single-point concavity / convexity calculation formula: Where Convex(v) is the concavity / convexity value of vertex v, used to quantify the degree of concavity / convexity of a local region; v is the current vertex; N(v) is the set of neighboring vertices of vertex v; K H (v j ) is a neighboring vertex v j Mean curvature normal operator; Normal(v j ) is a neighboring vertex v j The unit normal vector; |N(v)| is the number of neighboring vertices; The formula for calculating the overall concavity / convexity of a region is: Where A(R) is the total area of region R, and A(v) is the total area of region R. k ) is vertex v k The Voronoi area, used for weighting, Convex(v k ) is vertex v k The local concavity and convexity value, Orientation consistency analysis: The orientation consistency coefficient α(R) is used to evaluate the consistency of concavity and convexity directions within a region. Where: n(v) k ) is vertex v k The unit normal vector, Convex(v) k ) is vertex v k The local concavity / convexity value, α(R), ranges from [0,1], with a larger value indicating higher directional consistency; α th For the set directional threshold, if α(R)≥α th If the concave and convex directions of the region are consistent, and if α(R) < α th The region will then exhibit a chaotic pattern of concavity and convexity.
2. The defect concavity / convexity detection algorithm based on height map and curvature analysis as described in claim 1, characterized in that, In step S3: curvature feature calculation, including: mean curvature normal operator K H (v j K is used to describe the average curvature contribution of vertex j on the local surface, and its calculation formula is as follows: H (v j )=2H(v j )•n(v j ); where n(v j ) is vertex v j The unit normal vector represents the direction of the surface's normal at that point, and its calculation formula is: T k T j Represents all vertices containing vertex v j triangle, v a ,v b ,v c Triangle T k The three vertices are arranged in counterclockwise order, H(v j ) is vertex v j The average curvature is calculated using the following formula: ;k1(v j ) and k2(v j ) is vertex v j The principal curvatures are denoted by , which represent the curvatures of the surface in the directions of maximum and minimum curvature, respectively.
3. The defect concavity / convexity detection algorithm based on height map and curvature analysis as described in claim 2, characterized in that, In step S2: Filtering / smoothing is applied to the height map data I to remove noise. B =Filter(I); The filter function can be any of the following: Median filtering: I B (x,y)=median{I(x+i,y+j)|-k≤i,j≤k}; where x represents the horizontal coordinate of the image, y represents the vertical coordinate of the image, and i and j represent the relative coordinate offsets; Mean filtering: ; Gaussian filtering: Where G(i,j) is the Gaussian kernel function: The filter kernel size k and Gaussian standard deviation σ need to be selected based on the scale characteristics of the vertical stripes.
4. The defect concavity / convexity detection algorithm based on height map and curvature analysis as described in claim 3, characterized in that, In step S4: during defect classification: if Convex(v k A positive value indicates that the area is raised; If Convex(v) k If Convex(v) is negative, it indicates that the region is concave; if Convex(v) is negative, it indicates that the region is concave. k A value close to zero indicates that the region is flat or has a smooth surface.
5. The defect concavity / convexity detection algorithm based on height map and curvature analysis as described in claim 4, characterized in that, Step S3 further includes: introducing an adaptive curvature threshold adjustment mechanism, the specific steps of which are as follows: performing curvature distribution statistics on the normal area of the workpiece, and calculating the mean curvature μ. H and standard deviation σ H Based on statistical results, the curvature threshold is dynamically set: H th =μ H +α•σ H Where α is a user-defined adjustment coefficient used to determine the sensitivity of defect detection.
6. The defect concavity / convexity detection algorithm based on height map and curvature analysis as described in claim 5, characterized in that, Step S3 further includes a multi-scale curvature analysis method, the specific steps of which are as follows: using a multi-scale analysis method, the height map is decomposed into images of different scales through Gaussian pyramid decomposition; curvature is calculated at different scales to obtain a set of multi-scale curvature maps K. s (x,y); Integrating curvature information from multiple scales improves the ability to detect defects of different sizes and is used to distinguish between large-scale deformations and small-scale defects.
Citation Information
Patent Citations
Heat exchanger welding quality visual detection method and system
CN119850605A