A Method for Extracting the Crack Profile of Cast Iron Parts

The method addresses the inaccuracies in traditional clustering algorithms by using pixel gradient differences and weighted centroid distances to enhance crack detection in cast iron components, improving the precision of crack contour extraction.

CN120107269BActive Publication Date: 2025-07-15陕西炬星海工贸有限责任公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510595448.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-09
Publication Date
2025-07-15
Estimated Expiration
2045-05-09

AI Technical Summary

Technical Problem

Traditional hierarchical split clustering algorithms are prone to misdividing crack areas in the crack detection of cast iron parts, affecting the accuracy and effect of crack wheel extraction, especially when the crack boundaries are blurred or the grayscale changes are not obvious.

Method used

By collecting the surface images of cast iron parts, using the gradient amplitude difference of pixel points to calculate significant values, combining the hierarchical splitting clustering algorithm to optimize the iterative splitting process, selecting the weighted centroid distance based on the difference in gradient direction in the cluster and the significant value to determine the splitting point, screening out the crack area, and extracting the crack wheel through mask operation.

Benefits of technology

It improves the accuracy and efficiency of the extraction of crack wheels for cast iron parts, and reduces missegmentation, especially when the crack grayscale changes are not obvious or the boundaries are blurred, and crack areas are extracted more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120107269B_ABST
    Figure CN120107269B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and particularly relates to a method for extracting the crack contour of a cast iron part. The method includes: collecting the surface image of the cast iron part and performing preprocessing, calculating the saliency value of each pixel point by using the difference between the gradient magnitude and the surrounding pixel points, performing multiple rounds of iterative splitting on the image by using the hierarchical splitting clustering algorithm, and evaluating the possibility that each cluster belongs to the crack region. Screening the crack region clusters according to the set threshold, and extracting the crack contour through a masking operation. Before each iterative splitting, determining the target splitting cluster according to the difference in the gradient directions of the pixel points within the cluster, weighting the splitting points by using the saliency value, and selecting the most suitable splitting point for iterative splitting. By optimizing the clustering operation, this method can accurately extract the crack contour of the cast iron part, reduce missegmentation, and improve the accuracy and reliability of crack contour extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing. Specifically, it relates to a method for extracting the crack contour of cast iron parts. Background Art

[0002] In the production process of cast iron parts, due to uneven cooling after casting and the presence of internal impurities, cast iron parts often have cracks of varying degrees. The appearance of cracks not only affects the mechanical properties and service life of cast iron parts, but may also lead to the failure of components, thereby affecting the safety of the entire mechanical system. Therefore, accurately and quickly detecting and extracting the contour of cracks in cast iron parts has become a key issue in ensuring the quality of cast iron parts.

[0003] To improve the accuracy of crack detection, clustering algorithms have been widely used in the segmentation of crack regions. Clustering algorithms can divide an image into multiple regions based on the gray value, texture information, or other features of pixels, thereby realizing the automatic extraction of crack regions. As an effective clustering method, the hierarchical splitting clustering algorithm can gradually refine the division of clusters through multiple rounds of iterative splitting, thereby improving the accuracy of crack recognition.

[0004] In the traditional hierarchical splitting clustering algorithm, during each round of splitting, the algorithm calculates the distance between each pixel point in the generated clusters and the cluster centroid. Based on these distances, the algorithm selects the pixel point farthest from the centroid as the splitting point and gradually refines the division of clusters through splitting. The centroid distance is used to measure the tightness of pixel points within a cluster. The larger the centroid distance, the greater the heterogeneity of pixel points within the cluster, and there may be more structural differences, so further splitting is required.

[0005] However, in the crack detection of cast iron parts, the crack regions usually have irregular shapes and relatively subtle gray value changes. These gray value changes of cracks are often relatively gentle and have a certain similarity to the gray value changes in the surrounding normal regions. Especially when the crack boundary is relatively blurred or the gray value change is not obvious, the traditional hierarchical splitting clustering algorithm relies on the centroid distance for splitting, so it is easy to mis-segment the crack region as part of the normal region, thereby affecting the accuracy and effect of crack contour extraction. Summary of the Invention

