# Spotting Defects More Clearly: Radiographic Image Enhancement

Nondestructive testing (NDT) is used in many fields, and particularly for critical applications such as welds of pressure vessels, ships, aircraft, etc. One of the most important techniques used in NDT is radiography, which is based on the transmission of X-rays or gamma rays through an object to produce an image on radiographic film.

The examination, analysis, and interpretation of radiographs, often done manually by experienced interpreters, are time- and labor-intensive tasks. In addition, human evaluation of weld quality based on film radiography is subjective, inconsistent, and sometimes biased. Fortunately, computer hardware and software technologies have developed very quickly, so it is possible to use computer ‘vision' instead of a human being to find defects. In this regard, image enhancement is a significant part of automated radiograph inspection systems.

Examination of the radiograph in Figure 1 and the gray level profile in Figure 2 shows that the image is low contrast, high noise, and the background is not uniform. The defects are all quite small and their positions are random. These factors make defect detection difficult, so it is necessary to enhance the contrast and reduce the noise before defect recognition. Currently, most researchers use histogram equalization to enhance contrast of radiographic images and use median filter to reduce the noise of radiographic images [1], [2], [3]. In our work we used contrast limited adaptive histogram equalization and adaptive wavelet threshholding to enhance radiographic images. Then we compared them with histogram equalization and median filter techniques.

Radiographic images, such as that shown in Figure 3, usually have poor contrast. The aim of contrast enhancement is to improve the quality of radiographic images. In original radiographic images, the distribution of gray levels is highly skewed towards the darker side, as show in Figure 4. Therefore, it is desirable to stretch the histogram distribution to a rectangular shape instead of a skewed one.

## Histogram Equalization

Currently, the most frequently used technique to enhance the contrast of radiographic images is histogram equalization (HE). It is based on the assumption that a good gray-level assignment scheme should have equally distributed brightness levels over the whole brightness scale. Individual pixels retain their brightness order. However, the values are shifted so that they are equally distributed over the brightness scale. The result of brightness transformation should be that the cumulative histogram becomes a straight line.

If Gis the transformed gray value corresponding to the original gray value of any pixel, the principle of histogram equalization postulates that G=F(G)=Gmin + GH(G)/N where G=Gmax- Gmin, Gmax and Gmin represent the upper and lower limits of the transformed gray values, respectively, H(G) represents the cumulative histogram of the gray values of the original images, and N represents the number of pixels over which the histogram is taken.

## Adaptive Histogram Equalization

HE transforms image pixels based on overall image statistics. Adaptive histogram equalization (AHE) involves selecting a local neighborhood centered around each pixel, calculating and equalizing the histogram of the neighborhood, then mapping the centered pixel based on the new equalized local histogram [4]. For example, at each point in an input image we could consider an 8x8 window around that point. The 64-element histogram could then be used to determine a mapping function to histogram equalize that point based on its neighborhood. Since each point would be based on its own neighborhood, the mapping function can vary over the image.## Contrast Limited Adaptive Histogram Equalization

Contrast limited adaptive histogram equalization (CLAHE) seeks to reduce the noise produced in homogeneous areas by basic adaptive histogram equalization. The technique was originally developed for medical imaging applications, and has been successful for the enhancement of portal images [5]. Homogeneous areas can be characterized by a high peak in the histogram associated with the contextual regions, since many pixels fall inside the same gray range. With AHE, a local histogram is calculated and used to obtain the final value. High peaks in the histogram lead to large values in the final image because of integration. This problem can be corrected by limiting the amount of contrast enhancement at every pixel, which is achieved by clipping the original histogram to a limit.## Comparative Results

