Method for extracting crack contour of iron casting

By using the method of significant value and gradient direction difference evaluation in crack detection of cast iron parts, the hierarchical split clustering algorithm is optimized, which solves the problem of missegment of traditional methods and improves the accuracy of crack profile extraction.

CN120107269AActive Publication Date: 2025-06-06陕西炬星海工贸有限责任公司
View PDF 6 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Traditional hierarchical split clustering algorithms are prone to missegment in crack detection of cast iron parts, affecting the accuracy and effect of crack profile extraction.

Method used

By collecting the surface image of the cast iron part, the significant value of each pixel point is calculated after preprocessing, combining the hierarchical splitting clustering algorithm, and evaluating the selectivity of the cluster based on the gradient direction differences of the pixel points in the cluster before each iteration split, selecting clusters with greater selectivity for splitting, and weighting the centroid distance according to the significant value of the pixel points, and selecting split points.

Benefits of technology

The segmentation accuracy of the crack area of ​​cast iron parts is improved, the missed segmentation is reduced, and the accuracy and effect of crack profile extraction is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120107269A_ABST
    Figure CN120107269A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to an iron casting crack contour extraction method, which comprises the following steps: acquiring and preprocessing a surface image of an iron casting, and calculating a saliency value of each pixel point by utilizing the difference between a gradient magnitude and surrounding pixel points; and carrying out multi-round iterative splitting on the image by adopting a hierarchical splitting clustering algorithm, and evaluating the possibility that each cluster belongs to a crack region. And screening a crack region cluster according to a set threshold value, and extracting a crack contour through mask operation. Before each iteration splitting, a target splitting cluster is determined according to the gradient direction difference of pixel points in the cluster, a significant value is used for weighting splitting points, and the most suitable splitting point is selected for iteration splitting. According to the method, by optimizing the clustering operation, the crack contour of the iron casting can be accurately extracted, wrong segmentation is reduced, and the accuracy and reliability of crack contour extraction are improved.
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, and in particular to a method for extracting crack contours 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 cause the failure of parts, and thus affect the safety of the entire mechanical system. Therefore, accurately and quickly detecting and extracting the outline of cracks in cast iron parts has become a key issue in ensuring the quality of cast iron parts.

[0003] In order to improve the accuracy of crack detection, clustering algorithms are widely used in crack area segmentation. Clustering algorithms can divide images into multiple regions based on the grayscale value, texture information or other features of pixels, thereby realizing automatic extraction of crack areas. As an effective clustering method, the hierarchical splitting clustering algorithm can gradually refine the cluster division through multiple rounds of iterative splitting, thereby improving the accuracy of crack identification.

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

[0005] However, in crack detection of cast iron parts, the crack area usually has an irregular shape and relatively subtle grayscale changes. The grayscale changes of these cracks are often relatively gentle and have certain similarities with the grayscale changes of the surrounding normal areas. Especially when the crack boundary is fuzzy or the grayscale changes are not obvious, the traditional hierarchical split clustering algorithm relies on the centroid distance for splitting, so it is easy to mis-segment the crack area as part of the normal area, thus affecting the accuracy and effect of crack contour extraction. Summary of the invention

[0006] In order to solve the problem that when extracting crack contours for cast iron parts, the traditional hierarchical splitting clustering algorithm relies on the centroid distance of pixels within the cluster to split, which is prone to mis-segmentation and affects the accuracy and effect of crack contour extraction, the present invention proposes a method for extracting crack contours for cast iron parts, which includes: The surface image of the cast iron part is collected and preprocessed; the significance value of each pixel point is determined according to the difference between the gradient amplitude of each pixel point of the surface image and the gradient amplitude of the surrounding pixel points to reflect the possibility that the pixel point belongs to the crack area; A hierarchical split clustering algorithm is used to perform multiple rounds of iterative splitting on all pixels of the surface image to complete the clustering operation and obtain multiple final clusters. The possibility of each final cluster belonging to the crack area is evaluated, and the final cluster with a possibility greater than a preset possibility threshold is determined to belong to the crack area. A mask operation is performed on the final cluster belonging to the crack area to extract the crack contour. The clustering operation performs the following operations before each round of iterative splitting: For the generated multiple clusters, the selectivity of each cluster is determined according to the sum of the gradient direction differences between the two pixels in each cluster, and the cluster with the largest selectivity is used as the target splitting cluster for the current round; In the target split cluster, the distance between each pixel and the centroid of the target split cluster is weighted according to the saliency value of each pixel to obtain the weighted centroid distance of each pixel. The pixel with the largest weighted centroid distance is taken as the split point, and the current round of iterative splitting is performed based on the split point.