[0006] To solve the problem that in the process of detecting and extracting the contour of cracks in cast iron parts, the traditional hierarchical splitting clustering algorithm relies on the centroid distance of pixel points within a cluster for splitting, which is prone to mis-segmentation and affects the accuracy and effect of crack contour extraction, the present invention proposes a method for extracting the crack contour of cast iron parts, and the method includes:

[0007] Collect the surface image of the cast iron part and preprocess the surface image; determine the significance value of each pixel point in the surface image according to the difference between the gradient amplitude of each pixel point and the gradient amplitude of the surrounding pixel points, so as to reflect the possibility that the pixel point belongs to the crack area;

[0008] Use the hierarchical splitting clustering algorithm to perform multi-round iterative splitting on all pixel points of the surface image to complete the clustering operation, obtain multiple final clusters, evaluate the possibility that each final cluster belongs to the crack area, determine that the final cluster with a possibility greater than the preset possibility threshold belongs to the crack area, and perform a masking operation on the final cluster belonging to the crack area to extract the crack contour;

[0009] Before each round of iterative splitting in the clustering operation, perform the following operations:

[0010] For the multiple clusters that have been generated, determine the selectability of each cluster according to the sum of the gradient direction differences between pairwise pixel points within each cluster, and take the cluster with the maximum selectability as the target splitting cluster for the current round;

[0011] Within the target splitting cluster, weight the distance between each pixel point and the centroid of the target splitting cluster according to the significance value of each pixel point to obtain the weighted centroid distance of each pixel point, and take the pixel point with the maximum weighted centroid distance as the splitting point, and perform the iterative splitting of the current round based on the splitting point.

[0012] This technical solution obtains the visual information on the surface of the cast iron part by collecting images, providing a data basis for subsequent crack detection, and the preprocessing can remove the interference in the image and improve the image quality. Moreover, by using the gradient amplitude difference of pixel points to calculate the significance value, those pixel points with relatively large gray-scale changes can be highlighted, and these pixel points are more likely to be located in the crack area, and the significance value is used to quantify this possibility. Furthermore, using the hierarchical splitting clustering algorithm to cluster all pixel points in the image realizes the clustering division of pixel points in the surface image of the cast iron part. By evaluating and screening, the crack area is determined, and the crack contour is extracted, achieving the purpose of detecting and extracting the crack contour of the cast iron part. Moreover, before each round of iterative splitting in the hierarchical splitting clustering algorithm, specific operations are performed, including: measuring the selectability of each cluster. The structural differences of pixel points within the cluster with a large selectability are relatively large and need to be further split and refined. Based on the selectability, the most valuable target cluster for splitting can be screened out from multiple clusters, improving the pertinence and efficiency of the clustering operation. When selecting the splitting point within the selected target cluster, not only the distance between the pixel point and the centroid is considered, but also the possibility that the pixel point belongs to the crack area is considered, making the selected splitting point more likely to be located at key positions such as the boundary of the crack area, so as to more accurately split the target cluster, further improving the clustering accuracy, helping to reduce the situation of mis-segmentation, and more accurately extracting the crack contour on the surface of the cast iron part.

[0013] Furthermore, the weighted centroid distance of each pixel point satisfies the following relational expression:

[0014]

[0015] In the formula, is the weighted centroid distance of the -th pixel point in the target cluster before the -th round of iterative splitting; is the significance value of the -th pixel point in the target cluster before the -th round of iterative splitting; is the Euclidean distance between the -th pixel point in the target cluster and the centroid of the target cluster before the -th round of iterative splitting.

[0016] When calculating the weighted centroid distance of pixel points, this technical solution combines the significance values of pixel points. Pixel points with higher significance values have a greater weight in the weighted centroid distance, which means that the algorithm will pay more attention to those pixel points that are more likely to belong to the crack region, helping to more accurately capture the contour information of the crack during the clustering process and avoiding missegmentation.