To compare results of the different methods, we enhanced a specific radiographic image (Figure 3) by the HE, AHE and CLAHE techniques. The result of histogram equalization on the image can be seen in Figure 5. Because a digital radiographic image has only a finite number of gray scales, an ideal equalization is not possible. It causes some pixels with initially different brightness values to be assigned the same value, and other values to be missing altogether. From Figures 5 and 6, we can see that the histogram equalization technique enhances contrast for brightness values close to the maxima in the histogram and decreases contrast near the minima. That is, it improves image contrast in areas of poor contrast, but does so at the expense of areas where there is already good contrast.Figure 5 shows that histogram equalization (HE), in its basic form, can give a result that is worse than the original image. Large areas of similar brightness can cause peaks in the histogram. Frequently, these correspond to areas of background, and are essentially uninteresting. The effect of histogram equalization on these areas is to enhance the visibility of noise. Features of interest in the radiographic images, such as defects, need enhancement locally. However, HE does not adapt to local contrast requirements; minor contrast differences can be entirely missed when the number of pixels falling in a particular gray range is small.

Figures 7 and 8 show adaptive histogram equalization (AHE) with a window size of 8x8. Local contrast is largely improved, and minor contrast differences of defects with background can be kept. However, the most striking feature of the image is the background noise that has become visible. Therefore, noise present in AHE images is a major drawback of this method.

Figure 9 shows the application of the contrast limited adaptive histogram equalization (CLAHE) method on the image. The defect contrast is improved and the background noise is greatly reduced. In fact, CLAHE is an improved version of AHE. It can overcome the limitations of standard histogram equalization and AHE.

## Noise Reduction

Median filter is the most frequently used method of removing noise from radiographic images. The median filter deploys a small mask template, which is usually 3x3 or 5x5. The template operation maybe calculated by either correlation or convolution operators. The median filter replaces a pixel's gray level with the median value of its neighborhood.Mathematically, the function is defined as follows: G(x,y)=median{G(x1,y1)|(x1,y1) is in N(x,y)} where N(x,y) are the immediate neighbors of the pixel (x,y).

Another noise reduction technique is wavelet thresholding (first proposed by Donoho [6]). It is a signal estimation technique that exploits the capabilities of wavelet transform for signal de-noising. Having recently received extensive attention from the research community, wavelet de-noising attempts to remove signal noise while preserving the signal's characteristics, regardless of its frequency content.

It involves three steps: calculating the wavelet transform; thresholding the wavelet coefficients and discarding (setting them at zero) the coefficients with relatively small or insignificant magnitudes; and computing the inverse wavelet transform to get the de-noised estimate. By discarding small coefficients (in the second step) one actually discards wavelet basis functions that have coefficients below a certain threshold.

The threshold determination is an important question when de-noising. BayesShrink is a sub-band adaptive threshold that is computed for each detail subband. In BayesShrink [7], we determine the threshold for each sub-band assuming a Generalized Gaussian Distribution (GGD). The threshold is set: TB(x)=--2 x

where is the noise standard deviation, and xis the signal standard deviation.

## De-Noising Method Comparison

We reduced a radiographic image using the median filter and adaptive wavelet thresholding methods, as shown in Figure 11. Gray level change is the main feature of the defects. The method that removes the noise and affects radiographic resolution the least is the best one for defect recognition. From Fig. 11, we can see wavelet thresholding (BayesShrink) is more visually appealing and adapts to discontinuities in images better than does the median filter method.

In order to compare the two methods more carefully, the gray level of the pixels along the line (Figures 11b and 11c) is shown in Fig.12. The gradient (first order derivative) of the gray level along the line is shown in Fig.13. For adaptive wavelet thresholding, the change rate of the gray level and the gradient is higher. Table 1 shows these in detail. Therefore, adaptive wavelet thresholding can keep the sharpness of the defect's edge well.

## Conclusion

We recommend using contrast limited adaptive histogram equalization and adaptive wavelet thresholding to enhance radiographic images. Comparative analysis between these methods and more commonly used techniques has shown the effectiveness of these methods. CLAHE not only improved the local contrast of the radiographic images, but also reduced the noise produced in homogeneous areas. The adaptive wavelet thresholding technique can remove image noise while maintaining the sharpness of defects' edges well. Therefore, CLAHE and adaptive wavelet thresholding are helpful for accurate defect recognition. IH