[0007] This technical solution acquires visual information of the surface of cast iron parts by collecting images, providing a data basis for subsequent crack detection, and preprocessing can remove interference in the image and improve the quality of the image. In addition, by using the gradient amplitude difference of pixel points to calculate the significant value, those pixels with relatively large grayscale changes can be highlighted. These pixels are more likely to be located in the crack area, and the significant value is used to quantify this possibility. In addition, the hierarchical split clustering algorithm is used to cluster all the pixels in the image, and the clustering division of the pixels in the surface image of the cast iron parts is realized. The crack area is determined by evaluation and screening, and the crack contour is extracted, achieving the purpose of detecting and extracting the crack contour of the cast iron parts. In addition, before each round of iterative splitting of the hierarchical split clustering algorithm, specific operations are performed, including: measuring the selectivity of each cluster. The structural differences of the pixels in the cluster with large selectivity are large, and further splitting and refinement are needed. Based on the selectivity, the target cluster with the most splitting value can be screened out from multiple clusters, which improves the pertinence and efficiency of the clustering operation. When selecting split points 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, making it more likely that the selected split points are located at key positions such as the boundary of the crack area, thereby splitting the target cluster more accurately, further improving the accuracy of clustering, helping to reduce the occurrence of mis-segmentation, and more accurately extracting the crack contour on the surface of the cast iron part.

[0008] Furthermore, the weighted centroid distance of each pixel satisfies the following relationship:

[0009] In the formula, For the Before the round of iterative splitting, the first The weighted centroid distance of pixels, For the Before the round of iterative splitting, the first The saliency value of each pixel, For the Before the round of iterative splitting, the first The Euclidean distance between a pixel and the centroid of the target cluster.

[0010] This technical solution combines the significance value of the pixel points when calculating the weighted centroid distance of the pixel points. The pixel points with higher significance value have a larger weight in the weighted centroid distance, which means that the algorithm will pay more attention to those pixels that are more likely to belong to the crack area, which helps to capture the contour information of the crack more accurately during the clustering process and avoid missegmentation.

[0011] Furthermore, the selectivity of each cluster is calculated based on the following formula:

[0012] 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.

[0013] This technical solution provides an objective indicator for splitting decisions. The greater the selectivity, the greater the difference in gradient direction of pixels within the cluster, the more complex the structure within the cluster, and the more likely it is to contain different feature areas, such as crack areas and non-crack areas. Therefore, the more splitting is needed, so that clusters that may have problems can be processed more specifically, rather than blindly splitting according to fixed rules, making the clustering process more intelligent and efficient.

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

[0015] In the formula, For the The saliency value of each pixel, For the The gradient amplitude of each pixel, is the maximum value of the gradient amplitude of all pixels in the surface image, For the The number of pixels around a pixel, For the The first pixel of the surrounding pixels of the pixel The gradient amplitude of each pixel, is the standard normalization function, To find the absolute value sign.

[0016] This technical solution takes into account that crack areas usually have obvious grayscale changes, and the gradient amplitude of its pixels is often large, and is significantly different from the gradient amplitude of pixels in the surrounding normal areas. Through the significant value of the pixel points, these pixels with large gradient amplitudes and large differences from the surrounding can be highlighted, and the pixels that may belong to the crack area can be preliminarily located.

[0017] Furthermore, the probability of each final cluster belonging to the crack region is determined based on the following formula:

[0018] In the formula, For the The probability that the final cluster belongs to the crack region, is the standard normalization function, For the The length of the minimum bounding rectangle of the final clusters, For the The width of the minimum bounding rectangle of the final cluster, For the The number of pixels contained in the final cluster.

[0019] This technical solution considers that the crack area may have specific shape characteristics and pixel distribution patterns. The size of the minimum circumscribed rectangle can reflect the shape and size of the cluster, while the number of pixels reflects the density of the cluster. By combining these factors, the similarity between each final cluster and the crack area can be more accurately evaluated, thereby judging the possibility that it belongs to the crack area.

