1 Introduction

Pressure die casting is an efficient technological process that is used on a large scale. The basic problem of this method is that the porosity in castings occurs mainly due to gas entrapment in the melt at a very turbulent flow of liquid metal in the mold cavity. The so-called air occlusion also occurs during stacking of the liquid metal prior to introducing it into the mold cavity pressure, i.e. at the time of pressing. The presence of the gas phase in the mold cavity is thus the main problem of pressure casting technology. The occurrence of porosity is also determined by the purity of the alloy (e.g. inclusions or hydrogen dissolved in the melt). Inclusions deteriorate the liquidity of the molten metal and thus impede mold filling in places that are difficult to reach. Inclusions also work as nucleation sites for dissolved hydrogen, which increases gas porosity. Oxides are pore nucleation sites where hydrides are decomposed during cooling emission in the form of dissolved hydrogen gas. Dissolved hydrogen also tends to precipitate out of the solution in the form of hydrogen bubbles in the clotting time due to the much lower solubility of hydrogen in the solid state. Hydrogen is particularly problematic in aluminium alloys because it dissolves well in the liquid melt while in the solid state it dissolves with extreme difficulty. Thus, during solidification of the alloy it precipitates to form porosity. Usually, hydrogen porosity is characterized by dimensions in the range of 0.05–0.5 mm. These pores are evenly distributed throughout the volume of the casting [1, 2].

Determining the type and location of defects in the material is essential not only for quality control but also because it allows to establishing the source of their presence.

Hidden defects inside the casting that occur during manufacturing need to be diagnosed correctly, otherwise new defects may be introduced. Unfortunately, this is no easy task, because the defects are notoriously difficult to detect. In the last decades, industrial interest in the development of advanced non-destructive testing (NDT) techniques for qualification of materials and products has been increased noticeably [3].

NDT is becoming more commonplace and labelled as a tool to ensure product reliability. NDT methods allow obtaining information about the state (possible defects) of the tested material (sometimes even its characteristics) without physical interference in its structure.

There is no universal method for NDT, as each method has its limitations and applicability for specific cases [4]. The effectiveness of the tests depends on the type of element being tested, the sensitivity of the method as well as the type and location of the defects. In the case of castings, geometry is often a large obstacle in carrying out NDT. Since different types and sizes of defects have different effects on the performance of the casting, it is important that the NDT method is able to identify the type and size of the defects. Defect type classification technology has developed in the recent years and remains a research subject. There are varieties of difficulties in defect classification in casting [3]. The International Committee of Foundry Technical Association has a classification of nearly 100 common casting defects [5]. However, typical casting defects are: blow holes, shrinkage porosity, gas, inclusions, shrinkage cavities and cracking.

The most commonly used methods to detect internal casting defects are X-rays, the tightness test, ultrasonic testing or the eddy current technique [612].

Radioscopy has rapidly become the accepted method for controlling the quality of die cast pieces through visual or computer-aided analysis of X-ray images. The automatic pattern recognition process used in fault detection in aluminium castings always includes the stages of image formation, image processing, image segmentation, future extraction and classification. The segmentation process is crucial for the correct classification of defects.

We present in this paper a new way of the image segmentation method for flaw detection in aluminium casting using an X-ray analysis. Our method can be applied using public domain software which can been widely applied. Moreover, this research is the first to characterize a comparison of particular four methods used in non-destructive testing: radiographic, ultrasonic, eddy current and pulsed infrared thermography to detect flaws in pressure die casting. Furthermore, these methods were used to control the technological parameters of the casting process in high volume production of aluminium pressure castings and thus control the quality of castings performed. As up to now no such results have been presented.

2 Materials and Methods

The tests were performed on a casting of instrument housing (Fig. 1). Samples were prepared using three different rates of casting: 2.4, 2.6 and 2.8 m/s (ten pieces for each rate of casting). Other technological parameters of the process were constant for each sample. Compaction pressure was 320 bar, mold temperature was 200 \(^{\circ }\)C and the temperature of the liquid was 686 \(^{\circ }\)C. All samples were made of aluminium alloy (grade EN AC-4420), which examined chemical composition as determined by spark spectrometry is presented in Table 1.

