Aluminum alloy casting machining forming quality evaluation method
Through multi-angle image acquisition and watershed algorithm combined with Fourier transform method, the accuracy problem of surface defect detection of aluminum alloy castings in traditional methods is solved, and more efficient defect identification and quality evaluation is achieved.
Patent Information
- Application Number
- CN202510953763.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-07-11
AI Technical Summary
The existing surface defect detection method of aluminum alloy castings based on the K-means clustering algorithm is difficult to accurately identify defects such as cracks and scratches in complex forms, resulting in misjudgment or missed inspection, affecting the evaluation of the processing and forming quality of aluminum alloy castings.
Multi-angle image acquisition, watershed algorithm and connectivity domain analysis combined with Fourier transform are used to screen suspected defective pixel points through brightness defect coefficients, analyze the density of edge pixel points, and build shape feature vectors for clustering to accurately identify and evaluate defect areas of aluminum alloy castings.
The accuracy of surface defect detection of aluminum alloy castings is improved, the misjudgment and missed detection rate is reduced, and the reliability of the molding quality evaluation results of aluminum alloy castings is ensured.
Smart Images

Figure CN120451164A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for evaluating the processing and molding quality of aluminum alloy castings. Background Art
[0002] Aluminum alloy castings, as an important component of many industrial products, are used in many fields due to their high strength, corrosion resistance, and good ductility. CNC machining centers, as key equipment in modern intelligent manufacturing, play a core role in the forming and processing of aluminum alloy castings. Through high-precision automated control, they can achieve milling, drilling, grinding and other processing procedures for complex structural castings, improving production efficiency and precision. However, during the processing, factors such as tool wear, improper cutting parameters, and clamping errors can still cause defects such as scratches and cracks to appear on the surface of the castings. In order to ensure the quality of aluminum alloy castings, defect detection and quality assessment are usually required to prevent unqualified products from entering the market and causing safety hazards.
[0003] At present, the K-means clustering algorithm is a common surface defect detection method. It can perform surface defect detection on equipment and workpieces in the production process. The algorithm usually first obtains the surface image of the equipment or workpiece, and then performs feature extraction and cluster analysis on the surface image data to achieve preliminary identification of defects to a certain extent.
[0004] However, the molding process of aluminum alloy castings dictates the complexity and diversity of the morphology of defect areas such as cracks and scratches. During the die-casting process, microcracks caused by uneven mold temperatures and excessively fast aluminum liquid filling are only tens of microns wide, similar in color to the substrate, and have blurred boundaries. Scratches caused by improper demolding can reach tens of millimeters in length and vary in direction and depth. These characteristics lead to non-uniformity, complexity, and discontinuity in the grayscale distribution, geometric outline, and texture characteristics of the defect area, resulting in complex boundary features.
[0005] Traditional defect detection methods based on K-means clustering rely solely on the similarity of color and texture information, making it difficult to capture the spatial distribution and orientation of defective areas, making it difficult to accurately distinguish them from normal areas. This inability to fully and accurately describe defect characteristics makes it prone to misjudgments or missed detections, impacting the accuracy of detection results and preventing accurate quality assessment. Summary of the Invention
[0006] In order to solve the problem that the defect detection results of aluminum alloy casting surfaces using traditional clustering methods are not accurate enough, which affects the processing and molding quality assessment of aluminum alloy castings, the present invention proposes a method for evaluating the processing and molding quality of aluminum alloy castings, which includes: Acquire multi-angle images of the aluminum alloy casting surface, determine the brightness defect coefficient of each pixel based on the difference in grayscale value between each pixel and its neighboring pixels in the multi-angle image; and determine suspected defective pixels based on the comparison result of the brightness defect coefficient and a preset brightness defect coefficient threshold; The watershed algorithm is used to segment all suspected defective pixels based on their brightness defect coefficients, with the pixels located on the ridges being the target pixels. Connected domain analysis is performed on all target pixels, and each closed connected domain obtained is regarded as a suspected defective area. Obtain all edge pixels of each suspected defect area, determine the density of each edge pixel based on the distance between each edge pixel and other edge pixels, and the difference in brightness defect coefficient between each edge pixel and other edge pixels, and filter out all characteristic edge pixels of each suspected defect area based on the density; A Fourier transform is performed on the coordinate sequence of all characteristic edge pixel points of each suspected defect area, and several low-frequency coefficients are extracted from the transformation results to form the shape feature vector of each suspected defect area. Clustering is performed based on the shape feature vectors of all suspected defect areas, and each cluster obtained is a defect area. The processing and forming quality of aluminum alloy castings is evaluated based on the defect areas.
[0007] The above technical solution increases the possibility of discovering potential defects by capturing images from multiple angles. The brightness defect coefficient determined by grayscale value difference analysis provides a preliminary range for subsequent further processing and accurate defect identification. Furthermore, the watershed algorithm can further accurately divide suspected defect pixels into different suspected defect areas. Furthermore, by analyzing the density of edge pixels, considering the spatial relationship between pixels and the difference in brightness defect coefficients, representative edge pixels can be highlighted. The edge features of these edge pixels are critical for accurately identifying the type and shape of defects. By screening out characteristic edge pixels, the key features of the defect area can be better extracted and redundant information can be reduced. Furthermore, the coordinate sequence in the time domain is converted to the frequency domain for analysis through Fourier transform. The low-frequency coefficients can reflect the main shape characteristics of the image. The shape feature vector composed of the low-frequency coefficients can effectively quantify and extract features of the complex defect area shape, making the feature differences of different defect areas more obvious. Moreover, clustering is performed based on the shape feature vector, and defect areas of similar shapes can be classified into one category, thereby improving the accuracy and systematicness of defect detection. Compared with traditional methods, it can more accurately identify defects of different shapes, reduce the misjudgment and missed detection rates, and improve the accuracy of defect detection on the surface of aluminum alloy castings.
[0008] Furthermore, the brightness defect coefficient of each pixel is determined according to the following method: For any pixel, calculate the mean gray value of the pixel in the multi-angle image , the average grayscale value of the eight neighboring pixels of the pixel in the multi-angle image , the standard deviation of the grayscale mean of the eight neighboring pixels of the pixel in the multi-angle image ; Calculate the brightness defect coefficient of the pixel as , where is the brightness defect coefficient of the pixel, is the normalization function, is the absolute value symbol.
[0009] The above technical solution fully utilizes the image data collected from different angles by calculating the grayscale value mean of the pixel point in the multi-angle image, as well as the mean and standard deviation of the grayscale mean of its eight neighborhood pixels in the multi-angle image. The multi-angle information can more comprehensively reflect the grayscale characteristics of the pixel point and its neighborhood, thereby improving the accuracy of the calculation of the brightness defect coefficient of each pixel point.
[0010] Furthermore, the density of each edge pixel is determined based on the following method: Where, For the The first suspected defect area The density of edge pixels, It is The first suspected defect area The edge pixel and the The first suspected defect area The Euclidean distance between edge pixels, For the The first suspected defect area The edge pixel and the The maximum Euclidean distance between other edge pixels in the suspected defect area, 、 They are The first suspected defect area edge pixels, The brightness defect coefficient of edge pixels, For the The total number of edge pixels in the suspected defect area, is the natural exponential function.
[0011] The above technical solution determines the density by simultaneously considering the spatial distance between edge pixels and the difference in brightness defect coefficients. It not only pays attention to the proximity of pixel points in spatial position, but also combines their similarity in defect characteristics. This comprehensive consideration can more comprehensively reflect the true characteristics of the defect edge.
[0012] Furthermore, the multi-angle image includes an image at 60 degrees to the left, an image at 30 degrees to the left, an image at 0 degrees, an image at 30 degrees to the right, and an image at 60 degrees to the right, and the image at 0 degrees is an image facing the surface of the aluminum alloy casting.
[0013] Furthermore, suspected defective pixels are determined based on the following method: If the brightness defect coefficient of a pixel is greater than the preset brightness defect coefficient threshold, the pixel is a suspected defective pixel; if the brightness defect coefficient of a pixel is not greater than the preset brightness defect coefficient threshold, the pixel is a normal pixel.
[0014] Furthermore, all characteristic edge pixels of each suspected defect area are screened according to the following method: The density of all edge pixels in each suspected defect area is obtained and sorted from small to large. The edge pixels with a density greater than or equal to the third quartile are used as the characteristic edge pixels in the suspected defect area using the quantile method.
[0015] The above technical solution reduces the computational burden of subsequent Fourier transform operations by screening feature edge pixels. At the same time, since the pixels with a high density are retained, these points contain key information about the edge of the defect area, such as shape, contour and other features. This can reduce the amount of data without losing important defect feature information.
[0016] Furthermore, the clustering method based on the shape feature vectors of all suspected defect areas is as follows: First, the shape feature vector of each suspected defect area is normalized to obtain the normalized shape feature vector. Then, the K-means clustering algorithm is used to set the cluster center. Clustering operation is performed based on the similarity between the shape feature vectors of other suspected defect areas and the shape feature vector of the cluster center. The similarity of the shape feature vectors is determined by the Euclidean distance between other suspected defect areas and the cluster center.
[0017] Furthermore, the shape feature vector of each suspected defect area is determined based on the following method: Perform Fourier transform on the coordinate sequence of all characteristic edge pixel points of each suspected defect area to obtain a Fourier descriptor. Extract the first M low-frequency coefficients in the Fourier descriptor and normalize them. The normalized first M low-frequency coefficients constitute the shape feature vector of the suspected defect area, where M is a preset value.
[0018] The above technical solution can more comprehensively and meticulously reflect the shape information of the defect by extracting low-frequency coefficients through Fourier transform. The normalized first M low-frequency coefficients constitute a shape feature vector, providing a quantitative shape description for each suspected defect area. This feature vector can be used as the shape feature representation of the area, which is conducive to the subsequent accurate clustering analysis of the defect area based on shape features.
[0019] Furthermore, the distance between each edge pixel and other edge pixels is obtained as follows: Taking the 0-degree image as the reference, the horizontal right direction is set as the positive direction of the horizontal axis, and the vertical upward direction is set as the positive direction of the vertical axis. A plane rectangular coordinate system is constructed to obtain the coordinates of each edge pixel point of each suspected defect area. Based on the coordinates of each edge pixel point, the Euclidean distance between each edge pixel point and other edge pixel points is obtained, and the Euclidean distance is used as the distance between each edge pixel point and other edge pixel points.
[0020] Furthermore, the method for evaluating the processing and forming quality of aluminum alloy castings based on defect areas is as follows: Calculate the circularity and aspect ratio of each defect area, and divide all defect areas into pore areas or crack areas according to the circularity and aspect ratio; count the number of all pore areas, and calculate the total area of all crack areas. If the number of pore areas does not exceed the preset number threshold, and the total area of all crack areas does not exceed the preset area ratio threshold, the molding quality of the aluminum alloy casting is judged to be qualified; if the number of pore areas exceeds the preset number threshold or the total area of all crack areas exceeds the preset area ratio threshold, the molding quality of the aluminum alloy casting is judged to be unqualified.
[0021] The present invention has the following effects: By adopting a multi-angle image acquisition strategy, the present invention more accurately reflects the grayscale characteristics of each pixel point and its neighborhood on the surface of the aluminum alloy casting. By introducing a watershed algorithm and connected domain analysis, different suspected defect areas can be clearly defined, avoiding misjudgments caused by difficult-to-determine boundaries. Furthermore, a shape feature vector is constructed based on the Fourier transform results of the coordinate sequence of the characteristic edge pixel points of each suspected defect area, which can more comprehensively and meticulously reflect the shape information of the suspected defect area. Through clustering operations, defect areas of similar shapes are accurately classified into one category, improving the accuracy of defect detection and making the quality assessment results more reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.
[0024] Reference Figure 1 The present invention provides a method for evaluating the quality of aluminum alloy castings, comprising steps S1 to S4: S1: Acquire multi-angle images of the aluminum alloy casting surface.
[0025] Place the surface of the aluminum alloy casting on a platform and select a suitable position to install a high-resolution camera. Under appropriate lighting conditions, take the center of the aluminum alloy casting surface as the shooting center and take pictures from angles of 60 degrees to the left, 30 degrees to the left, 0 degrees (the angle of the camera facing the aluminum alloy casting surface), 30 degrees to the right, and 60 degrees to obtain multi-angle images of the aluminum alloy casting surface. Other angles are determined based on 0 degree.
[0026] The multi-angle images were then grayscaled, noise removed using an adaptive filtering algorithm, and contrast enhanced using histogram equalization. The images were then illuminated to ensure that no shadows were cast when viewed from different angles. Each pixel in the multi-angle images was mapped to a specific position, and subsequent analysis was based on the 0-degree image.
[0027] S2: By analyzing the brightness changes of pixels under different angles of light, the brightness defect coefficient of each pixel is calculated, and suspected defective pixels are screened out based on the brightness defect coefficient.
[0028] When inspecting aluminum alloy castings for defects, if a pixel is located in a defective area, it will have significantly different characteristics from pixels in normal areas. When the surface of an aluminum alloy casting has surface damage, stains, or other defects, the pixels in these defective areas will exhibit uneven brightness. Therefore, by comparing the brightness of each pixel with its neighboring pixels, this difference can be accurately measured.
[0029] In one embodiment, the brightness defect coefficient of each pixel is determined based on the difference in grayscale value between each pixel and its neighboring pixels in the multi-angle image. Specifically: Because the brightness of a pixel changes under different angles of light, that is, the grayscale of the pixel changes in the multi-angle image. Therefore, for any pixel, perform the following operations: First calculate the average gray value of the pixel in the multi-angle image, which is recorded as , fully utilizing the brightness information of the pixel at different viewing angles. Because defects on the surface of aluminum alloy castings may appear differently at different angles, multi-view information fusion can more comprehensively reflect the true characteristics of the pixel. For example, some subtle scratches may not be noticeable at one angle, but may become clearly visible at other angles due to factors such as light reflection. By integrating grayscale values from multiple angles, important defect information can be avoided from being missed due to a single viewing angle.
[0030] Then, the grayscale mean of the eight neighboring pixels of the pixel point in each angle image is obtained. The grayscale mean of the eight neighboring pixels of each angle image is obtained, and the average grayscale mean of the eight neighboring pixels obtained from all angle images is calculated and recorded as This process can effectively highlight the difference in grayscale characteristics between the pixel and the surrounding local area. In the image of the surface of an aluminum alloy casting, the grayscale of pixels in the normal area and its neighboring pixels are usually highly consistent, showing a relatively uniform distribution. However, the grayscale value of defective pixels, such as those caused by surface damage or stains, often deviates from the overall level of the neighborhood. By comparing the grayscale value characteristics of the pixel itself at multiple angles with the grayscale characteristics of the neighborhood, this difference can be keenly captured, providing key clues for determining whether the pixel belongs to a defective area.
[0031] Next, calculate the standard deviation of the grayscale mean of the eight neighborhood pixels obtained from all angle images, which is recorded as This process uses the standard deviation to reflect the degree of dispersion of the grayscale values within the neighborhood of a pixel. A larger standard deviation indicates more dramatic fluctuations in the grayscale values within the neighborhood, suggesting a possible defect in the neighborhood of the pixel. For example, in an area with bubbles, the grayscale values of the surrounding pixels will fluctuate significantly due to the bubbles' irregular shape and varying refraction and reflection effects on light. The standard deviation can capture this fluctuation information, providing a richer basis for defect assessment.
[0032] Finally, the brightness defect coefficient of the pixel is: ; In this formula, is the brightness defect coefficient of the pixel, The larger it is, the more likely the pixel is in a defective area. is the normalization function, is the absolute value symbol. It indicates the grayscale difference between the pixel point and its eight neighboring pixels in the multi-angle image. The larger the grayscale difference, the more likely the pixel point is located in the defect area. The larger the value, the greater the grayscale fluctuation around the pixel, and the more likely the pixel is located in a defective area.
[0033] The brightness defect coefficient calculated by this formula can preliminarily identify pixels that may have defects. Compared with relying solely on single-angle images or simple pixel grayscale value judgment methods, this formula integrates multiple aspects of information such as multi-viewing angles, neighborhood comparisons, and grayscale value fluctuations, thereby improving the accuracy of identifying potential defective pixels. For example, for those subtle defects that are similar in color to the main body of the casting and have unclear texture features, traditional methods may be difficult to detect. However, through calculation with this formula, due to the grayscale difference between the pixel at the defect and the neighborhood under multiple viewing angles and the large fluctuation of the neighborhood grayscale, the brightness defect coefficient will be significantly increased, allowing it to be accurately detected, effectively reducing the missed detection caused by unclear defect features.
[0034] In one embodiment, the method for screening suspected defective pixels is to preset a brightness defect coefficient threshold of 0.3 (an empirical value). If the brightness defect coefficient of a pixel is greater than 0.3, the pixel is considered a suspected defective pixel; if the brightness defect coefficient of a pixel is not greater than 0.3, the pixel is considered a normal pixel. This completes the preliminary location of potential defective pixels.
[0035] S2: Obtain suspected defect areas through watershed algorithm and connected domain analysis.
[0036] Traditional watershed algorithms primarily segment images based on grayscale values, identifying areas with higher grayscale values as ridges and areas with lower grayscale values as valleys. However, when detecting defects on the surfaces of aluminum alloy castings, relying solely on grayscale segmentation is inaccurate and ineffective in addressing the complex defect characteristics of casting surfaces. Therefore, this step performs segmentation based on the brightness defect coefficient of each pixel and performs connected domain analysis after segmentation to identify suspected defect areas.
[0037] In one embodiment, the suspected defect area is determined based on the following method: After obtaining all suspected defective pixels and their corresponding brightness defect coefficients, the watershed algorithm is used to segment the image based on the brightness defect coefficients of all suspected defective pixels. The watershed algorithm based on the brightness defect coefficient can more directly reflect the characteristics related to pixels and defects, because the brightness defect coefficient is obtained after comprehensively considering factors such as the grayscale value difference of pixels in multi-angle images, neighborhood grayscale characteristics, and grayscale value fluctuations, and it is more sensitive to defective areas.
[0038] In this process, the pixels located on the ridge are selected as target pixels. The distribution of the brightness defect coefficients of these target pixels is at a relative peak, which means that they have obvious differences in defect characteristics from the surrounding pixels and are very likely to be at the boundary or key position of the defect area.
[0039] Finally, a connected domain analysis is performed on all target pixels. The connected domain analysis aims to identify sets of interconnected pixels in the image. In this scenario, the connected domain analysis can group target pixels that are adjacent in spatial position and have similar brightness defect coefficients into a group, and obtain a corresponding closed connected domain. This closed connected domain is identified as a suspected defect area. The characteristics of the closed connected domain ensure the integrity and continuity of the suspected defect area in space, which conforms to the morphological characteristics of the defect area. For example, for the concave defect on the surface of an aluminum alloy casting, the pixels at its boundary will be marked as target pixels due to their high brightness defect coefficient. Through the connected domain analysis, these boundary pixels can be connected to form a closed connected domain, which accurately outlines the scope of the concave area.
[0040] This step combines a watershed algorithm based on the brightness defect coefficient with connected domain analysis to accurately locate areas with potential defects, also known as suspected defect areas. Traditional methods tend to overlook subtle defects such as fine cracks and tiny bubbles, but this solution can identify them through accurate feature analysis, effectively reducing false positives and missed detections.
[0041] S3: Analyze the position distribution of edge pixels of each suspected defect area to determine the shape feature vector of each suspected defect area.
[0042] For each suspected defect area, the pixel points located at the boundary of the area play a key role in accurately describing the geometric characteristics of the defect, because whether it is a linear scratch, a circular bubble, or an irregular scratch area, the boundary pixel points can outline the specific shape of the defect. Therefore, this step determines the shape characteristics of each suspected defect area by analyzing the edge pixel points of the suspected defect area.
[0043] Specifically, the steps include: S31: Calculate the density of each edge pixel point of the suspected defect area.
[0044] Density measures the distribution of each edge pixel within its neighborhood. Edge pixels with high density and a large brightness defect coefficient often correspond to prominent features of the defect area, such as sharp corners, edge turning points, or areas with abrupt texture changes. Different types of defects have different distributions of prominent features. For example, a dense distribution of edge pixels for a circular bubble defect creates a circular outline, while a dense distribution of edge pixels for an irregular scratch defect creates an elongated, zigzag shape. By analyzing density, we can better distinguish different defect types and accurately describe the geometry of the defect area.
[0045] Therefore, after determining all suspected defect areas, edge detection is used to obtain the edge contour of each suspected defect area, and the coordinates of all edge pixels in each suspected defect area are recorded. When recording the coordinates, for a 0-degree image, the horizontal right direction is set as the positive direction of the horizontal axis, and the vertical upward direction is set as the positive direction of the vertical axis. A plane rectangular coordinate system is constructed to obtain the coordinates of each edge pixel in each suspected defect area. Based on the coordinates of each edge pixel, the Euclidean distance between each edge pixel and other edge pixels is obtained, and the Euclidean distance is used as the distance between each edge pixel and other edge pixels.
[0046] In one embodiment, the density of each edge pixel point of each suspected defect area is determined based on the following method: For the The suspected defect area is obtained, and the brightness defect coefficient of all edge pixels is obtained. Based on the distance between each edge pixel and other edge pixels, and the difference in brightness defect coefficient between each edge pixel and other edge pixels, the density of each edge pixel is calculated:
[0047] In this formula, For the The first suspected defect area The density of edge pixels, It is The first suspected defect area The edge pixel and the The first suspected defect area The Euclidean distance between edge pixels, For the The first suspected defect area The edge pixel and the The maximum Euclidean distance between other edge pixels in the suspected defect area, 、 They are The first suspected defect area edge pixels, The brightness defect coefficient of edge pixels, For the The total number of edge pixels in the suspected defect area, is the natural exponential function, is the absolute value symbol.
[0048] In this formula, The smaller the The first suspected defect area The edge pixel is located at a distance from The closer the edge pixels are, the The more dense the features are in the neighborhood of the edge pixel, the greater the density is. Construct a negatively correlated exponential function to reflect and negative correlation, and vice versa.
[0049] In this formula, For the The first suspected defect area edge pixels and the The difference in brightness defect coefficient of edge pixels is smaller, indicating that the The first suspected defect area The edge pixel and the The closer the brightness of the edge pixels is, the more likely it is that in actual image analysis, the edge pixels in the defect area have a certain correlation in both spatial distribution and brightness characteristics. For example, the edge pixels in the defect area are often close in spatial position, and their brightness defect coefficients are also similar.
[0050] In this formula, As The weight of The first suspected defect area The edge pixel is located at a distance from The closer the edge pixels are, the more significant the difference in their brightness defect coefficients should be on the density. For example, at the edge of a continuous defect area, the difference in brightness defect coefficients between adjacent pixels is small and the distance is close. This weighting setting can highlight the close relationship between them, thereby more accurately calculating the density.
[0051] This step calculates the density to highlight edge pixels that are more clustered in terms of spatial and brightness characteristics. These edge pixels are more likely to truly reflect the defect characteristics. For example, the edge pixel density will be relatively high at sharp corners or areas with obvious edge changes in the defect area. This solution can filter out the pixels in these areas, providing a more accurate data foundation for subsequent defect shape analysis.
[0052] S32: Filter out all characteristic edge pixels of the suspected defect area according to the density.
[0053] In a suspected defect area, not all edge pixels are equally important in characterizing the defect. By filtering characteristic edge pixels, we can remove those with lower density and less contribution to the defect signature, thereby reducing the amount of data. This not only reduces the computational complexity of subsequent processing (such as Fourier transforms and cluster analysis), but also prevents redundant data from interfering with analysis results, improving analysis accuracy and efficiency.
[0054] Specifically, the density of all edge pixels in each suspected defect area is obtained and sorted in ascending order. The first quartile, second quartile and third quartile of the density of all edge pixels are obtained using the quantile method, and the edge pixels with a density greater than or equal to the third quartile are taken as all the characteristic edge pixels in the suspected defect area.
[0055] Through the quantile method, the data can be divided into four equal parts. The data above the third quartile accounts for 25% of the total data. It can be used as a threshold to filter out relatively more representative feature edge pixels, which helps to highlight those pixels with higher density and better reflect defect characteristics, thereby better describing and analyzing the characteristics of suspected defect areas.
[0056] S33: Performing Fourier transform on the coordinate sequence of all feature edge pixel points to determine the shape feature vector of the suspected defect area.
[0057] The Fourier descriptor is a frequency-domain method widely used in the field of shape analysis to accurately characterize shape features. Its core principle is to convert the sequence of coordinate points describing the shape contour from the spatial domain to the frequency domain, and through in-depth analysis of different frequency coefficients, effectively extract and describe the shape features. In the Fourier descriptor, coefficients of different frequencies have clear shape representation meanings. Low-frequency coefficients mainly reflect the global characteristics of the shape, such as the overall outline of the object and the general shape trend; high-frequency coefficients correspond to the details of the shape, such as the subtle structure of the edge, and also contain possible noise information.
[0058] Therefore, for each suspected defect area that has been identified, the previous step has screened out representative feature edge pixel points, and the coordinate sequence of these feature edge pixel points accurately outlines the contour of the suspected defect area.
[0059] The coordinate sequence is converted to the frequency domain using the discrete Fourier transform, resulting in a series of Fourier coefficients. For a coordinate point sequence of length C, C Fourier coefficients are obtained, which together constitute the Fourier descriptor of the coordinate sequence.
[0060] It can be said that the Fourier descriptor is a data set composed of these Fourier coefficients arranged in order. Each Fourier coefficient corresponds to a specific frequency component. The complete set of coefficients reflects the characteristics of the signal at different frequencies, thus constituting a complete description of the frequency domain characteristics. Moreover, the frequency components after discrete Fourier transform are arranged from low to high, and the low-frequency components are usually concentrated in the part with smaller serial numbers.
[0061] Each Fourier coefficient carries the information of the original signal at the corresponding frequency. This step extracts the previous The Fourier coefficients of (empirical values) and normalize these Fourier coefficients. Because these coefficients have low-frequency components, they are considered low-frequency coefficients. These low-frequency coefficients contain the primary energy and shape information of the signal and can represent the general characteristics of the original signal. By analyzing and processing these selected coefficients, key information about the shape of suspected defect areas can be obtained, which can be used for subsequent defect identification and classification tasks. High-frequency coefficients, on the other hand, may contain noise or detailed information and may be ignored in some cases.
[0062] Therefore, this step will eventually The Fourier coefficients of the vector form a vector, which is used as the shape feature vector of the suspected defect area. This shape feature vector is like a unique identifier of the shape of the suspected defect area. It can be compared with the shape feature vectors of other known defect areas in the future. By comparing the differences or similarities between the vectors, the shape-based classification and identification of surface defects of aluminum alloy castings can be achieved.
[0063] In this way, the ability of low-frequency coefficients to characterize global shape features can be effectively utilized, reducing the impact of interference factors such as high-frequency noise, providing stable and accurate input data for subsequent defect classification and identification operations based on shape feature vectors, and significantly improving the accuracy and reliability of defect detection.
[0064] S4: All suspected defect areas are clustered based on the shape feature vectors, and the defect areas on the surface of the aluminum alloy casting are determined according to the clustering results, and quality assessment is performed.
[0065] The elbow rule is used to determine the K value in K-means clustering, that is, the total number of clusters. The principle of the elbow rule is to calculate the SSE (sum of squared errors) of the clustering model under different K values, and then plot a curve with K as the horizontal axis and SSE as the vertical axis. As the K value increases, the SSE gradually decreases. When the K value reaches a certain appropriate value, the curve will have an elbow-like inflection point. The K value corresponding to this inflection point is the optimal number of clusters.
[0066] The specific clustering operation process is: Select initial cluster centers: Randomly select K shape feature vectors from the shape feature vectors corresponding to all suspected defect areas as initial cluster centers.
[0067] Assign samples to cluster centers: For all remaining shape feature vectors of suspected defect areas, calculate their similarity with the shape feature vectors of each initial cluster center. Euclidean distance is used as the similarity metric. Euclidean distance accurately measures the distance between two vectors in space; closer distances indicate higher similarity. Each shape feature vector is assigned to the cluster with the closest Euclidean distance to the cluster center.
[0068] Update cluster centers: After completing the initial distribution of all shape feature vectors, recalculate the mean of all shape feature vectors within each cluster and use this mean vector as the new cluster center. By continuously updating the cluster centers, the clusters can better reflect the distribution characteristics of the samples within them.
[0069] Iterative convergence judgment: Repeat the steps of assigning samples to cluster centers and updating cluster centers until the cluster centers no longer change significantly. This can be judged by setting a distance threshold of 0.01 (empirical value). If the Euclidean distance between the newly calculated cluster center and the previous cluster center is less than this threshold, the cluster center is considered to have no significant change and the iteration is stopped. This iterative method can ensure that the clustering results gradually converge to a relatively stable and reasonable state.
[0070] Once the clustering process is complete, K clusters are obtained. Each cluster represents a unique shape feature pattern. The suspected defect areas within each cluster have a high degree of similarity in shape feature vectors. Therefore, each cluster is identified as a defect area, and each category corresponds to a specific defect type. Shape analysis can be performed by analyzing parameters such as the area, perimeter, aspect ratio, and circularity of each defect area. For example, the defect areas in one cluster may all appear as long, thin lines, and analysis can determine that this category represents crack defects; while the defect areas in another cluster are approximately circular in shape, which may correspond to bubble defects, etc.
[0071] Specifically, the circularity (reflecting how close the shape is to a circle) and aspect ratio (reflecting how stretched the shape is) of each defect area are calculated. The closer the circularity and aspect ratio are to 1, the closer the shape is to a circle, and the more likely the defect area is a pore. The closer the circularity and aspect ratio are to 0 and the larger the aspect ratio (usually greater than 2, 3, or even larger), the closer the shape is to a line, and the more likely the defect area is a crack.
[0072] Therefore, defect areas with a circularity greater than or equal to 0.6 (empirical value) and an aspect ratio less than or equal to 2 (empirical value) are considered pore areas. Defect areas with a circularity less than 0.6 and an aspect ratio greater than 2 are considered crack areas. This method accurately delineates defect areas on the surface of aluminum alloy castings, enabling comprehensive and accurate defect detection on the surface of aluminum alloy castings.
[0073] Finally, quality assessment is performed based on the defect detection results: Count the number of all pore areas and calculate the total area of all crack areas. If the number of pore areas is less than or equal to 5 (empirical value), and the total area of all crack areas is less than 1% (empirical value) of the total surface area of the aluminum alloy casting, the molding quality of the aluminum alloy casting is judged to be qualified. In other cases, the molding quality of the aluminum alloy casting is judged to be unqualified.
[0074] While several 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. Numerous modifications, variations, and alternatives will occur to those skilled in the art without departing from the concept and spirit of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.
Claims
1. A method for evaluating the quality of aluminum alloy castings, characterized in that: include: Obtain multi-angle images of the aluminum alloy casting surface, and determine the brightness defect coefficient of each pixel based on the difference in grayscale value between each pixel and its neighboring pixels in the multi-angle images; Determine suspected defective pixels based on a comparison result of the brightness defect coefficient and a preset brightness defect coefficient threshold; The watershed algorithm is used to segment all suspected defective pixels based on their brightness defect coefficients, and the pixels located on the ridge are used as target pixels. Perform connected domain analysis on all target pixels and use each closed connected domain obtained as a suspected defect area; Obtain all edge pixels of each suspected defect area, determine the density of each edge pixel based on the distance between each edge pixel and other edge pixels, and the difference in brightness defect coefficient between each edge pixel and other edge pixels, and filter out all characteristic edge pixels of each suspected defect area based on the density; A Fourier transform is performed on the coordinate sequence of all characteristic edge pixel points of each suspected defect area, and several low-frequency coefficients are extracted from the transformation results to form the shape feature vector of each suspected defect area. Clustering is performed based on the shape feature vectors of all suspected defect areas, and each cluster obtained is a defect area. The processing and forming quality of aluminum alloy castings is evaluated based on the defect areas.
2. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: The brightness defect coefficient of each pixel is determined as follows: For any pixel, calculate the mean gray value of the pixel in the multi-angle image , the average grayscale value of the eight neighboring pixels of the pixel in the multi-angle image , the standard deviation of the grayscale mean of the eight neighboring pixels of the pixel in the multi-angle image ; Calculate the brightness defect coefficient of the pixel as , where is the brightness defect coefficient of the pixel, is the normalization function, is the absolute value symbol.
3. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: The density of each edge pixel is determined based on the following method: Where, For the The first suspected defect area The density of edge pixels, It is The first suspected defect area The edge pixel and the The first suspected defect area The Euclidean distance between edge pixels, For the The first suspected defect area The edge pixel and the The maximum Euclidean distance between other edge pixels in the suspected defect area, 、 They are The first suspected defect area edge pixels, The brightness defect coefficient of edge pixels, For the The total number of edge pixels in the suspected defect area, is the natural exponential function.
4. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: The multi-angle images include an image at 60 degrees to the left, an image at 30 degrees to the left, an image at 0 degrees, an image at 30 degrees to the right, and an image at 60 degrees to the right. The image at 0 degrees is an image facing the surface of the aluminum alloy casting.
5. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: Suspected defective pixels are determined based on the following method: If the brightness defect coefficient of a pixel is greater than the preset brightness defect coefficient threshold, the pixel is a suspected defective pixel; if the brightness defect coefficient of a pixel is not greater than the preset brightness defect coefficient threshold, the pixel is a normal pixel.
6. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: All feature edge pixels of each suspected defect area are screened according to the following method: The density of all edge pixels in each suspected defect area is obtained and sorted from small to large. The edge pixels with a density greater than or equal to the third quartile are used as the characteristic edge pixels in the suspected defect area using the quantile method.
7. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: The method for clustering based on the shape feature vectors of all suspected defect areas is: First, the shape feature vector of each suspected defect area is normalized to obtain the normalized shape feature vector. Then, the K-means clustering algorithm is used to set the cluster center. Clustering operation is performed based on the similarity between the shape feature vectors of other suspected defect areas and the shape feature vector of the cluster center. The similarity of the shape feature vectors is determined by the Euclidean distance between other suspected defect areas and the cluster center.
8. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: The shape feature vector of each suspected defect area is determined based on the following method: Perform Fourier transform on the coordinate sequence of all characteristic edge pixel points of each suspected defect area to obtain a Fourier descriptor. Extract the first M low-frequency coefficients in the Fourier descriptor and normalize them. The normalized first M low-frequency coefficients constitute the shape feature vector of the suspected defect area, where M is a preset value.
9. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: The method for obtaining the distance between each edge pixel and other edge pixels is: Taking the 0-degree image as the reference, the horizontal right direction is set as the positive direction of the horizontal axis, and the vertical upward direction is set as the positive direction of the vertical axis. A plane rectangular coordinate system is constructed to obtain the coordinates of each edge pixel point of each suspected defect area. Based on the coordinates of each edge pixel point, the Euclidean distance between each edge pixel point and other edge pixel points is obtained, and the Euclidean distance is used as the distance between each edge pixel point and other edge pixel points.
10. The aluminum alloy casting processing and molding quality assessment method according to claim 1, characterized in that: The method for evaluating the processing and forming quality of aluminum alloy castings based on defect areas is as follows: Calculate the circularity and aspect ratio of each defect area, and divide all defect areas into pore areas or crack areas according to the circularity and aspect ratio; The number of all pore areas is counted, and the total area of all crack areas is calculated. If the number of pore areas does not exceed the preset number threshold, and the total area of all crack areas does not exceed the preset area ratio threshold, the molding quality of the aluminum alloy casting is judged to be qualified; if the number of pore areas exceeds the preset number threshold or the total area of all crack areas exceeds the preset area ratio threshold, the molding quality of the aluminum alloy casting is judged to be unqualified.
Citation Information
Patent Citations
Intelligent detection method for automobile part machining information
CN115861320A
Defect detection method and system for engine gear ring section steel
CN117074419A
Part drilling deviation detection method based on computer vision
CN118071747A
Special-shaped bar surface quality detection method
CN119180823A
Online monitoring method for polishing of shaft forgings
CN119180836A
Cited By
Aluminum alloy pipe compression molding defect classification method
CN120807532A
Burr data acquisition system and image processing method suitable for automobile stamping part
CN120997208A
Burr data acquisition system and image processing method suitable for automobile stamping parts
CN120997208B
Aluminum alloy casting defect identification method and system based on image analysis
CN121033043A
Die casting defect detection method, system and device for aluminum alloy die casting
CN121120651A