[0017] Furthermore, the selectability of each cluster is calculated based on the following formula:

[0018]

[0019] In the formula, is the selectability of the -th cluster among the multiple clusters generated before the -th round of iterative splitting; is the gradient direction of the -th pixel point in the -th cluster among the multiple clusters generated before the -th round of splitting; is the gradient direction of the -th pixel point in the -th cluster among the multiple clusters generated before the -th round of splitting; is the total number of pixel points in the -th cluster; is the standard normalization function.

[0020] This technical solution provides an objective indicator for split decision-making. The greater the selectability, the greater the difference in the gradient directions of the pixels within the cluster, the more complex the intra-cluster structure, and the more likely it is to contain different feature regions, such as crack regions and non-crack regions. Therefore, the more necessary it is to perform splitting, so that the clusters that may have problems can be processed more targeted, rather than blindly splitting according to fixed rules, thus making the clustering process more intelligent and efficient.

[0021] Furthermore, the saliency value of each pixel is determined based on the following formula:

[0022]

[0023] In the formula, is the saliency value of the th pixel, is the gradient magnitude of the th pixel, is the maximum value of the gradient magnitudes of all pixels in the surface image, is the number of neighboring pixels of the th pixel, is the th neighboring pixel of the th pixel among the neighboring pixels of the th pixel, is the standard normalization function,

[0024] This technical solution takes into account that crack regions usually have obvious gray-scale changes, the gradient magnitudes of their pixels are often large, and there are obvious differences from the gradient magnitudes of the pixels in the surrounding normal regions. Through the saliency value of the pixels, it is possible to highlight these pixels with large gradient magnitudes and significant differences from the surroundings, and it is possible to initially locate the pixels that may belong to the crack region.

[0025] Furthermore, the probability that each final cluster belongs to the crack region is determined based on the following formula:

[0026]

[0027] In the formula, is the probability that the th final cluster belongs to the crack region, is the standard normalization function, is the length of the minimum bounding rectangle of the th final cluster, is the width of the minimum bounding rectangle of the th final cluster, is the number of pixels included in the th final cluster.

[0028] In this technical solution, by considering that the crack region may have specific shape features and pixel distribution rules, the size of the minimum bounding rectangle can reflect the shape and size of the cluster, while the number of pixel points reflects the density of the cluster. By comprehensively considering these factors, the similarity between each final cluster and the crack region can be more accurately evaluated, thereby determining the possibility of its belonging to the crack region.

[0029] Further, the masking operation for the final clusters belonging to the crack region to extract the crack contour includes:

[0030] Create a blank mask with the same size as the surface image, and mark all the pixel points included in all the final clusters belonging to the crack region as white in the blank mask; extract the contour of the region composed of the white pixel points as the crack contour.

[0031] Further, the preprocessing includes: grayscale the surface image, and use the Sobel operator to obtain the gradient magnitude and gradient direction of each pixel point.

[0032] Further, the method for setting the surrounding pixel points of a pixel point is: taking each pixel point as the center, and taking all the pixel points within the preset range around the center as the surrounding pixel points of the pixel point.

[0033] Further, after extracting the crack contour, post-processing operations are also performed on the extracted crack contour. The post-processing operations include but are not limited to: denoising, edge smoothing, and hole filling to ensure the integrity of the crack contour.

[0034] Further, the denoising is implemented through an image filtering algorithm, the edge smoothing is implemented through Gaussian blur or median filtering, and the hole filling is implemented through morphological operations.

[0035] The present invention has the following effects:

[0036] The present invention proposes an improved method for determining split points based on the weighted centroid distance of pixel points. By introducing the evaluation of the gradient direction difference of pixel points within the cluster, this method optimizes the segmentation process of the crack region. Compared with the traditional hierarchical split clustering algorithm, before each round of clustering split, the present invention first determines the selectability of the cluster according to the gradient direction difference of pixel points within each cluster, and preferentially selects the cluster containing more crack features for splitting. Combining the weighted split strategy of pixel points with the significant value can more accurately extract the crack region. Especially in the case where the gray change of the crack is not obvious or the crack boundary is blurred, the occurrence of missegmentation is reduced, and the effect and accuracy of crack contour extraction of cast iron parts are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a schematic flowchart of the method of the present invention;

[0038] Figure 2 It is a schematic flowchart of the method in step S3 of the present invention. Specific embodiments

[0039] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention.

[0040] A method for extracting the crack profile of a cast iron part provided by the present invention, as Figure 1 shown in, includes:

[0041] S1: Collect the surface image of the cast iron part and perform preprocessing.

[0042] Fix the industrial camera at a suitable angle and distance, and collect the surface image of the cast iron part in an environment with uniform illumination. Then, crop the irrelevant background area so that only the cast iron part area is retained in the surface image. Next, gray-scale the surface image, and then use the Sobel operator to obtain the gradient amplitude and gradient direction of each pixel point in the surface image.

[0043] S2: Determine the significance value of each pixel point.

[0044] On the surface of the cast iron part, the crack profile usually appears in the transition area between the crack area and the normal area. These transition areas usually show obvious edge features, that is, the pixel points corresponding to the crack profile will have significant gray-scale changes in the image, especially the gray-scale values change violently in the horizontal or vertical direction. Therefore, in order to effectively extract the crack profile, the possibility of a pixel point belonging to the crack area can be preliminarily evaluated by analyzing whether the edge feature of the pixel point is obvious.

[0045] In this step, the significance value of each pixel point is determined by analyzing the difference between the gradient amplitude of the pixel point and the gradient amplitudes of the surrounding pixel points. The larger the significance value, the more likely the pixel point is located in the crack area. On the contrary, the smaller the significance value, the more likely the pixel point is located in other areas except the crack area.

[0046] In one embodiment, first, with each pixel point as the center, all pixel points within the 8-neighborhood range around the pixel point are used as the surrounding pixel points of the pixel point, and then the significance value of each pixel point is calculated according to the following formula:

[0047]

[0048] In the formula, is the significance value of the th pixel point, is the gradient amplitude of the th pixel point, is the maximum value of the gradient amplitudes of all pixel points in the surface image, is the number of surrounding pixels of the th pixel, is the th pixel among the surrounding pixels of the th pixel, and is the standard normalization function, is the absolute value symbol.

[0049] In this formula, and constitute a fraction representing the relative edge strength of the th pixel in the entire surface image. The gradient magnitude of a pixel reflects the intensity of the gray level change of that pixel. A larger gradient magnitude usually means that the pixel is located at the edge of the image. If the gradient magnitude of a pixel is relatively large compared to the maximum gradient value in the entire surface image, then the pixel may be located in the crack area or the edge area of the surface image. Therefore, the greater the relative edge strength of the th pixel in the entire surface image, the more likely it indicates that the th pixel is at a significant edge position in the surface image and the greater the possibility that it belongs to the crack area.

[0050] In this formula, represents the sum of the differences in gradient magnitudes between the th pixel and its surrounding pixels. The larger the value of the sum of differences, the greater the gray level change between the th pixel and its surrounding pixels. The greater the gray level change between a pixel and its surrounding pixels, the more likely it indicates that the pixel is located in the crack area. This is because the crack area usually shows a relatively drastic gray level change, and the difference in gradient magnitudes between the pixels in the crack area and their neighboring pixels is relatively large, while the gray level values of the pixels in the normal area are relatively smooth and the difference in gradient magnitudes is relatively small.

[0051] Generally speaking, if the significant value of a pixel is larger, it means that the pixel not only has a strong edge strength itself (i.e., a larger gradient magnitude), but also has a large difference in gradient magnitude from its surrounding pixels. This means that the pixel may be located in the crack area or the edge area of the cast iron part. By calculating the significant value, the crack area can be effectively distinguished from the normal area. Especially when the boundary of the crack area is relatively blurred and the gray level change is relatively subtle, the significant value can provide effective support.