Fig. 1
figure 1

Instrument housing produced with casting technology

Table 1 Chemical composition of alloy used to manufacture instrument housing

The industrial Yxlon MU2000 X-ray was used in the radiographic research for internal analysis of casting defects. The test apparatus was equipped with an X-ray tube with an accelerating voltage of 160 kV, a panel digital detector with a working surface area of 200 \(\times \) 200 mm and a six-axis manipulator system. Data acquisition was performed by the YXLON Image 2500/350 system, which was also used to improve the quality of imaging and archiving. A computer analysis of each image was conducted in ImageJ public domain software. All of the analyzed images had a resolution of 1000 \(\times \) 1000 pixels. Pattern image quality in “duplex” (in accordance with EN 462-5) was used to calculate the size of the volume of porosity, from pixels to millimetres.

Ultrasonic testing (on cuboidal samples with dimensions of approximately 25 \(\times \) 35 \(\times \) 5 mm (width \(\times \) height \(\times \) thickness) cut out from the castings—Fig. 4) was carried out on an Olympus EPOCH 600 ultrasonic flaw detector. A normal frequency of 10 MHz was used for the studies.

NDT using the eddy current method was performed on an Olympus NORTEC 600. A pencil-type coil with a frequency of 1 kHz was used in the study.

Studies using pulsed infrared thermography were carried out using a FLIR X6580SC thermal imaging camera and a Hensel EH PRO flash lamp was used as the source of the heat flux propagating through the direction perpendicular to the sample. Prior to measurement, the samples were covered with talcum powder to allow the greatest absorption of heat flux (reducing the light reflection effect) produced by the lamp during the measurement. Castings examined during the study were placed between the lamp and the infrared camera coupled with computer software.

3 Results and Discussion

3.1 X-ray Method

Figure 2 shows an example of the X-ray analysis for one of the tested specimens that was done on different sides of the sample. It was found that it was impossible to conduct a precise analysis of porosity in the samples without using computer image analysis. A trained operator can only detect the largest defects in the photos taken. In addition, the operatory will not be able to conduct a quantitative comparison of the porosity occurring in the material between the examined samples and thus cannot draw any correct conclusions regarding the technological process (to optimize its parameters).

Fig. 2
figure 2

Different types of X-ray imaging projections of the instrument housing produced with casting technology

Therefore, in these studies computer image analysis was applied in order to segment the porosity in the registered radiograms of the samples. The segmentation was based on dividing the image into areas with specified properties (shades of gray). One computer image analysis tool that allows segmentation is binarization. Binarization divides the image into objects and a background, which then enables their counting and a morphology study of these objects. Based on the histograms showing information decomposition of the gray levels, stages of pre-processing the input image were planned (Fig. 3a). A contrast stretch and then equalization were performed to improve the imaging. The histogram’s stretch conversion did not cause information loss of the image; histogram equalization resulted in a more even spread (flattening), so that the image became sharper and clearer. Figure 3b shows the results for the image with stretched histogram equalization after previous alignment.

Fig. 3
figure 3

Porosity segmentation algorithm: a radiogram of the casting housing registered in Xray analysis undergoing the process of computer image analysis, b photograph of the casting housing after stretching the histogram, then its alignment, c photograph of the casting housing after adaptive binarization, d photograph of the casting housing after erosion, e photograph of the casting housing after dilatation, f photograph of the casting housing after edge removal, g photograph of the casting housing after imposition of separated porosity on the base image

The next processing step was to obtain a binary image. Complex transformations, measurement and most of the quantitative analyses can be performed on these images. The technique of adaptive binarization was used to obtain a binary image (adaptive thresholding). It involves the use of different levels of the grayscale image. This process comprises successive transformations:

  1. 1.

    image smoothing on an averaging filter

  2. 2.

    subtracting the filtered image from the original

  3. 3.

    conducting binarization on the obtained image.

