Aluminum alloy casting detection method based on data processing
By using a data processing-based aluminum alloy casting inspection method, images are acquired and density coefficients and intrinsic matrix analysis are utilized, combined with cluster analysis, to automatically identify edge and internal defects in aluminum alloy castings. This solves the problems of low efficiency and high equipment cost in existing technologies and achieves high-precision, full-coverage inspection.
Patent Information
- Application Number
- CN202511272815.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-12-05
AI Technical Summary
Existing aluminum alloy casting inspection technologies suffer from low efficiency, high subjectivity, and high rates of missed and false detections, making them unsuitable for large-scale production. Furthermore, non-destructive testing equipment is expensive and lacks the ability to identify minute surface defects.
By acquiring surface images of aluminum alloy castings, separating edge and internal pixel sets, and using density coefficient and multi-directional intrinsic matrix analysis, combined with cluster analysis, edge and internal defects are automatically identified.
It achieves high-precision, full-coverage defect detection of aluminum alloy castings, improving detection efficiency and adaptability while reducing equipment costs.
Smart Images

Figure CN121074518A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of aluminum alloy testing technology, and more specifically to a data processing-based method for testing aluminum alloy castings. Background Technology
[0002] Aluminum alloy castings are widely used in aerospace, automotive manufacturing, and electronic equipment industries due to their lightweight, high strength, and excellent corrosion resistance. Their surface defects (such as edge cracks, burrs, internal porosity, and inclusions) directly affect product performance and service safety; therefore, high-precision defect detection is a core aspect of quality control in aluminum alloy casting production.
[0003] Existing testing technologies have significant limitations: traditional manual testing relies on experience and judgment, which is inefficient, subjective, and has a high rate of missed and false detections, making it unsuitable for large-scale production; although non-destructive testing (such as ultrasound and X-ray) can detect internal defects, the equipment is expensive and the operation is complex, and it is not capable of identifying minor surface defects (such as edge burrs).
[0004] In summary, existing solutions have gaps in the differentiation analysis of defects and the accurate extraction of features. Summary of the Invention
[0005] To address the above problems, this invention proposes a data processing-based method for inspecting aluminum alloy castings.
[0006] The technical solution of the present invention is: a data processing-based method for inspecting aluminum alloy castings, comprising the following steps:
[0007] S1. Acquire images of the surface of aluminum alloy castings and separate edge pixel sets and internal pixel sets from the surface images of aluminum alloy castings;
[0008] S2. Determine the abnormal regions of edge pixels based on the density coefficients of each pixel in the edge pixel set;
[0009] S3. Determine the abnormal regions of the internal pixel set based on several intrinsic matrices of each pixel in the internal pixel set.
[0010] S4. Take the abnormal regions of edge pixels and the abnormal regions of internal pixel sets as the detection results of aluminum alloy castings and mark them.
[0011] In S1, the outermost ring of the surface image is taken as the edge pixel set, and the rest are taken as the internal pixel set.
[0012] Furthermore, S2 includes the following sub-steps:
[0013] S21. Extract the neighborhood position for each pixel in the set of edge pixels;
[0014] S22. The number of pixels whose pixel value is greater than the number of pixels in the neighborhood is used as the participation degree.
[0015] S23. Use the ratio between the pixel value of a pixel and the sum of the pixel values in its neighborhood as the base degree;
[0016] S24. Calculate the density coefficient of the pixel in the edge pixel set based on the participation and basicity of the pixel.
[0017] S25. Pixels with a density coefficient lower than a set threshold are considered as abnormal regions in the edge pixel set.
[0018] In S21, if a pixel is located at one of the four vertices, such as the top-left vertex, since the neighborhood position can only be selected from the set of edge pixels, the pixel to the right of the top-left vertex and the pixel below it are taken as the neighborhood position, and so on for the other three vertices. If a pixel is located in the first or last row, the pixels to its left and right are taken as the neighborhood position; similarly, if a pixel is located in the first or last column, the pixels to its top and bottom are taken as the neighborhood position.
[0019] In S22, when determining the participation degree, generally the neighborhood of a pixel contains two pixels. If the pixel value of a pixel is greater than the two pixel values contained in its neighborhood, the participation degree is 2; if the pixel value of a pixel is greater than one of the pixel values contained in its neighborhood, the participation degree is 1; if the pixel value of a pixel is less than the two pixel values contained in its neighborhood, the participation degree is 0.
[0020] The beneficial effects of the above-mentioned further solutions are as follows: In this invention, through the process of neighborhood extraction → participation degree → basic degree → density coefficient → threshold judgment, the participation degree describes the relative size of the pixel value in the neighborhood, and the basic degree describes the relative intensity of the pixel value in the neighborhood. The combination of the two uses the density coefficient to uniformly quantify the abnormality of edge pixels (such as the density of edge pixels at burrs will deviate abnormally from the normal range).
[0021] Furthermore, in S22, the pixel density coefficient The expression is:
[0022] ;
[0023] in, Indicates the basic degree of a pixel. Indicates the participation level of a pixel. This indicates exponentiation.
[0024] Furthermore, S3 includes the following sub-steps:
[0025] S31. Construct a first intrinsic matrix, a second intrinsic matrix, a third intrinsic matrix, and a fourth intrinsic matrix for each pixel in the internal pixel set;
[0026] S32. Perform a logarithmic operation on the largest eigenvalue of several intrinsic matrices of each pixel in the internal pixel set to obtain the degree of change of each pixel;
[0027] S33. Cluster the degree of change of all pixels in the internal pixel set;
[0028] S34. Based on the clustering results, identify the abnormal regions of the internal pixel set.
[0029] The beneficial effects of the above-mentioned further solution are as follows: In this invention, four 2×2 intrinsic matrices (upper left, upper right, lower left, and lower right neighborhoods) are constructed. The maximum eigenvalue of each matrix is extracted and the degree of change is obtained through logarithmic operation. Finally, cluster analysis is used to distinguish normal and abnormal pixels. The eigenvalues of the intrinsic matrices reflect the correlation of local pixels, and clustering can automatically distinguish abnormal pixel sets with deviated features. The multi-directional intrinsic matrices cover the local neighborhood features of the internal pixels, avoiding the omission of defects; logarithmic operation amplifies feature differences, and cluster analysis automatically distinguishes anomalies, comprehensively capturing defects.
[0030] Furthermore, in S32, the first pixel in the set of internal pixels... Line number The first intrinsic matrix of column pixels The expression is:
[0031] ;
[0032] in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels;
[0033] In S32, the first pixel in the set of internal pixels Line number The second intrinsic matrix of column pixels The expression is:
[0034] ;
[0035] in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels;
[0036] In S32, the first pixel in the set of internal pixels Line number The third intrinsic matrix of column pixels The expression is:
[0037] ;
[0038] in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels;
[0039] In S32, the first pixel in the set of internal pixels Line number The fourth intrinsic matrix of column pixels The expression is:
[0040] ;
[0041] in, Indicates the first Line number The pixel value of each column pixel.
[0042] Furthermore, in S32, the first pixel in the set of internal pixels... The change in individual pixels The expression is:
[0043] ;
[0044] in, Represents the set of internal pixels. The first pixel The largest eigenvalue, Represents the set of internal pixels. The maximum number of feature values contained in a pixel. Represents the logarithmic function. This indicates the number of rows in the image of the aluminum alloy casting surface. This indicates the number of columns in the image of the surface of the aluminum alloy casting.
[0045] Furthermore, S34 includes the following sub-steps:
[0046] S341. Extract the difference between the maximum and minimum cluster center values as the threshold;
[0047] S342. In each cluster of the clustering results, filter out data points that are less than the threshold, and take the pixels corresponding to the filtered data points as the abnormal regions of the internal pixel set.
[0048] The beneficial effect of the above-mentioned further solution is that, in this invention, after clustering, the difference between the largest cluster center and the smallest cluster center is extracted as a threshold to filter data points with large deviations in the cluster (such as the significant difference between the degree of change of defective pixels and normal cluster centers), thus avoiding the subjectivity of manual setting.
[0049] The beneficial effects of this invention are as follows: This invention quantifies local pixels by density coefficients to accurately capture subtle morphological anomalies at the edges; then, through multi-directional intrinsic matrices, eigenvalue logarithmic operations, and cluster analysis, it mines the local correlation changes of internal pixels to cover hidden defects; this invention combines the two to achieve full-type coverage of edge morphological defects and internal texture structure defects, realizing a breakthrough in the coverage, accuracy, adaptability, and efficiency of aluminum alloy casting defect detection, and providing a more reliable technical solution for casting quality control in the high-end manufacturing field. Attached Figure Description
[0050] Figure 1 This is a flowchart of a data processing-based inspection method for aluminum alloy castings. Detailed Implementation
[0051] The embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0052] like Figure 1 As shown, the present invention provides a data processing-based method for inspecting aluminum alloy castings, comprising the following steps:
[0053] S1. Acquire images of the surface of aluminum alloy castings and separate edge pixel sets and internal pixel sets from the surface images of aluminum alloy castings;
[0054] S2. Determine the abnormal regions of edge pixels based on the density coefficients of each pixel in the edge pixel set;
[0055] S3. Determine the abnormal regions of the internal pixel set based on several intrinsic matrices of each pixel in the internal pixel set.
[0056] S4. Take the abnormal regions of edge pixels and the abnormal regions of internal pixel sets as the detection results of aluminum alloy castings and mark them.
[0057] In S1, the outermost ring of the surface image is taken as the edge pixel set, and the rest are taken as the internal pixel set.
[0058] In this embodiment of the invention, S2 includes the following sub-steps:
[0059] S21. Extract the neighborhood position for each pixel in the set of edge pixels;
[0060] S22. The number of pixels whose pixel value is greater than the number of pixels in the neighborhood is used as the participation degree.
[0061] S23. Use the ratio between the pixel value of a pixel and the sum of the pixel values in its neighborhood as the base degree;
[0062] S24. Calculate the density coefficient of the pixel in the edge pixel set based on the participation and basicity of the pixel.
[0063] S25. Pixels with a density coefficient lower than a set threshold are considered as abnormal regions in the edge pixel set.
[0064] In S21, if a pixel is located at one of the four vertices, such as the top-left vertex, since the neighborhood position can only be selected from the set of edge pixels, the pixel to the right of the top-left vertex and the pixel below it are taken as the neighborhood position, and so on for the other three vertices. If a pixel is located in the first or last row, the pixels to its left and right are taken as the neighborhood position; similarly, if a pixel is located in the first or last column, the pixels to its top and bottom are taken as the neighborhood position.
[0065] In S22, when determining the participation degree, generally the neighborhood of a pixel contains two pixels. If the pixel value of a pixel is greater than the two pixel values contained in its neighborhood, the participation degree is 2; if the pixel value of a pixel is greater than one of the pixel values contained in its neighborhood, the participation degree is 1; if the pixel value of a pixel is less than the two pixel values contained in its neighborhood, the participation degree is 0.
[0066] In this invention, the process of neighborhood extraction → participation degree → basic degree → density coefficient → threshold judgment is used. The participation degree describes the relative size of the pixel value in the neighborhood, and the basic degree describes the relative intensity of the pixel value in the neighborhood. The two are combined to uniformly quantify the abnormality of edge pixels through the density coefficient (such as the density of edge pixels at burrs will deviate abnormally from the normal range).
[0067] In this embodiment of the invention, in S22, the density coefficient of the pixel points The expression is:
[0068] ;
[0069] in, Indicates the basic degree of a pixel. Indicates the participation level of a pixel. This indicates exponentiation.
[0070] In this embodiment of the invention, S3 includes the following sub-steps:
[0071] S31. Construct a first intrinsic matrix, a second intrinsic matrix, a third intrinsic matrix, and a fourth intrinsic matrix for each pixel in the internal pixel set;
[0072] S32. Perform a logarithmic operation on the largest eigenvalue of several intrinsic matrices of each pixel in the internal pixel set to obtain the degree of change of each pixel;
[0073] S33. Cluster the degree of change of all pixels in the internal pixel set;
[0074] S34. Based on the clustering results, identify the abnormal regions of the internal pixel set.
[0075] In this invention, four 2×2 intrinsic matrices (upper left, upper right, lower left, and lower right neighborhoods) are constructed. The maximum eigenvalue of each matrix is extracted, and the degree of variation is obtained through logarithmic operation. Finally, cluster analysis is used to distinguish normal and abnormal pixels. The eigenvalues of the intrinsic matrices reflect the correlation of local pixels, and clustering can automatically distinguish abnormal pixel sets with deviated features. The multi-directional intrinsic matrices cover the local neighborhood features of the internal pixels, avoiding the omission of defects; logarithmic operation amplifies feature differences, and cluster analysis automatically distinguishes anomalies, comprehensively capturing defects.
[0076] In this embodiment of the invention, in S32, the first pixel in the internal pixel set... Line number The first intrinsic matrix of column pixels The expression is:
[0077] ;
[0078] in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels;
[0079] In S32, the first pixel in the set of internal pixels Line number The second intrinsic matrix of column pixels The expression is:
[0080] ;
[0081] in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels;
[0082] In S32, the first pixel in the set of internal pixels Line number The third intrinsic matrix of column pixels The expression is:
[0083] ;
[0084] in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels;
[0085] In S32, the first pixel in the set of internal pixels Line number The fourth intrinsic matrix of column pixels The expression is:
[0086] ;
[0087] in, Indicates the first Line number The pixel value of each column pixel.
[0088] In this embodiment of the invention, in S32, the first pixel in the internal pixel set... The change in individual pixels The expression is:
[0089] ;
[0090] in, Represents the set of internal pixels. The first pixel The largest eigenvalue, Represents the set of internal pixels. The maximum number of feature values contained in a pixel. Represents the logarithmic function. This indicates the number of rows in the image of the aluminum alloy casting surface. This indicates the number of columns in the image of the surface of the aluminum alloy casting.
[0091] In this embodiment of the invention, S34 includes the following sub-steps:
[0092] S341. Extract the difference between the maximum and minimum cluster center values as the threshold;
[0093] S342. In each cluster of the clustering results, filter out data points that are less than the threshold, and take the pixels corresponding to the filtered data points as the abnormal regions of the internal pixel set.
[0094] In this invention, after clustering, the difference between the largest and smallest cluster centers is extracted as a threshold to filter data points with large deviations in the cluster (such as defective pixels having a significant difference from normal cluster centers), thus avoiding the subjectivity of manual setting.
[0095] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.
Claims
1. A data processing-based aluminum alloy casting inspection method characterized by, The method comprises the following steps: S1, collecting an aluminum alloy casting surface image, and splitting an edge pixel point set and an internal pixel point set from the aluminum alloy casting surface image; S2, determining an abnormal area of the edge pixel points according to a density coefficient of each pixel point in the edge pixel point set; S3, determining an abnormal area of the internal pixel point set according to a plurality of intrinsic matrices of each pixel point in the internal pixel point set; S4, taking the abnormal area of the edge pixel points and the abnormal area of the internal pixel point set as a detection result of the aluminum alloy casting, and marking.
2. The data processing-based aluminum alloy casting inspection method according to claim 1, characterized by, The S2 comprises the following sub-steps: S21, extracting a neighborhood position for each pixel point in the edge pixel point set; S22, taking a number of pixel values greater than pixel values contained in the neighborhood position as a participation degree; S23, taking a ratio between a pixel value of the pixel point and a total sum of pixel values contained in the neighborhood position as a basic degree; S24, calculating a density coefficient of the pixel point in the edge pixel point set according to the participation degree and the basic degree of the pixel point; S25, taking a pixel point with a density coefficient lower than a set threshold value as an abnormal area of the edge pixel point set.
3. The data processing-based aluminum alloy casting inspection method according to claim 2, characterized by, In the S22, the density coefficient of the pixel point The expression of the density coefficient is: ; wherein, denotes a base degree of a pixel point, denotes a participation degree of a pixel point, denotes an exponential operation.
4. The data processing-based aluminum alloy casting inspection method according to claim 1, characterized by, The S3 comprises the following sub-steps: S31, constructing a first intrinsic matrix, a second intrinsic matrix, a third intrinsic matrix and a fourth intrinsic matrix for each pixel point in the internal pixel point set; S32, performing logarithmic operation on maximum eigenvalues of the plurality of intrinsic matrices of each pixel point in the internal pixel point set to obtain a variation degree of each pixel point; S33, performing clustering processing on the variation degrees of all pixel points in the internal pixel point set; S34, determining an abnormal area of the internal pixel point set according to a clustering result.
5. The data processing-based aluminum alloy casting inspection method according to claim 4, characterized by, In the S32, the first intrinsic matrix of the row of the pixel point in the internal pixel point set is expressed as: the column pixel point is expressed as: ; in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels; In S32, the first pixel in the internal pixel set Line number The second intrinsic matrix of column pixels The expression is: ; in, Indicates the first Line number Pixel values of column pixels, Indicates the first Line number Pixel values of column pixels; In the S32, the third intrinsic matrix of the row pixel point of the internal pixel point set is expressed as: ; in, Indicates the first Line 1 Pixel values of column pixels, Indicates the first Line 1 Pixel values of column pixels; In S32, the first pixel in the internal pixel set Line 1 The fourth intrinsic matrix of column pixels The expression is: ; wherein, represents the pixel value of the pixel point at the i-th row and the j-th column. represents the pixel value of the pixel point at the i-th row and the j-th column. represents the pixel value of the pixel 6. The data processing-based aluminum alloy casting inspection method according to claim 4, characterized by, In the S32, the expression of the variation degree of the i-th pixel point in the internal pixel point set is: ; wherein, represents the i-th largest eigenvalue of the i-th pixel point in the set of internal pixel points, represents the number of largest eigenvalues contained by the i-th pixel point in the set of internal pixel points, represents a logarithm function, represents the number of rows of the surface image of the aluminum alloy casting, represents the number of columns of the surface image of the aluminum alloy casting. 7. The data processing-based aluminum alloy casting inspection method according to claim 4, characterized by, The S34 comprises the following sub-steps: S341, extracting a difference value between a maximum clustering center value and a minimum clustering center value as a threshold value; S342, screening data points smaller than the threshold value in each cluster of the clustering result, and taking pixel points corresponding to the screened data points as an abnormal area of the internal pixel point set.