[0052] S3: Optimize the iterative splitting process of the hierarchical splitting clustering algorithm to obtain the clustering result.

[0053] The present invention utilizes a hierarchical divisive clustering algorithm to perform clustering operations on all pixel points of the surface image of a cast iron part. This step aims to optimize the traditional hierarchical divisive clustering algorithm by improving the iterative splitting process in each round to obtain more accurate clustering results.

[0054] Specifically, before each round of iterative splitting, multiple clusters have been generated. Then, it is determined which cluster most needs to be further subdivided. The cluster that most needs to be further subdivided is used as the target splitting cluster, and in the target splitting cluster, it is determined which pixel point is the appropriate splitting point. Based on the splitting point, iterative splitting operations are performed to more accurately extract the crack region.

[0055] The specific process is as Figure 2 shown in

[0056] S31: Select the target splitting cluster.

[0057] In the crack detection of cast iron parts, the gray-scale characteristics of the crack region usually have certain differences from the surrounding normal regions, while the gray-scale changes in different crack regions often have high similarities. This phenomenon makes the strategy of relying on the maximum centroid distance between the pixel points in the cluster and the cluster centroid to select the splitting target in each round of iterative splitting of the traditional hierarchical divisive clustering algorithm insufficient to effectively identify the crack region. Specifically, the splitting point selected by the traditional method is based on the maximum distance between the pixel points in the cluster and the cluster centroid. However, since the crack region usually has a slender and irregular shape, its spatial distribution does not always match the geometric shape of the traditional clustering cluster. Therefore, the splitting strategy relying on the maximum centroid distance may cause some large-area normal regions to be mis-split, while the characteristics of the crack region may be ignored or insufficiently split.

[0058] In the normal region of the cast iron part, the gradient directions of the pixel points usually change uniformly, and the gradient direction differences are small because the material background of these regions is roughly uniform and there are no significant structural changes. In contrast, although the edge region of the cast iron part also has a different gradient direction from the normal region, its edge usually extends along a certain specific direction, showing a certain regularity. The shape of the crack region is more irregular and usually shows a sudden change in the gradient direction. This sudden change causes the gradient direction of the pixel points in the crack region to change more randomly, in sharp contrast to the stable distribution of the conventional region.

[0059] Therefore, by analyzing the gradient directions of the pixel points in each cluster, the selectability of each cluster can be quantified. The greater the selectability of a cluster, the stronger the crack characteristics of the pixel points contained in the cluster, that is, the more inconsistent the pixel points contained in the cluster are in terms of gradient direction. During the iterative splitting process, selecting the cluster with greater selectability for splitting can effectively avoid the situation where the traditional clustering algorithm ignores the crack region.

[0060] In one embodiment, before each round of iterative splitting, the selectivity of the generated multiple clusters needs to be evaluated. Specifically, the selectivity of each cluster is quantified based on the sum of the gradient direction differences between two pixels in each cluster. The calculation formula is as follows:

[0061]

[0062] In the formula, For the Before the round of iterative splitting, the first The selectivity of a cluster; For the Before the round of splitting, the first of the multiple clusters generated The first The gradient direction of each pixel is For the Before the round of splitting, the first of the multiple clusters generated The first The gradient direction of each pixel is For the The total number of pixels in a cluster, is the standard normalization function.

[0063] In this formula, Indicates The sum of the gradient direction differences between any two pixels in a cluster. The larger the value, the The more dramatic the change in the gradient direction of the pixels in the cluster, the The pixels contained in the cluster are more likely to be located in the crack area. The larger the selectivity of a cluster, the more The more likely the cluster is to be further subdivided as the target split cluster. The more slowly the gradient direction of the pixels in a cluster changes, the The pixels contained in the cluster are more likely to be located in the normal area. The smaller the selectivity of a cluster, the smaller the selectivity of the cluster. The fewer clusters there are, the less they need to be further subdivided.

