Aluminum alloy castings forming quality evaluation method

Through technical means such as multi-angle image acquisition and watershed algorithm, complex defect areas on the surface of aluminum alloy castings can be accurately identified, solving the problems of misjudgment and missed detection in traditional methods and achieving high-precision quality assessment of aluminum alloy castings.

CN120451164BActive Publication Date: 2025-10-10宝鸡欣亚电气有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510953763.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-11
Publication Date
2025-10-10
Estimated Expiration
2045-07-11

AI Technical Summary

Technical Problem

Traditional K-means clustering algorithms are difficult to accurately identify complex defect areas on the surface of aluminum alloy castings, resulting in misjudgment or missed detection, affecting the accuracy of processing and molding quality assessment.

Method used

By adopting multi-angle image acquisition, watershed algorithm and connected domain analysis, edge pixel density analysis and Fourier transform, the brightness defect coefficient and shape feature vector are calculated, and characteristic edge pixels are screened for clustering to identify and evaluate the defective areas of aluminum alloy castings.

Benefits of technology

The accuracy of defect detection is improved, the misjudgment and missed detection rates are reduced, and high-precision quality assessment of the surface of aluminum alloy castings is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451164B_ABST
    Figure CN120451164B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and particularly relates to a kind of aluminum alloy casting processing forming quality evaluation method, method includes: obtaining the multi-angle image of aluminum alloy casting surface, according to the difference of each pixel point and neighborhood pixel point in multi-angle image, determine the brightness defect coefficient of each pixel point, according to brightness defect coefficient screening suspected defect pixel point, utilize watershed algorithm and connected domain analysis to determine suspected defect region;Obtain all edge pixel points of each suspected defect region, calculate the density of each edge pixel point, according to the density screening feature edge pixel point, the coordinate sequence of feature edge pixel point is Fourier transformed, the shape feature vector of suspected defect region is constructed, clustering is carried out according to shape feature vector, and defect region is obtained.The method improves the accuracy of defect detection result on the surface of aluminum alloy casting by accurately analyzing brightness feature and shape feature.
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 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:

[0007] 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;

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

[0009] 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;

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

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

[0012] Furthermore, the brightness defect coefficient of each pixel is determined according to the following method:

[0013] 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 ;

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

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

[0016] Furthermore, the density of each edge pixel is determined based on the following method:

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

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

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

[0020] Furthermore, suspected defective pixels are determined based on the following method:

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

[0022] Furthermore, all characteristic edge pixels of each suspected defect area are screened according to the following method:

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

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

[0025] Furthermore, the clustering method based on the shape feature vectors of all suspected defect areas is as follows:

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

[0027] Furthermore, the shape feature vector of each suspected defect area is determined based on the following method:

[0028] The Fourier descriptor is obtained by performing Fourier transform on the coordinate sequence of all feature edge pixels of each suspected defect region, the first M low-frequency coefficients in the Fourier descriptor are extracted and normalized, and the first M normalized low-frequency coefficients form a shape feature vector of the suspected defect region, and M is a preset value.

[0029] The low-frequency coefficients extracted by Fourier transform can more comprehensively and meticulously reflect the shape information of the defect, the first M normalized low-frequency coefficients form a shape feature vector, a quantitative shape description is provided for each suspected defect region, and the feature vector can be used as a shape feature representation of the region, which is beneficial to subsequent accurate clustering analysis of the defect region based on the shape feature.

[0030] Further, the distance between each edge pixel point and other edge pixel points is obtained by:

[0031] With the image at 0 degrees as a reference, a horizontal right direction is set as a positive direction of a horizontal axis, and a vertical upward direction is set as a positive direction of a vertical axis to construct a plane rectangular coordinate system, coordinates of each edge pixel point of each suspected defect region are obtained, and the Euclidean distance between each edge pixel point and other edge pixel points is obtained based on the coordinates of each edge pixel point, and the Euclidean distance is used as the distance between each edge pixel point and other edge pixel points.

[0032] Further, the method for evaluating the forming quality of the aluminum alloy casting based on the defect region is:

[0033] The circularity and the aspect ratio of each defect region are calculated, all defect regions are divided into pore regions or crack regions according to the circularity and the aspect ratio, the number of all pore regions is counted, and the total area of all crack regions is calculated, if the number of pore regions does not exceed a preset number threshold and the total area of all crack regions does not exceed a preset area ratio threshold, the forming quality of the aluminum alloy casting is determined as qualified, and if the number of pore regions exceeds the preset number threshold or the total area of all crack regions exceeds the preset area ratio threshold, the forming quality of the aluminum alloy casting is determined as unqualified.

[0034] The present application has the following effects:

[0035] 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

[0036] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION

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

[0038] Reference Figure 1 The present invention provides a method for evaluating the quality of aluminum alloy castings, comprising steps S1 to S4:

[0039] S1: Acquire multi-angle images of the aluminum alloy casting surface.

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

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

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

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

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

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

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

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

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

[0049] Finally, the brightness defect coefficient of the pixel is: ;

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

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

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

[0053] S2: Obtain suspected defect areas through watershed algorithm and connected domain analysis.

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

[0055] In one embodiment, the suspected defect area is determined based on the following method:

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

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

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

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

[0060] S3: Analyze the position distribution of edge pixels of each suspected defect area to determine the shape feature vector of each suspected defect area.

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

[0062] Specifically, the steps include:

[0063] S31: Calculate the density of each edge pixel point of the suspected defect area.

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

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

[0066] In one embodiment, the density of each edge pixel point of each suspected defect area is determined based on the following method:

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

[0068]

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

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

[0071] 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 closer they are to each other. In actual image analysis, the edge pixels of the defect area have certain correlations in spatial distribution and brightness characteristics. For example, the edge pixels of the defect area are often close in spatial position, and their brightness defect coefficients are also similar.

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

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

[0074] S32: Filter out all characteristic edge pixels of the suspected defect area according to the density.

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

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

[0077] The quantile method can be used to divide the data 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.

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

[0079] Fourier descriptor is a frequency domain method widely used in shape analysis field, which is used to accurately describe shape features. The core principle is to convert the coordinate point sequence describing the shape contour from the spatial domain to the frequency domain, and to realize the effective extraction and description of shape features by analyzing different frequency coefficients. In Fourier descriptor, different frequency coefficients have clear shape representation meaning. Low frequency coefficients mainly reflect the global characteristics of the shape, such as the overall contour of the object, the general shape trend, etc.; high frequency coefficients correspond to the details of the shape, such as the fine structure of the edge, and also contain the noise information that may exist.

[0080] Therefore, for each determined suspected defect region, 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 region.

[0081] The coordinate sequence is converted to the frequency domain by using discrete Fourier transform to obtain a series of Fourier coefficients. For a coordinate point sequence with a length of C, C Fourier coefficients are obtained, which together constitute the Fourier descriptor of the coordinate sequence.

[0082] In a word, Fourier descriptor is a data set composed of ordered arrangement of these Fourier coefficients, each Fourier coefficient corresponds to a specific frequency component, and the complete coefficient set reflects the characteristics of the signal at different frequencies, thereby constituting a complete description of the frequency domain features, and the frequency components after discrete Fourier transform are arranged from low to high, and low frequency components are usually concentrated in the part with smaller serial number.

[0083] Each Fourier coefficient carries information of the original signal at the corresponding frequency, and this step extracts the first Fourier coefficients from the Fourier descriptor, (empirical value), and normalizes these Fourier coefficients. Since the frequency components of these coefficients are low, these coefficients are taken as low frequency coefficients, which contain the main energy and shape information of the signal and can represent the general characteristics of the original signal. Through analysis and processing of these selected coefficients, key information about the shape of the suspected defect region can be obtained, which is used for subsequent defect recognition, classification, etc. High frequency coefficients may contain noise or detail information, which may be ignored in some cases.

[0084] Therefore, this step finally obtains the first The Fourier coefficients of the suspected defect region constitute a vector, and the vector is taken as a shape feature vector of the suspected defect region. The shape feature vector is like a unique identifier of the shape of the suspected defect region, and can be compared with shape feature vectors of other known defect regions in the future. By comparing the differences or similarities between the vectors, shape-based classification and identification of defects on the surface of the aluminum alloy casting can be achieved.

[0085] In this way, the representation ability of low-frequency coefficients for global shape features can be effectively utilized, the influence of high-frequency noise and other interference factors can be reduced, stable and accurate input data can be provided for subsequent defect classification and identification based on shape feature vectors, and the accuracy and reliability of defect detection can be significantly improved.

[0086] S4: Clustering all suspected defect regions based on shape feature vectors, determining defect regions on the surface of the aluminum alloy casting according to the clustering results, and performing quality evaluation.

[0087] The elbow rule is used to determine the K value in K-means clustering, i.e., the total number of clustering clusters. The principle of the elbow rule is to calculate the SSE (sum of squared errors) of the clustering model under different K values, draw a curve with K value as the horizontal coordinate and SSE as the vertical coordinate, and as the K value increases, the SSE gradually decreases. When the K value reaches a certain appropriate value, the curve will have a elbow-like inflection point, and the K value corresponding to the inflection point is the optimal clustering number.

[0088] The specific clustering operation process is as follows:

[0089] Selecting initial clustering centers: randomly selecting K shape feature vectors from all shape feature vectors corresponding to suspected defect regions as initial clustering centers.

[0090] Assigning samples to clustering centers: for the shape feature vectors of all remaining suspected defect regions, calculate their similarity with each initial clustering center shape feature vector. Here, the Euclidean distance is used as a similarity measure index. The Euclidean distance can accurately measure the distance between two vectors in space, and the closer the distance, the higher the similarity. Each shape feature vector is assigned to the clustering cluster where the nearest clustering center is located.

[0091] Updating clustering centers: after completing the preliminary assignment of all shape feature vectors, the mean of all shape feature vectors in each clustering cluster is recalculated, and this mean vector is taken as the new clustering center. By continuously updating the clustering center, the clustering cluster can better reflect the distribution characteristics of its internal samples.

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

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

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

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

[0096] Finally, quality assessment is performed based on the defect detection results:

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

[0098] 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; 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 , is the brightness defect coefficient of the pixel, is the normalization function, is the absolute value symbol; Determine suspected defective pixels based on a comparison result between 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 sort them from small to large. Use the quantile method to select edge pixels with a density greater than or equal to the third quartile as characteristic edge pixels in the suspected defect area; 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 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.

3. 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.

4. 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.

5. 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.

6. 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.

7. 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.

8. 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

  • Part drilling deviation detection method based on computer vision

    CN118071747A

  • Online monitoring method for polishing of shaft forgings

    CN119180836A