[0020] Further, performing a masking operation on the final clusters belonging to the crack region to extract the crack contour includes: Create a blank mask with the same size as the surface image, mark all pixels contained in the final cluster belonging to the crack area as white in the blank mask; extract the outline of the area composed of white pixels as the crack outline.

[0021] Furthermore, the preprocessing includes: graying the surface image, and obtaining the gradient magnitude and gradient direction of each pixel using a Sobel operator.

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

[0023] Furthermore, after the crack contour is extracted, a post-processing operation is performed on the extracted crack contour, and the post-processing operation includes but is not limited to: denoising, edge smoothing, and hole filling to ensure the integrity of the crack contour.

[0024] Furthermore, the denoising is achieved through an image filtering algorithm, the edge smoothing is achieved through Gaussian blur or median filtering, and the hole filling is achieved through morphological operations.

[0025] The present invention has the following effects: The present invention proposes an improved method for determining splitting points based on weighted centroid distance of pixel points. The method optimizes the segmentation process of crack areas by introducing an evaluation of gradient direction differences of pixel points within a cluster. Compared with a traditional hierarchical splitting clustering algorithm, the present invention first determines the selectivity of a cluster according to the gradient direction differences of pixel points within each cluster before each round of cluster splitting, and preferentially selects clusters containing more crack features for splitting. Combined with a weighted splitting strategy for pixel points based on saliency values, the crack area can be extracted more accurately, especially when the crack grayscale change is not obvious or the crack boundary is blurred, thereby reducing the occurrence of mis-segmentation and improving the effect and accuracy of crack contour extraction of cast iron parts. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a schematic flow chart of the method of the present invention; Figure 2 It is a schematic diagram of the method flow of step S3 of the present invention. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0028] The present invention provides a method for extracting crack profile of a cast iron part, such as Figure 1 As shown in, including: S1: Collect surface images of cast iron parts and perform preprocessing.

[0029] Select a suitable angle and distance to fix the industrial camera, and collect the surface image of the cast iron in a uniformly illuminated environment, and cut out the irrelevant background area so that only the cast iron area is retained in the surface image. Then, the surface image is grayed, and the Sobel operator is used to obtain the gradient amplitude and gradient direction of each pixel in the surface image.

[0030] S2: Determine the saliency value of each pixel.

[0031] On the surface of cast iron, crack contours usually appear in the transition zone 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 contours will have significant grayscale changes in the image, especially the grayscale value changes in the horizontal or vertical direction are more drastic. Therefore, in order to effectively extract the crack contour, the possibility of the pixel point belonging to the crack area can be preliminarily evaluated by analyzing whether the edge features of the pixel point are obvious.

[0032] This step determines the saliency value of each pixel by analyzing the difference between the gradient amplitude of the pixel and the gradient amplitude of the surrounding pixels. The larger the saliency value, the more likely the pixel is to be located in the crack area. Conversely, the smaller the saliency value, the more likely the pixel is to be located in areas other than the crack area.

[0033] In one embodiment, each pixel is taken as the center, and all the pixels in the 8-neighborhood range around the pixel are taken as the surrounding pixels of the pixel. Then, the saliency value of each pixel is calculated according to the following formula:

[0034] In the formula, For the The saliency value of each pixel, For the The gradient amplitude of each pixel, is the maximum value of the gradient amplitude of all pixels in the surface image, For the The number of pixels around a pixel, For the The first pixel of the surrounding pixels of the pixel The gradient amplitude of each pixel, is the standard normalization function, To find the absolute value sign.

[0035] In this formula, and The fraction represents the The relative edge strength of a pixel in the entire surface image. The gradient amplitude of a pixel reflects the intensity of the grayscale change of the pixel. A larger gradient amplitude usually means that the pixel is at the edge of the image. If the gradient amplitude of a pixel is larger than 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 pixel point in the entire surface image, the greater the The more a pixel is located at a significant edge position in the surface image, the greater the possibility that it belongs to the crack area.