[0064] Finally, before each round of iterative splitting, after obtaining the selectivity of all generated clusters, the cluster with the largest selectivity is used as the target splitting cluster for the current round.

[0065] S32: Select a split point.

[0066] In this step, within the target splitting cluster, the saliency value of each pixel point and the centroid distance of this pixel point (the distance between this pixel point and the centroid of the target splitting cluster) are further analyzed. Through weighted calculation, pixel points with higher saliency values and farther centroid distances are considered the most suitable splitting points, and these splitting points represent the parts in the cluster that are most likely to belong to the crack region.

[0067] If only the pixel point with the farthest centroid distance from the centroid is selected as the splitting point for splitting operations based solely on the centroid distance of the pixel point, it is likely that the selected point is a normal pixel point, making this iterative splitting meaningless. Therefore, in this step, the centroid distance of each pixel point is weighted by introducing the saliency value of each pixel point to obtain the weighted centroid distance of each pixel point. Since pixel points in the crack region often exhibit higher saliency, the method of selecting splitting points based on the weighted centroid distance of pixel points can select pixel points with the characteristics of the crack region as splitting points, avoid the operation of selecting pixel points in the normal region as splitting points, reduce the risk of missegmentation, and can achieve a more refined division of the target splitting cluster.

[0068] In one embodiment, the calculation formula for the weighted centroid distance of each pixel point within the target splitting cluster is:

[0069]

[0070] In the formula, is the weighted centroid distance of the th pixel point within the target cluster before the th round of iterative splitting, is the saliency value of the th pixel point within the target cluster before the th round of iterative splitting, is the Euclidean distance between the th pixel point within the target cluster and the centroid of the target cluster before the th round of iterative splitting.

[0071] By performing weighted calculations on the saliency value and centroid distance of each pixel point in the target splitting cluster, the present invention can accurately select splitting points during each round of iterative splitting. Compared with traditional splitting strategies, this method can focus more on the details of the crack region, improve the accuracy of the clustering results, especially in cases where the shape of the crack region is irregular or the boundary is blurred.

[0072] Finally, after obtaining the weighted centroid distances of all pixel points within the target splitting cluster, the pixel point with the largest weighted distance from the centroid among all pixel points in the target splitting cluster is used as the splitting point.

[0073] S33: Perform the splitting operation.

[0074] After determining the target splitting cluster and splitting points, perform the iterative splitting operation for this round according to the steps of the traditional hierarchical splitting clustering algorithm. The splitting operation will divide the target splitting cluster into two or more sub-clusters according to the splitting points, ensuring that the pixel points within each sub-cluster are more uniform and focused on different crack features.

[0075] S34: Iterate until convergence.

[0076] The iterative splitting process will be repeated for multiple rounds. After each round of iterative splitting, this step uses the silhouette coefficient to evaluate the clustering effect obtained after each round of iterative splitting. The silhouette coefficient is a common indicator to measure the quality of clustering results. It combines the within-cluster coherence and between-cluster separation. The value range of the silhouette coefficient is from -1 to 1.

[0077] After each round of iterative splitting, multiple clusters are generated. Each cluster will obtain a silhouette coefficient. Take the mean of the silhouette coefficients of all clusters as the clustering effect index for this round.

[0078] If the change amount of the clustering effect index after a certain round of iterative splitting and the clustering effect index after the previous round of iterative splitting is less than 0.01 (empirical value), stop the iterative splitting. If the change amount of the clustering effect index after a certain round of splitting and the clustering effect index after the previous round of splitting is greater than or equal to 0.01, continue to execute steps S31 - S33 until the iterative splitting stops.

[0079] Finally, through multiple rounds of iterative splitting, multiple final clusters are obtained. Each final cluster has a high degree of aggregation and a low degree of heterogeneity.

[0080] S4: Extract the crack contour according to the clustering result.