In ImageJ, binarization is carried out by using a Threshold window. The binarization threshold is automatically set in the middle between the largest and smallest pixel value of the image (default). The threshold binarization algorithm, “Mean” (available in the Threshold window), was used to conduct the binarization. Figure 3c shows the casting image after adaptive binarization. The next step in image processing was morphological transformations that led to segmentation of the porosity without changing the size and position of the pores. These transformations were erosion and dilation (made on the binary images). Erosion involves the removal of all image points with a value of 1 (black pixels) which have at least one neighbour with a value of 0 (white pixels). This procedure allows removing fine details (e.g. noise) and smoothing the edges of the segmented object (pores), as is shown in Fig. 3d. Dilation is the imposition of pixels along the edges of objects with a value of 1. It causes enlargement and removal of slight concavity on the segmented objects (Fig. 3e). The edges were removed manually with white colour (Fig. 3f). In this way, the white points of the monochrome image (places with pores) were separated from the gray shades of the aluminium alloy. The final step was the imposition of separated porosity on the base image of the casting (Fig. 3g).

Table 2 presents the summarized results of the research regarding the amount of porosity detected in all of the analyzed samples depending on the rate of casting. On the basis of the obtained results, it was found that with an increasing rate of casting the total number of pores in the performed samples decreased. Furthermore, it was observed that the maximum pore size for any of the tested samples did not exceed 1 mm.

Table 2 Number of pores detected in all of the analyzed samples depending on the rate of casting Rc: 2.4, 2.6 and 2.8 m/s (counted by using computer image analysis and the segmentation algorithm)

The porosity detected in the castings was analyzed according to size and circularity. The parameter range of the circularity was from 0 to 1. If the obtained result of the analysis is closer to 1, that means it is more circular. Table 3 presents the results of measurements of the pores’ quantities (divided into 4 ranges of circularity) depending on the rate of casting. On this basis it was found that with an increasing rate of casting the amount of pores with a circularity in the range of 0.81–1.0 (from 85.5 % for the 2.4 m/s rate of casting to 87.8 % for the 2.8 m/s rate of casting) increased. Pores with a circularity of less than 0.5 practically did not occur in the analyzed samples.

Table 3 Relationship between quantities of pores in the defined range of circularity and the rate of casting Rc: 2.4, 2.6 and 2.8 m/s

The most frequently occurring pores in the analyzed samples had a range up to 0.2 mm (Table 4). Their volume fraction increased with the rate of casting (from 57 % for the 2.4 m/s rate of casting to 69 % for the 2.8 m/s rate of casting). Furthermore, it was observed that the increased rate of casting allowed to reduce the total volume fraction of porosity present in the samples.

Table 4 Relationship between quantities of pores in the defined range of size and the rate of casting Rc: 2.4, 2.6 and 2.8  m/s

The results of pore shape (depending on the quantities, size and location) allow to concluding that a large fraction of the small spherical pores comprises hydrogen type porosity. Pores resulting from the presence of hydrogen in the liquid melt are in the size range of 0.05–0.5 mm and have a spherical shape, whereas the remaining pores correspond to gas porosity (0.5–5 mm) with their shape and size. The obtained results are consistent with the results of research carried out by Mix [4].

3.2 Ultrasonic Method

Due to the complicated shape of the casting and the quality of its surface (no cleaning treatment such as sandblasting or shot blasting was carried out on the samples), no signal derived from the porosity present in the samples could be obtained. This effect was the same regardless of the type of test samples performed at different rates of casting. Furthermore, the small sizes and homogeneous distribution of porosity were an additional reason for the failure of the ultrasonic measurements.

However, the ultrasonic examination allowed us to use the dependence of the variable speed of ultrasonic wave propagation in different media (an ultrasonic wave propagates more than 10 times faster in metal than in air). On this basis it can be concluded that the increased volume fraction of porosity will cause a reduction in the speed of ultrasonic wave propagation. In order to verify this assumption, cuboidal samples with dimensions of approximately 25 \(\times \) 35 \(\times \) 5 mm (width \(\times \) height \(\times \) thickness) were cut out from the castings (Fig. 4).