[0036] In this formula, Indicates The sum of the differences in the gradient amplitude between the pixel and its surrounding pixels. The larger the value of the sum of the differences, the The greater the grayscale change between a pixel and its surrounding pixels, the more likely the pixel is to be in the crack area. This is because the crack area usually shows a more drastic grayscale change, and the gradient amplitude difference between the pixel in the crack area and its neighboring pixels is large, while the grayscale value of the pixel in the normal area is relatively smooth, and the gradient amplitude difference is small.

[0037] In general, if the saliency value of a pixel is larger, it means that the pixel not only has a stronger edge strength (i.e., a larger gradient amplitude), but also has a larger difference in gradient amplitude with the 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 saliency value, the crack area can be effectively distinguished from the normal area. In particular, when the boundary of the crack area is fuzzy and the grayscale change is subtle, the saliency value can provide effective support.

[0038] S3: Optimize the iterative splitting process of the hierarchical divisive clustering algorithm to obtain the clustering results.

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

[0040] Specifically, before each round of iterative splitting, multiple clusters are generated. Then, it is determined which cluster needs to be further subdivided, and the cluster that needs to be further subdivided is used as the target splitting cluster. In the target splitting cluster, it is determined which pixel point is the appropriate splitting point, and iterative splitting operations are performed based on the splitting point to more accurately extract the crack area.

[0041] The specific process is as follows Figure 2As shown in, including: S31: Select a target split cluster.

[0042] In crack detection of cast iron parts, the grayscale features of the crack area are usually different from those of the surrounding normal areas, while the grayscale changes of different crack areas often have high similarity. This phenomenon makes the traditional hierarchical splitting clustering algorithm, which relies on the maximum centroid distance between the pixels in the cluster and the cluster centroid to select the splitting target in each round of iterative splitting, insufficient to effectively identify the crack area. Specifically, the splitting point selected by the traditional method is based on the maximum distance between the pixels in the cluster and the cluster centroid, but because the crack area usually has a slender and irregular shape, its spatial distribution and the geometric shape of the traditional clustering cluster are not always consistent. Therefore, the splitting strategy that relies on the maximum centroid distance may cause some large areas of normal areas to be split by mistake, while the characteristics of the crack area may be ignored or split insufficiently.

[0043] In the normal area of ​​the cast iron, the gradient direction of the pixel points usually changes evenly, and the gradient direction difference is small, because the material background of these areas is roughly uniform and there is no significant structural change. In contrast, although the edge area of ​​the cast iron also has a gradient direction different from the normal area, its edge usually extends in a specific direction, showing a certain regularity. The morphology of the crack area is more irregular, usually showing a sudden change in the gradient direction. This mutation causes the gradient direction of the pixel points in the crack area to change more disorderly, which is in sharp contrast to the smooth distribution of the conventional area.

[0044] Therefore, the selectivity of each cluster can be quantified by analyzing the gradient direction of the pixels in each cluster. The larger the selectivity of a cluster, the stronger the crack characteristics of the pixels contained in the cluster, that is, the more inconsistent the pixels contained in the cluster are in the gradient direction. In the iterative splitting process, clusters with larger selectivity are selected for splitting, which can effectively avoid the situation where the traditional clustering algorithm ignores the crack area.

[0045] 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:

[0046] 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.

[0047] 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.

[0048] 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.

[0049] S32: Select a split point.

[0050] In this step, the saliency value of each pixel and the distance to the centroid of the pixel (the distance between the pixel and the centroid of the target split cluster) are further analyzed within the target split cluster. Through weighted calculation, the pixel with higher saliency value and farther distance to the centroid is considered to be the most suitable split point, which represents the part of the cluster that is most likely to belong to the crack area.

[0051] If the pixel with the farthest centroid is selected as the splitting point for splitting operation based only on the centroid distance of the pixel points, it is easy for the selected point to be a normal pixel point, making this iterative splitting meaningless. Therefore, this step introduces the significance value of each pixel point to perform weighted calculation on its centroid distance to obtain the weighted centroid distance of each pixel point. Because the pixels in the crack area often show high significance, the method of selecting splitting points based on the weighted centroid distance of the pixel points can select pixels with crack area characteristics as splitting points, avoid selecting pixels in the normal area as splitting points, reduce the risk of mis-segmentation, and achieve a more refined division of the target split cluster.

[0052] In one embodiment, the weighted centroid distance of each pixel in the target split cluster is calculated as follows:

[0053] In the formula, For the Before the round of iterative splitting, the first The weighted centroid distance of pixels, For the Before the round of iterative splitting, the first The saliency value of each pixel, For the Before the round of iterative splitting, the first The Euclidean distance between a pixel and the centroid of the target cluster.

[0054] By weighting the saliency value and centroid distance of each pixel in the target split cluster, the present invention can accurately select the split point in each round of iterative splitting. Compared with the traditional splitting strategy, this method can focus more on the details of the crack area and improve the accuracy of the clustering results, especially when the crack area has an irregular shape or fuzzy boundaries.

[0055] Finally, after obtaining the weighted centroid distance of all pixels in the target split cluster, the distance from the centroid of all pixels in the target split cluster is weighted, and the pixel with the largest weighted centroid distance is used as the split point.

[0056] S33: Execute a split operation.

[0057] After determining the target split cluster and split point, the iterative split operation of this round is performed according to the steps of the traditional hierarchical split clustering algorithm. The split operation will divide the target split cluster into two or more sub-clusters according to the split point, ensuring that the pixels in each sub-cluster are more uniform and focus on different crack features.

[0058] S34: Iterate until convergence.

[0059] 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 for measuring the quality of clustering results. It combines the intra-cluster consistency and inter-cluster separation. The value range of the silhouette coefficient is from -1 to 1.

[0060] After each round of iterative splitting, multiple clusters will be generated, each cluster will get a silhouette coefficient, and the mean of the silhouette coefficients of all clusters will be used as the clustering effect indicator of this round.

[0061] If the change in the clustering effect index after a round of iterative splitting is less than 0.01 (empirical value), stop iterative splitting. If the change in the clustering effect index after a round of splitting is greater than or equal to 0.01, continue to perform steps S31-S33 until the iterative splitting is stopped.

[0062] Finally, through multiple rounds of iterative splitting, multiple final clusters are obtained, each of which has a higher degree of aggregation and lower heterogeneity.

[0063] S4: Extract crack contours based on clustering results.

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

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

[0066] In one embodiment, the minimum bounding rectangle of each final cluster is first obtained, and the number of pixels of each final cluster and the length and width difference of its minimum bounding rectangle are used to evaluate the possibility that the final cluster belongs to the crack area. The specific calculation formula is:

[0067] In the formula, For the The probability that the final cluster belongs to the crack region, is the standard normalization function, For the The length of the minimum bounding rectangle of the final clusters, For the The width of the minimum bounding rectangle of the final cluster, For the The number of pixels contained in the final cluster.

[0068] In this formula, The larger the The large difference in length and width between the final clusters indicates that the final cluster is slender and irregular in shape, and the final cluster is more likely to belong to the crack area. The smaller it is, the fewer pixels the final cluster contains, which further increases the possibility that the final cluster belongs to the crack area.

[0069] Finally, after obtaining the probability that all final clusters belong to the crack area, the probability threshold is preset to 0.6 (empirical value), and the final clusters with a probability greater than the preset probability threshold are judged to belong to the crack area, and the final clusters with a probability less than or equal to 0.6 are judged to belong to the normal area.

[0070] Since all the clusters currently obtained belonging to the crack area are based on the classification results of pixel points, they are prone to problems such as blurred boundaries and noise interference. Therefore, this step further extracts the precise outline of the crack area through mask operation to ensure the clarity and accuracy of the crack outline.

[0071] In one embodiment, performing a masking operation on the final clusters belonging to the crack region to extract the crack contour includes: Create a blank mask with the same size as the surface image, mark all pixels in the final cluster belonging to the crack area as white in the blank mask; extract the outline of the area composed of white pixels as the crack outline. In the The function obtains the outline of the area composed of white pixels.

[0072] In one embodiment, after extracting the crack contour, the extracted crack contour is also post-processed, including but not limited to: denoising operation through image filtering algorithm, edge smoothing operation through Gaussian blur or median filtering, and hole filling operation through morphological operation to ensure the integrity of the crack contour.

[0073] In summary, through masking and post-processing steps, the crack contour can be accurately extracted and the integrity and accuracy of the contour can be guaranteed. 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 contour. The combination of these steps makes the extraction and analysis of the crack contour more reliable.