[0081] After completing the clustering operation, multiple final clusters are obtained. The regions corresponding to the pixel points contained in each cluster have different spatial distributions in the image. It is crucial to further evaluate the possibility that each final cluster belongs to the crack region. By evaluating the possibility that each final cluster belongs to the crack region, the final clusters belonging to the crack region can be screened out, and further mask operations can be performed on these clusters to extract the complete crack contour of the cast iron part.

[0082] When evaluating the possibility that each final cluster belongs to the crack region, considering that the crack region is often not a regular rectangle or circle, but presents a long and irregular shape, so the difference between the length and width of its minimum bounding rectangle is usually large, forming an obvious difference between the length and width. At the same time, the crack region is usually a local small region, and the number of pixel points it contains is relatively small, while the number of pixel points in the normal region is relatively large. Therefore, the final cluster with a large difference between the length and width and fewer pixel points is more likely to represent the crack region, because these two indicators jointly reflect the shape characteristics and local properties of the crack region.

[0083] In one embodiment, first obtain the minimum bounding rectangle of each final cluster, and use the number of pixel points in each final cluster and the difference in length and width of its minimum bounding rectangle to evaluate the possibility that the final cluster belongs to the crack region. The specific calculation formula is:

[0084]

[0085] In the formula, is the possibility that the -th final cluster belongs to the crack region, is the standard normalization function, is the length of the minimum bounding rectangle of the -th final cluster, is the width of the minimum bounding rectangle of the -th final cluster, is the number of pixel points included in the -th final cluster.

[0086] In this formula, the larger it is, the greater the difference in length and width of the -th final cluster, indicating that the shape of the final cluster is slender and irregular, and the more likely the final cluster belongs to the crack region. The smaller it is, the fewer the number of pixel points included in the final cluster, further increasing the possibility that the final cluster belongs to the crack region.

[0087] Finally, after obtaining the possibility that all final clusters belong to the crack region, a preset possibility threshold is set to 0.6 (empirical value). It is determined that the final clusters with a possibility greater than the preset possibility threshold belong to the crack region, and the final clusters with a possibility less than or equal to 0.6 belong to the normal region.

[0088] Since all the obtained clustering clusters belonging to the crack region are based on the classification results of pixel points, problems such as blurred boundaries and noise interference are likely to exist. Therefore, in this step, the precise contour of the crack region is further extracted through a masking operation to ensure the clarity and accuracy of the crack contour.

[0089] In one embodiment, performing a masking operation on the final clusters belonging to the crack region to extract the crack contour includes:

[0090] Create a blank mask with the same size as the surface image, mark all the pixel points included in all the final clusters belonging to the crack region as white in the blank mask; extract the contour of the region composed of the white pixel points as the crack contour. In , the function can be used to obtain the contour of the region composed of the white pixel points.

[0091] In one embodiment, after extracting the crack profile, post-processing operations are also performed on the extracted crack profile, including but not limited to: denoising operations through image filtering algorithms, edge smoothing operations through Gaussian blur or median filtering, and hole filling operations through morphological operations to ensure the integrity of the crack profile.

[0092] In summary, through the masking operation and post-processing steps, the crack profile can be accurately extracted and the integrity and accuracy of the profile can be ensured. The masking operation provides a clear boundary for the crack area, the contour extraction accurately captures the crack shape, and the post-processing operation ensures the clarity and smoothness of the crack profile. The combination of these steps makes the extraction and analysis of the crack profile more reliable.

[0093] Although this specification has shown and described multiple embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only.

Claims