Fig. 4
figure 4

Instrument housing produced by using casting technology. The black rectangle shows the selected area from which the samples were collected for ultrasonic measurements

Table 5 presents the results of ultrasonic wave propagation speed depending on the rate of casting. It was observed that with an increase in rate casting, the propagation speed of the ultrasonic waves also increased. Such a result proves a decreasing volume fraction of porosity in the samples. The results are fully consistent with the results obtained for the X-ray studies that were presented earlier.

Table 5 Speed of ultrasonic wave propagation depending on the rate of casting Rc: 2.4, 2.6 and 2.8 m/s

On the basis of these results it was found that ultrasonic measurements can be used to check the quality of the castings and thus can help control and optimize the technological process of aluminium die casting production. However, it should be remembered that these measurements may require the preparation of appropriate samples for research. In addition, the results obtained here do not provide detailed information about the shape, size and amount of porosity in the investigated samples, as was the case for the X-ray measurements.

3.3 Eddy Current Method

Research using the eddy current method allows to detecting defects located directly under the surface of the casting. Despite the conducted measurements, the applied hardware configuration did not show that the eddy current method can be used effectively to analyze raw castings. The performed analysis revealed only damages occurring on the casting surface (which were already visible during visual observation of the samples). Furthermore, the fact that fine porosity occurred was mostly not connected with the surface of the samples (which was confirmed by a metallographic investigation) and also contributed to a failure in applying the eddy current method to an analysis of raw castings.

3.4 Pulsed Infrared Thermography Method

The technique of pulsed infrared thermography was used to detect porosity in the investigated castings. Triggered by the flash of the lamp, the heat flow from one side of the examined casting caused a directional flow of heat to the non-illuminated side, as was observed by the infrared camera (which captured the distribution of the heat flow). Data registered in this manner were displayed on the computer screen in the form of image sequences. Next they were subjected to mathematical analysis. If the heat flux spreading through the casting encountered a defect (e.g. porosity or crack), the casting would be weakened in the place where the defect occurred because it reduced the thermal diffusion rate. The thermal imaging camera then registered a less intense signal (visible in the image as darker points) than that observed for the remaining area. Measurements of aluminium castings using pulsed infrared thermography did not produce the expected results of the research. Regardless of the rate of casting, the samples did not reveal any kind of internal defects of the material. As was in the case of eddy current testing, they demonstrated only surface defects (Fig. 5). Thus we can conclude that the fine porosity that occurs in the casting does not allow registering any differences between the speed of thermal diffusion in the metal and the defect (e.g. air) by using the infrared thermography method.

Fig. 5
figure 5

Example of thermographic analysis of the examined castings: a initial image of a series of images recorded during measurement, b central image of a series of images recorded during measurement

4 Conclusions

A new way of the image segmentation method for porosity detection in aluminium pressure die casting using X-ray analysis has been proposed. The proposed method can be widely applied through using public domain software. The great advantage of our research is the use of the radiographic method combined with computer image analysis (with the algorithm of porosity segmentation as described and presented in this paper) which allows detecting even the smallest casting defects. Moreover, the obtained results allow determining the causes of their formation. An analysis of the shape and size of the detected porosity allows carrying out a quality evaluation of the products and optimization of the technological process of production in an aluminium pressure foundry. Furthermore, the radiographic method is the only method that allows to analyzing raw castings without special surface preparation or sampling. The ultrasonic method can also be used to assess the casting quality (to detect defects or porosity but without the possibility of interpreting their size or source). However, such measurements require proper preparation of the samples/surface. The results of the analyses obtained by using the ultrasonic method allow to correctly control the die casting parameters. The methods of eddy currents and pulsed infrared thermography are not suitable for the detection of fine porosity which is present in aluminium castings.