In order to solve the problem of the lack of feature extraction dimension of typical defects in X-ray images of aluminum alloy die castings, and the influence of a large number of manual interventions on the feature extraction efficiency, a feature extraction algorithm of typical defects in X-ray imaging of aluminum alloy die castings was proposed. This method establishes multiple feature analysis dimensions for typical defects such as pores, under-casting and deformation in aluminum alloy die-casting parts, uses filtering denoising, threshold segmentation and other means to preprocess the die-casting part image, and extracts the defect perimeter and area by extracting the defect perimeter and area, etc. Multi-dimensional features, realize automatic feature extraction of pores and slag inclusion defects. The application in the actual production of aluminum alloy die castings in some enterprises shows that this method can effectively extract the typical defect characteristics of aluminum alloy die castings, which can provide a reference for subsequent defect detection and identification.
With the development of social science and technology, aluminum alloy die castings are used more and more in the manufacturing industry. With the increasing demand for aluminum alloy die castings, the quality requirements are getting higher and higher in mass production, so the quality inspection of aluminum alloy die castings is very important. The traditional method in China is manual detection, which is cumbersome, inefficient, difficult to store results and highly dependent on manual experience. The process of assisting quality inspection by performing a series of image processing on X-ray images of aluminum alloy die castings can significantly improve the above problems, especially image processing through threshold segmentation. Common defects of aluminum alloy die castings include pores, undercasting, inclusions and deformation. If the identified defects are analyzed in multiple dimensions, and the data of these dimensions are automatically extracted, it can better help the subsequent identification of casting defects.
In order to better identify typical defects in automotive aluminum alloy die castings, the perimeter and area of defects such as pores and slag inclusions in the X-ray image are mainly considered. In order to realize the automatic extraction of casting defect features, a series of defect image processing is carried out on the X-ray image of aluminum alloy die casting, including filtering and denoising, image enhancement processing and threshold segmentation processing. Finally, feature extraction is performed on the well-processed image and the relevant parameters are automatically given.
The acquisition process of X-ray images of aluminum alloy die castings will involve a large amount of electromagnetic pulse noise signals. Unprocessed images contain a lot of interference noise, and direct feature extraction will cause a lot of noise to be mistaken for defects, reducing the accuracy of defect feature extraction. Therefore, the X-ray images of aluminum alloy die castings are mainly processed in three steps: filtering and denoising, image enhancement processing and image threshold segmentation processing.
Generally the image will have some noise interference. Therefore, the first step of computer processing images is filtering and denoising, in order to reduce the probability of errors in subsequent processing. The median filter, mean filter, Gaussian low-pass filter, and Butterworth low-pass filter were selected. By comparing the filtering effects of these filters, choose the best method.
(1) Median filter
The median filter is a non-linear filter. Compared with the linear filter, it can remove the relatively isolated interference signals in some images, and at the same time, it can effectively preserve the details in the image. But it is also easy to remove some defects such as pores and bubbles.
(2) Mean filter
The mean filter is a linear filter. Compared with the median filter, the mean filter may lose some details in the image, because these details are replaced by the average value of the surrounding pixels.
(3) Gaussian low-pass filter
Gaussian low-pass filters can generally be divided into two types. One of the convolution operations performed by sliding windows is used here, and weighted average is usually used. Moreover, the Gaussian low-pass filter can obtain the spectrum of the image, and then use the transfer function to achieve frequency domain centering.
(4) Butterworth low-pass filter
The difference between the Butterworth low-pass filter and the Gaussian low-pass filter is reflected in the difference in the filter function H.
For the X-ray image of automotive aluminum alloy die-casting, Gaussian filter can play a very good role. Therefore, Gaussian filter is adopted as the first step of image preprocessing.
1.2 Image enhancement processing
After filtering and denoising, the quality of the image has been improved, but there is still a problem that the defects cannot be well distinguished from the image background. In order to make the defect and the background more easily distinguishable, the image contrast needs to be enhanced. The effects of grayscale transformation and histogram correction are analyzed.
(1) Grayscale transformation
Grayscale transformation is to directly transform the grayscale of image pixels. The mapping function is
g(x,y)=T[f(x,y)](6)
The first is the simplest linear transformation as a mapping function. The mapping expression is
g(x,y)=af(x,y)+b(7)
In the formula, f(x, y) is the gray value of a specific pixel, and g(x, y) is the gray value of the corresponding pixel after linear change. After a series of attempts, the parameters a=1.4 and b=0 were initially selected.
A non-linear transformation can also be used to perform grayscale transformation. Try it with an exponential transformation that actually works better. The mapping expression of exponential transformation is
g(x,y)=c×f(x,y)^r,r∈[0,1](8)
In the formula, both c and r are adjustable parameters, and the adjustment of parameters has a greater impact on the results. Through a large number of tests, the parameters of c = 1 and r = 0.7 are initially used for grayscale transformation.
(2) Histogram processing
The grayscale processing of histogram is a nonlinear image enhancement scheme, and the most common method is histogram equalization. The main principle of histogram processing is: first count the pixel values of each pixel in the image into a histogram, and calculate the frequency occupied by each grayscale, and then obtain the cumulative distribution function of the grayscale, and finally calculate the cumulative probability of Multiply by 255 to get the new grayscale value.
1.3 Threshold segmentation of images
After filtering and enhancing the image, the image is finally segmented by threshold. After the image is segmented, many defects can be easily identified by the naked eye, and the main features can be extracted smoothly. Common threshold segmentation methods include Otsu and iterative segmentation methods.
(1) Otsu threshold segmentation
The biggest feature of this algorithm is to maximize the distinction between two types of pixels. At the same time, it can also achieve a good effect for some images with double peaks on the grayscale histogram.
The principle is to perform histogram processing on the initial image to obtain a grayscale histogram and perform normalization processing. Determine an initial threshold, so that the whole image can be divided into two categories, those greater than the threshold and those less than the threshold, the proportion of these two types of grayscale is recorded as ω0 and ω₁, and the average grayscale μ0 and μ₁ are recorded at the same time. The average gray level of the image is denoted as μ. The next step is to calculate the variance between classes. The formula for calculating the variance between classes is:
g=ω0 (μ0-μ)^2+ω₁ (μ₁-μ)² (10)
Simplify by combining the relationships of ω0, ω₁, μ0, μ₁ and μ
g= ω0 ω₁ (μ0-μ)² (11)
Then traverse the entire image, calculate the inter-class variance of each pixel, and the pixel with the largest inter-class variance value is exactly the best threshold for the threshold segmentation method determined by the Otsu algorithm.
(2) Iterative threshold segmentation method
The iterative threshold segmentation method is based on the Otsu algorithm with some optimizations. The iterative threshold segmentation method optimizes the Otsu algorithm by approaching the limit, and the basic principle is somewhat similar to that of Otsu.
The main processing steps of the iterative threshold segmentation method are as follows: first, the grayscale range of the initial image is taken out, and the middle value of the grayscale range is taken as the initial threshold μ0, which is similar to the Otsu algorithm, and then the average grayscale μ₁ and μ₂ of the two pixel classes can be obtained, The new threshold μ directly takes the average of the average gray levels of the two pixel classes. If the difference between the two is less than the given error parameter T0, the new threshold μ is directly determined as the optimal threshold, otherwise the above is repeated until the optimal threshold is found.
2 Feature Extraction Algorithms
After the image processing of the X-ray image of the aluminum alloy die-casting part is completed, it is necessary to perform feature extraction on the defects of the image. Feature extraction is carried out for the area features and perimeter features of porosity defects and slag inclusion defects of aluminum alloy die castings. Stomatal defects and slag inclusion defects are common aluminum alloy die casting defects and these defects can be clearly reflected on the X-ray image. The extraction of area and perimeter is based on connected regions.
2.1 Connected regions
Taking one pixel in the image as the center, the eight pixels adjacent to the center pixel are defined as the connected area of the center pixel. Due to the transitivity of the connected region, a cavity represented by metal defects can be identified as a connected region
2.2 Identification of defective areas
The connected area formed by the pixel points of the defect area is the defect area. The identification of defective areas uses the classic depth-first algorithm (DFS). The specific steps to achieve defect area extraction by depth-first algorithm are as follows:
Step 1: Traverse all the pixels in the image, and judge each pixel: ① If the value of the pixel is 1, that is, the defect area, perform the following steps. ② If the value of the pixel point is 0, that is, it is not a defect area, continue to traverse the next pixel point. ③ If the pixel has been traversed, continue to the next pixel. until all pixels are traversed.
Step 2: Take the current pixel as the center pixel, and see if the 8 pixels around the center pixel have pixels whose value is also 1.
Step 3: If there are pixels with a value of 1 around the center pixel, and the number is 1, use this pixel with a value of 1 as a new center pixel, and repeat step 2.
Step 4: If there are pixels with a value of 1 around the center pixel, and there are more than one, repeat step 2 for each point in turn.
Step 5: If there is no pixel with a value of 1 around the center pixel, mark this pixel as an edge pixel, and go back to step 1 to traverse the next pixel.
2.3 Area extraction of defect area
After the defect area is obtained, the area calculation of the defect area is performed. The area of the defect area is equal to the number of pixel points in the defect area. By directly calculating the number of pixels in the defect area, the area of the defect area can be obtained directly.
2.4 Perimeter extraction of defect area
The calculation of the perimeter of the defect area is more complicated than the area. The perimeter is not the superposition of pixels in the edge area of the defect area. The specific calculation is to find the pixel point at the edge of the defect area, select any pixel point (x₁, y₁) as the starting point, and find the pixel point (x₂, y₂) on the next edge in a clockwise or counterclockwise direction, two The distance between pixels can be defined as:
Then find the next adjacent edge pixel point (x₃, y₃), and calculate the distance between the second point and the third point, and finally sum the distances of all points, and the sum obtained is the circumference of the defect area. long.
The features of typical defects of aluminum alloy die-casting parts are extracted, and the image is processed by Gaussian filtering, linear enhancement, Otsu threshold segmentation method and local threshold method to obtain a processed binary image, and finally the binary image is directly characterized. extract. The whole process realizes the automatic and rapid extraction of defect area and perimeter features based on MATLAB, which solves the problems of lack of feature extraction dimension and manual intervention affecting feature extraction efficiency of typical defects in X-ray images of aluminum alloy die castings. Since the X-ray image of aluminum alloy die-casting mainly presents two-dimensional images, the extraction of defect features of aluminum alloy die-casting in this experiment mainly focuses on the extraction of two-dimensional data. It is convenient to extract defect features.
Aluminum High Pressure Die Casting
Aluminum Low Pressure Die Casting
Aluminum Gravity Casting
Aluminum Investment Casting
Aluminum Sand Casting
Precision CNC Machining
Die Casting Tooling
Zinc Pressure Die Casting
Rapid Prototype Manufacture
Surface Finishing
LED Work Light Housing
Wheel Chair Parts
LED Lighting Housing & Heat Sink
Telecom Parts Heatsink Housing
Aluminum Furniture Parts
Lighting Industry & Fixtures Components
Die Casting Motor Housing
Automotive Casting Components
Water Heater Components
Precision CNC Machining Components
Mechanical Products
Automotive Led Heat Sink
Aluminum Hydraulic Housing
CNG Valve Parts
sales@innovaw.com
Michael_Dong18@hotmail.com
904-905, China-base Building, No.666, Tiantong South Road, Ningbo 315100, China
NO. 45, Baofeng Road, Eastern Suburb Development Zone, Fenghua 315500, China
Shaojiadu Street, Linhai City, Zhejiang Province 317000, China
Forging Web