1. A method for extracting the crack profile of a cast iron part, characterized in that, Including: Collecting the surface image of the cast iron part and preprocessing the surface image; Determining the significance value of each pixel point according to the difference between the gradient magnitude of each pixel point of the surface image and the gradient magnitudes of the surrounding pixel points to reflect the possibility that the pixel point belongs to the crack area; Using the hierarchical splitting clustering algorithm to perform multi-round iterative splitting on all pixel points of the surface image to complete the clustering operation, obtaining multiple final clusters, and evaluating the possibility that each final cluster belongs to the crack area: ; In the formula, is the probability that the th final cluster belongs to the crack region, is the standard normalization function, is the length of the minimum bounding rectangle of the th final cluster, is the width of the minimum bounding rectangle of the th final cluster, is the number of pixel points contained in the th final cluster; Determining that the final clusters with a possibility greater than the preset possibility threshold belong to the crack area, and performing a masking operation on the final clusters belonging to the crack area to extract the crack contour; Before each round of iterative splitting during the clustering operation, perform the following operations: For the multiple clusters that have been generated, determine the selectivity of each cluster according to the sum of the gradient direction differences between pairwise pixel points within each cluster, and use the cluster with the maximum selectivity as the target splitting cluster for the current round; Within the target splitting cluster, weight the distance between each pixel point and the centroid of the target splitting cluster according to the significance value of each pixel point to obtain the weighted centroid distance of each pixel point, and use the pixel point with the maximum weighted centroid distance as the splitting point, and perform the iterative splitting of the current round based on the splitting point; The method for setting the surrounding pixel points of a pixel point is: taking each pixel point as the center, and using all pixel points within the preset range around the center as the surrounding pixel points of the pixel point.

2. The method for extracting the crack profile of the cast iron part according to claim 1, characterized in that, The weighted centroid distance of each pixel point satisfies the following relational expression: ; In the formula, is the weighted centroid distance of the th pixel point in the target cluster before the th round of iterative splitting, is the significance value of the th pixel point in the target cluster before the th round of iterative splitting, is the Euclidean distance between the th pixel point in the target cluster and the centroid of the target cluster before the th round of iterative splitting.

3. The method for extracting the crack profile of a cast iron part according to claim 1, wherein The selectivity of each cluster is calculated based on the following formula: ; In the formula, is the option degree of the -th cluster among the multiple clusters generated before the splitting of the -th round of iteration splitting; is the gradient direction of the -th pixel point in the -th cluster among the multiple clusters generated before the splitting of the -th round; is the gradient direction of the -th pixel point in the -th cluster among the multiple clusters generated before the splitting of the -th round; is the total number of pixel points in the -th cluster; is the standard normalization function.

4. The method for extracting the crack profile of the cast iron part according to claim 1, characterized in that, The significance value of each pixel point is determined based on the following formula: ; Wherein, is the significance value of the th pixel point, is the gradient magnitude of the th pixel point, is the maximum value of the gradient magnitudes of all pixel points in the surface image, is the number of neighboring pixel points of the th pixel point, is the gradient magnitude of the th neighboring pixel point of the th pixel point, is the standard normalization function, is the absolute value symbol.

5. The method for extracting the crack profile of the cast iron part according to claim 1, characterized in that, Performing a masking operation on the final clusters belonging to the crack area to extract the crack contour includes: Creating a blank mask with the same size as the surface image, marking all pixel points included in all final clusters belonging to the crack area as white in the blank mask; extracting the contour of the area composed of the white pixel points as the crack contour.

6. The method for extracting the crack profile of the cast iron part according to claim 1, wherein The preprocessing includes: Converting the surface image to grayscale, and using the Sobel operator to obtain the gradient magnitude and gradient direction of each pixel point.

7. The method for extracting the crack profile of the cast iron part according to claim 1, wherein After extracting the crack contour, post-processing operations are also performed on the extracted crack contour, and the post-processing operations include: denoising, edge smoothing, and hole filling.

8. The method for extracting the crack profile of the cast iron part according to claim 7, characterized in that The denoising is implemented through an image filtering algorithm, the edge smoothing is implemented through Gaussian blur or median filtering, and the hole filling is implemented through morphological operations.

Citation Information

Patent Citations

  • Pavement crack detection system based on emulsified high-viscosity asphalt

    CN116934748A

  • Film breakage detection device and detection system

    CN117333489A