[0074] While various embodiments of the present invention have been shown and described herein, 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 crack profile of cast iron parts, characterized in that: include: Collecting surface images of cast iron parts and preprocessing the surface images; Determine the significance value of each pixel point according to the difference between the gradient amplitude of each pixel point of the surface image and the gradient amplitude of the surrounding pixels to reflect the possibility that the pixel point belongs to the crack area; A hierarchical split clustering algorithm is used to perform multiple rounds of iterative splitting on all pixels of the surface image to complete the clustering operation and obtain multiple final clusters. The possibility of each final cluster belonging to the crack area is evaluated, and the final cluster with a possibility greater than a preset possibility threshold is determined to belong to the crack area. A mask operation is performed on the final cluster belonging to the crack area to extract the crack contour. The clustering operation performs the following operations before each round of iterative splitting: For the generated multiple clusters, the selectivity of each cluster is determined according to the sum of the gradient direction differences between the two pixels in each cluster, and the cluster with the largest selectivity is used as the target split cluster for the current round; In the target split cluster, the distance between each pixel and the centroid of the target split cluster is weighted according to the saliency value of each pixel to obtain the weighted centroid distance of each pixel. The pixel with the largest weighted centroid distance is taken as the split point, and the current round of iterative splitting is performed based on the split point.

2. The method for extracting crack profile of cast iron parts according to claim 1, characterized in that: The weighted centroid distance of each pixel satisfies the following relationship: ; In the formula, For the Before the round of iterative splitting, the first The weighted centroid distance of pixels, For the Before the round of iterative splitting, the first The saliency value of each pixel, For the Before the round of iterative splitting, the first The Euclidean distance between a pixel and the centroid of the target cluster.

3. The method for extracting crack profile of cast iron parts according to claim 1, characterized in that: The selectivity of each cluster is calculated based on the following formula: ; 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.

4. The method for extracting crack profile of cast iron parts according to claim 1, characterized in that: The saliency value of each pixel is determined based on the following formula: ; In the formula, For the The saliency value of each pixel, For the The gradient amplitude of each pixel, is the maximum value of the gradient amplitude of all pixels in the surface image, For the The number of pixels around a pixel, For the The first pixel of the surrounding pixels of the pixel The gradient amplitude of each pixel, is the standard normalization function, To find the absolute value sign.

5. The method for extracting crack profile of cast iron parts according to claim 1, characterized in that: The probability of each final cluster belonging to the crack region is determined based on the following formula: ; In the formula, For the The probability that the final cluster belongs to the crack region, is the standard normalization function, For the The length of the minimum bounding rectangle of the final clusters, For the The width of the minimum bounding rectangle of the final cluster, For the The number of pixels contained in the final cluster.

6. The method for extracting crack profile of cast iron parts according to claim 1, characterized in that: Masking operations are performed on the final clusters belonging to the crack region to extract the crack contours including: Create a blank mask with the same size as the surface image, mark all pixels contained in the final cluster belonging to the crack area as white in the blank mask; extract the outline of the area composed of white pixels as the crack outline.

7. The method for extracting crack profile of cast iron parts according to claim 1, characterized in that: Preprocessing includes: The surface image is grayed out, and the Sobel operator is used to obtain the gradient magnitude and gradient direction of each pixel.

8. The method for extracting crack profile of cast iron parts according to claim 4, characterized in that: The method for setting the surrounding pixels of a pixel point is: taking each pixel point as the center, and taking all the pixels around the center within a preset range as the surrounding pixels of the pixel point.

9. The method for extracting crack profile of cast iron parts according to claim 6, characterized in that: After the crack contour is extracted, a post-processing operation is performed on the extracted crack contour, and the post-processing operation includes but is not limited to: denoising, edge smoothing, and hole filling to ensure the integrity of the crack contour.

10. The method for extracting crack profile of cast iron parts according to claim 9, characterized in that: The denoising is achieved by an image filtering algorithm, the edge smoothing is achieved by Gaussian blur or median filtering, and the hole filling is achieved by 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

  • Road pavement construction quality detection method and system

    CN117557569A

  • Stone grinding defect area segmentation method based on visual analysis

    CN117745724A

  • Intelligent detection method and system for shaft forgings

    CN119399209A