- Open Access
Weld defect detection using a modified anisotropic diffusion model
EURASIP Journal on Advances in Signal Processing volume 2012, Article number: 46 (2012)
This article proposes a new modified anisotropic diffusion scheme for automatic defect detection in radiographic films. The new diffusion method allows to enhance, to sharpen anomalies, and to smooth the background of the image. This new technique is based on the modification of the classical diffusion rule by using a nonlinear sigmoidal function. Experimental results are carried out on multiple real radiographic recorded films of Gaz pipelines of the "Tunisian Society of Electricity and Gas distribution: STEG" and the society "Control offices--chemical and industrial analysis laboratories: Saybolt- Tunisia". The new automatic defect detection method shows good performance in comparison with other existing algorithms.
Industrial radiography is now a well-established technique for the identification and the evaluation of defects such as discontinuities, cracks, porosities, burn thru, and lack of penetration found in welded joints (Figure 1). These radiographic films are mainly used in petroleum, petrochemical, nuclear, and power generation industries especially for the inspection of welds in the pipelines.
Until now and in several real industrial applications radiographic film analysis are done exclusively by the radiograph inspector, such as in the society "Control offices--chemical and industrial analysis laboratories: Saybolt-Tunisia". The radiograph inspector is then required to visually inspect each film and detect the presence of possible defects which he must then identify and measure. This study is made a tedious task because of the low dimensions of certain defects (some fissures can have a thickness around 200 μm), the low contrast and a noised nature of some radiographic films. Consequently, the detection decision can be subjective in some cases and work conditions.
Several generic systems, able to carry out automatic inspection, are already marketed [1–4]. But their capacity to fault detection is limited to simple and specified applications for which the defects are well marked by only some changes in the graylevel or the form. Some of the most important achievements in this area are presented below.
In , the authors proposed a digital image processing algorithm based on a global and local approach for detecting the nature of defect in radiographic images. This algorithm is based first on smoothing the image using a filter and then a dynamic stretching procedure is applied to the region of interest (ROI) by a look up table transformation. Second, they extract the defect by applying the morphological operations which eliminate small holes, spots, and connect the closely regions.
Authors of [3, 5] proposed a fuzzy k-nearest neighbor method based on multilayer perceptron neural network and a fuzzy expert system for the classification of welding defect types. The features used for the classification are distance from center, circularities, compactness, major axis width and length, elongation, Heywood diameter, the intensity average, and its standard deviation.
A typical method for automated recognition of welding defects was presented in . The detection algorithm follows a pattern recognition methodology steps as follows:
Step 1: Segmentation: different regions are found and isolated from the rest of the X-ray image using a watershed algorithm and morphological operations (erosion and dilation).
Step 2: Feature extraction: regions are measured and shape characteristics are quantified such as diameter variation and main direction of inertia based on invariant moments.
Step 3: Classification: the extracted features of each region are analyzed and classified using a k-nearest neighbor classifier. According to the literature, the method is robust and achieves good detection rate.
In , a welding defect classification method is proposed. In a first step, called image pre-processing, the quality of the image is improved using a median filter and a contrast enhancement technique. After that the evaluation of the characteristic parameters following a relevance criterion in discriminating welding defect classes by using a linear correlation coefficient matrix is then used.
Liao and Ni  proposed a weld extraction method based on the observation of the intensity plot where the plot of a weld seems to be a Gaussian curve with respect to the other objects in the image. Then, a weld detection approach based on a curve fitting was proposed. Their main idea is to simulate a 2D background for a bad characterized normal welding by low spatial frequencies in comparison with the high spatial frequencies defect image. Thus, a 2D background is estimated by fitting each vertical line of the weld by a polynomial function, and the obtained image is subtracted from the original one.
A two step technique to detect flaws automatically is proposed in  where the authors used a single filter. This method allows first to identify potential defects in each image of the sequence, and second to match and track them from image to image. Many other weld defect detection methods are so far presented and proposed in the literature. However, each technique presents its own advantages and drawbacks. A comprehensive review paper to compare these techniques is now missing in the literature. In this article, we shall focus our attention on a well-known technique namely the anisotropic diffusion model used to the weld detection defects .
Anisotropic diffusion has widely been used as an adaptive edge-preserving smoothing technique for edge detection , image restoration , image smoothing , image segmentation , and texture segmentation . In this study, we extend the work of Shin-Min Chao and Tsai  used to defect detection in TFT-LCD screen (Thin Film Transistor--Liquid Crystal Displays) to tackle the problem of defect inspection in radiographic films. Consequently, a new anisotropic diffusion scheme is proposed.
Besides that the anisotropic technique has some drawbacks, but it is seen by the users as the appropriate and most used one. Hence, this article is devoted to the improvement of this technique and its application to the identification of weld defects in the gas distribution pipelines of the "Tunisian Society of Electricity and Gas distribution: STEG."
The main improvement of the method is the use of a more complex exponential diffusion function multiplied by a standard used rule. The effectiveness of the new modification exhibits high detection level of the obtained experimental results.
This article is organized as follows. In Section 2, a preview of the characteristics of the radiographic films on welds and the corresponding images prepared by the "Control offices--chemical and industrial analysis laboratories: Saybolt -Tunisia" is given as well as the principle of Gamma Ray (γ-ray) radiography. The preprocessing steps are presented in Section 3. A review of the Perona-Malik anisotropic diffusion rules and the improved diffusion model proposed by Shin-Du  are developed in Section 4. Section 5 presents the new proposed anisotropic diffusion model and presents experimental results on many radiographic images with various defects. Finally, the main conclusions of this study are given in Section 6.
2. Preview of the γ-ray radiography and radiographic films on welds
To assess the quality of the welded joints, radiography is among the most useful of thorough and non-destructive tests. It is based upon exposing the target area to the short wavelength. In the society Saybolt-Tunisia the γ -ray is used from the Iridium-192. The corresponding wavelength is about 510-7 to 310-4 μm. We shall note that the γ-ray can penetrate and then inspect joints of bigger thickness than treated by X-ray. To produce effective γ -ray a small pellet of Iridium-192 sealed in an appropriate capsule is used. This latter is placed on one side of the object being screened, and a photographic film is placed on the other side. The γ -rays pass through the target area and create an image on this film which will be later developed and examined.
As it is well known, the quality of radiography images depends on several parameters such as (and not limited to) the emplacement of the source, the exposure time of the film to gamma radiations, the film quality, etc .
In radiograph the radiation intensities transmitted by the source through the target area are rendered as difference densities in the image. The difference of densities from one region to another constitutes the radiographic contrast. Consequently different films have different contrast characteristics. To check the film quality, the following parameters are mainly considered :
The radiographic density or the optical density which is a measure of the film darkening.
The radiographic contrast that evaluate the capacity to distinguish different tones of gray in the film itself.
In the purpose of measuring the radiographic density the society Saybolt Society uses a densitometer of type SM-12 "Pocket Pal". In the Figure 2 some characteristics of this devise are given. In practice the acceptable density values lie in the range of 1.8 and 3.5.
The usual method of measuring the radiographic contrast is to include some standard details in the image which can give an indication of the image quality. Such devices are known as "Image Quality Indicators (IQIs)" or "penetrameters". An IQI must be small and relatively cheap to manufacture if it is to be used on every radiograph and should be as sensitive as possible to changes in the radiographic technique. In Saybolt-Tunisia the Wire-Type IQI is used (More precisely the IQI DIN 54109). In Figure 3 a scheme of the wire IQI and some related characteristics are given.
3. Preprocessing steps
Film digitizing is a critical part of the weld recognition system. Hence, selecting optimized resolution of scanning and acceptable quality of digitizing plays an important role in whole system performance.
In this study, real radiographic films are extracted from the database of a standard films provided by the Society of Saybolt-Tunisia. These radiographic films are considerably dark and their density is rather large. After digitization the fundamental characteristics of these images are
Lack of the contrast between the defect and the background of the image.
Presence of a gradient in the background of the image, characterizing the variation of thickness of the part being inspected. This gradient can affect the detection of small size and/or low contrast defects.
Granular aspect of the background of the image is seen as a background noise. This is due to the granular nature and the thickness of the emulsion and the digitization operation.
As a result, these images are difficult to process and segment, and consequently conventional methods such as thresholding, edge detection, texture analysis, and others fail to give interesting results.
The second step after the image digitization is the filtering process.
3.2. Median filtering
The median filtering allows mainly the attenuation/elimination of noise. Indeed the acquired images should pass through a stage of image filtering in order to remove distracting and useless information . For example, the existence of impulsive noise in the images is one of the most encountered problems that should be treated.
The application of a low-pass filter is used to remove noise in radiographic images. The median filter is a nonlinear filter used to remove the impulsive noise from an image [18–20]. Furthermore, it is more robust than the traditional linear filtering, because it preserves the sharp edges. Median filter is a spatial filtering operator; it uses a 2D mask applied to each pixel in the input image. This filter performs better than the major averaging filters because it can remove noise from inputting images with a minimum amount of blurring effect.
The median filter operation can be expressed as:
where, f(i, j) represents the gray level value of the input image at the pixel (i, j), g(x, y) represents the gray level value of the smoothed image, R(x, y) represents a W×W window centered at the pixel (x, y) and MEDIAN stands for the median of the gray level values within the specified window.
In order to simplify the defect detection procedure, the majority of works begin by localizing the ROI and then applying the weld detection algorithm steps.
3.3. Localization of the ROI
For the multiple reasons evoked above, it is difficult, event's impossible, to detect the presence of small defects and determine accurately their sizes, during the radiogram visualization. Consequently, for the seeking of simplifying the task, one could begin by selecting the ROI, i.e., which can be considered as the parts of the image where the radiograph interpreters suspect the presence of imperfections. The selection of the ROI prevents the operator to make treatments on the irrelevant regions of the image and allows, furthermore, to reduce the computing time for real-time applications. Figure 4 presents a typical example of the selection of the ROI in a radiographic image.
In the following, we shall present the classical diffusion model followed by the new proposed anisotropic weld defect detection algorithm.
4. Study of the Perona-Malik anisotropic diffusion model (PMAD)
4.1. Fundamental scheme
In 1990, Perona and Malik  proposed to consider the intensity of the image as a concentration of fluid evolving toward equilibrium. Consequently, they proposed the new anisotropic diffusion model based on the use of the classical heat equation of diffusion. Recall that diffusion is a natural physical phenomenon that moderates the concentration of differences without creating or destroying mass. Then authors introduced a diffusion coefficient depending on the pixel position and the corresponding magnitude and the gradient direction. This diffusion coefficient is considered as a tuning parameter that governs the diffusion. It is chosen so that it permits diffusion in homogenous areas but not between boundaries.
To develop an efficient algorithm for automatic defect detection in radiographic films and since weld defect can be of very small sizes in the ROI, it is important to take the image at the highest possible contrast. In the sequel, we shall present an anisotropic diffusion scheme for a contrast enhancement.
Anisotropic diffusion was proposed by Perona and Malik  for scale-space description of images and edge detection. Anisotropic diffusion removes noise from an image by modifying the image via a partial differential equation. Perona-Malik introduced the following diffusion rule:
where I t (x, y) is the gray level at coordinates (x, y) of a digital image at the iteration t, div is the divergence operator, and ∇I t (x, y) is the gradient of the image. c t (x, y) is the diffusion coefficient considered as a function of the gradient in the PMAD model, i.e.,
g is a non-negative monotonically decreasing function verifying:
This anisotropic diffusion rule can discretely be implemented by using four nearest-neighbors and the Laplacian operator :
where ; i = 1...4, represents the gradient of four neighbors in the north, south, east, and west directions, respectively:
It looks like an adaptive diffusion procedure, the PMAD behavior is a function of the local variations of the intensity of the image. Thanks to the function c t (x, y) it allows a large-smoothing in the zones of low gradient, and a weak-smoothing in the zones of large gradient (contour). Hence, a thresholding coefficient K allows to distinguish between the zones with large gradient values and those with weak gradient ones.
Perona-Malik  proposed for example the following exponential functions (known as edge stopping function):
The inverse proportion edge stopping function in Equation (10) removes the noise in the large area efficiently, because its diffusion is the inverse function of the image gradient. But unfortunately, this function cannot preserve edge information. The exponent edge stopping function in Equation (11) allows to overcome this matter. With the finite difference scheme and the central differencing in spatial domain, the 2D anisotropic diffusion rule can be then expressed as:
where 0 ≤ λ ≤ 0.25 governs the rate of the diffusion and N, S, E, W are the mnemonic subscripts for north, south, east, and west, respectively, and
The choice of the threshold K is somewhat difficult; it can be fixed arbitrarily or by estimating the noise. For this purpose, the authors in  proposed to choose it using the cumulated histogram of the gradient. Generally speaking, if K is big, the preservation of the edge will be better; however, the noise will not be sufficiently removed; but if K is small, the noise will be well removed, but the edges of the image will be blurred.
Let be the flux function as defined in :
For a given value of K, it is shown from Figure 5a that the curve of the diffusion coefficient function in Equation (10) decreases intensively and becomes near zero when the gradient magnitude is greater than 4K. Therefore, the diffusion stops when . The maximum smoothness occurs at , as can be seen in the corresponding flux function in Figure 5b. The classical model of PMAD can actually smooth intra-regions in the image.
Consequently, in a low contrast image, the PMAD model can smooth the background but it cannot clearly enhance the defects.
Therefore, the result of diffusion still a low contrast image and defects will not be reliably identified in the diffused image.
The algorithm of the PMAD model is given in Table 1.
Some simulation results of the PMAD applied to images of weld are given in Figures 6 and 7. Indeed Figures 6a1, a2 and 7a1, a2 represent four radiographic images of weld with internal undercut, external undercut, lack of fusion, and lack of penetration defects, respectively. Figures 6b1, b2 and 7b1, b2 show the restoration results of the diffusing process using PMAD model with a parameter K = 2, and Figures 6c1, c2 and 7c1, c2 represent the result of the binarization of these images with the Otsu method .
From these results one can see clearly that this first method fails to detect weld defects. This means that the traditional PMAD model cannot enhance sufficiently anomalies by smoothing low-gradient regions and preserving high-gradient edges. Some improvements of these results will be found with the Shin-Du model.
4.2. Shin-Du model
This model was proposed by Shin-Min Chao and Tsai , it incorporated a sharpening strategy in the classical diffusion model in order to enhance the anomalies effectively in defected surfaces.
The Shin-Du model is then expressed as:
where the third term on the right-hand side is the sharpening operator. The sharpening diffusion coefficient function has in order to ensure non-negative monotonically increasing function with
The function maintains a high coefficient values at image edge having large magnitudes and low coefficient values. The considered image edge should belong to an image region showing low gradient magnitudes. This is defined as:
where α is the weight of sharpening coefficient function, and 0 ≤ α ≤ 1. It governs the degree of sharpness process.
Table 2 gives the algorithm of the different steps of this method.
Figure 8a, b represents the diffusion coefficient function g(∇I)-v(∇I) and the flux function φ(∇I) = [g(∇I)-v(∇I)]· ∇I for the model proposed by Shin-Du, respectively. For a given α and K, it can be seen in Figure 8a that the diffusion coefficient function decreases dramatically and crosses zero when the gradient magnitude |∇I | is bigger than .
The flux function in Figure 8b shows that the flow increases with the gradient strength to reach a maximum. And then it decreases and crosses zero to reach negative values. This behavior shows that the diffusion process performs smoothing for lower gradient area (when ) and proceeds sharpening for higher gradient area (when ).
For defect detection in a low-contrast glass substrates image , the model can effectively enhance defects in the diffused image. But, as shown in Figures 6d1, d2, 7d1, d2 and 6e1, e2, 7e1, e2, the Shin-Du improves the weld defect detection but it does not show drastic results for the localization of these defects.
4.3. Choice of the parameters α and K
Since the parameters α and K should be fixed beforehand for a particular application, the experiments are conducted to find appropriate values of K and α for the detection of defects in the radiographic images. When α is too large, anomalies cannot be enhanced in the resulting diffusion image. In contrast, when α is too small the diffusion results show that the proposed diffusion model will over sharpen the image.
When K is too large, the resulting images are severely smoothed. Not only the background area is smoothed, but also the default form is lost. When K is too small and α is too large, the diffusion process cannot reduce noise. These results fail the inspection of defects in radiographic images.
5. The proposed modified anisotropic diffusion model
From Figure 1, it is clear that the gray levels of defects and faultless backgrounds are painfully distinguishable and really merged together.
In , the authors used a sigmoidal function to produce different degrees of edge sharpening. Then a weighting function was used for the experimental implementation given by
σ(x) is a sigmoidal function whose values are for x = 0, and clumbs to a value of 1 with increasing x, and where the r > 0 is a free parameter that controls the steepness of σ(x), i.e., the strength of edge sharpening.
For solving the later cited problem, and preserving the same context of using a sigmoidal function, we intend to modify the diffusion function to reach the joint goal namely good gray level and good sharp edge of the fault. Then a new anisotropic diffusion model based on a new stopping edge function is proposed.
In these new models two main modifications on the Shin's one are proposed.
First, a filtering procedure is applied to the image gradient as follows:(21)
Second, a sharpening function is added to the edge stopping rule. Then the new proposed formula is given by Equation (22)(22)
For given α, K, and a, it can be seen that the diffusion coefficient function increases to a maximum and then decreases dramatically and crosses zero to achieve a minimum (when the gradient magnitude |∇I | is bigger than 0).
Table 3 shows the different steps of the proposed model. Figures 6a1, a2 and 7a1, a2 represent four radiographic images of weld with internal undercut, external undercut, lack of fusion, and lack of penetration defects, respectively. Figures 6f1, f2 and 7f1, f2 show the restoration results of the diffusing process using the proposed model with a parameter K = 3 and α = 0.5.
One can note from Figures 6f1, f2 and 7f1, f2 that defects become visible in the diffused image. This indicates that the proposed model can sufficiently enhance hardly visible anomalies by simply smoothing low-gradient regions and preserving high-gradient edges.
To show furthermore the effectiveness of the proposed method, experiments have been carried on many radiographic images with defects. The algorithms are implemented on a personal computer. Images were 256 × 256 pixels wide with 8-bit grayscale. The values of parameters α and K were set at fixed values of 0.5 and 3, respectively. The number of iterations is 20 for all test images. Figures 6a1, a2 and 7a1, a2 represent the original images of welded joints, Figures 6f1, f2 and 7f1, f2 represent the diffusion results and Figures 6g1, g2 and 7g1, g2 illustrate the simple thresholding  results of the filtered images.
Figures 11, 12, 13, and 14 show different 2D intensity profiles taken from the regions where the possible defects are suspected. For each curve we give the mean and the standard deviation. From these plots and by inspecting the standard deviation values one can clearly see that the new method allows to enhance and to sharpen different details of the weld defects without affecting the background or the neighboring regions.
In this article, the anisotropic diffusion scheme for defect detection in the TFT-LCD screens is extended to the defect detection in radiographic images. These later are used in the inspection of welds in the pipelines. Until now and in several industrial applications radiographic film analysis are done exclusively by the radiograph inspector who is required to visually inspect each film and detect the presence of possible defects. Consequently the automatization of such a procedure becomes necessary. The new proposed method allows to automatically detect the possible defects through enhancing and sharpening the radiographic images. The multiple simulations carried out show good performance of the proposed detection scheme. Plots of multiple 2D intensity profiles taken from the areas containing the defects show that the new method highlights the defect details and allows efficient distinctions between the faultless background and the defect details.
Nacereddine N, Zelmat M, Belaifa SS, Tridi M: Weld defect detection in industrial radiography based digital image processing. Proceeding of World Academy of Science, Engineering and Technology 2005., 2: ISSN 1307-6884
Sofia M, Redouane D: Shapes recognition system applied to the non-destructive testing. Proceeding of the 8th European Conference on Non-Destructive Testing (ECNDT 2002), Barcelona 2002.
Liao TW: Classification of welding flaw types with fuzzy expert systems. Expert Syst Appl 2003, 25(1):101-111. 10.1016/S0957-4174(03)00010-1
Mery D, Berti MA: Automatic flaw detection in aluminum castings based on the tracking of potential defects in a radioscopic image sequence. IEEE Trans Robot Autom 2002, 18(6):890-901. 10.1109/TRA.2002.805646
Wang G, Liao W: Automatic identification of different types of welding defects in radiographic images. NDT&E Int 2002, 35: 519-528. 10.1016/S0963-8695(02)00025-7
Silva RR, Siqueira MHS, Caloba LP, Dasilva IC, Decarvalho AA, Rebello JMA: Contribution to the development of radiographic inspection automated system. Proceeding of the 8th European Conference on Non-Destructive Testing (ECNDT 2002), Barcelona 2002.
Liao TW, Li YM: An automated radiographic NDT system for weld inspection. Part I Weld extraction NDT& E Int 1996, 29(3):157-162.
Perona P, Malik J: Scale-space and edge detection using anisotropic diffusion. IEEE Trans Pattern Anal Mach Intell 1990, 12: 629-639. 10.1109/34.56205
Alvarez L, Lions PL, Morel JM: Image selective smoothing and edge detection by nonlinear diffusion (II). SIAM J Numer Anal 1992, 29: 845-866. 10.1137/0729052
Sapiro G, Ringach DL: Anisotropic diffusion of multivalued images with applications to color filtering. IEEE Trans Image Process 1996, 5: 1582-1586. 10.1109/83.541429
Torkamani-Azar F, Tait KE: Image recovery using the anisotropic diffusion equation. IEEE Trans Image Process 1996, 5: 1573-1578. 10.1109/83.541427
Niessen WJ, Vincken KL, Weickert JA, Viergever MA: Nonlinear multiscale representations for image segmentation. Comput Vis Image Understand 1997, 66: 233-245. 10.1006/cviu.1997.0614
Deng H, Liu J: Unsupervised segmentation of textured images using anisotropic diffusion with annealing function. International Symposium on Multimedia Information Processing 2000, 62-67.
Chao SM, Tsai DM: An anisotropic diffusion-based defect detection for low-contrast glass substrates. Image Vis Comput 2008, 26: 187-200. 10.1016/j.imavis.2007.03.003
Quinn RA, Sigl CC: Radiography in Modern Industry. Eastman Kodak Company 4th edition. 1980.
Watanabe PCA, Issa JPM, Pardini LC, Monteiro SAC, Catirse ABCEB: A singular method to compare dental radiographic films used to study maxillofacial structures. Int J Morphol 2007, 25(3):573-578.
Gonzalez S, Woods RE: Digital Image Processing. Addison-Wesley; 2007.
Baxes GA: Digital Image Processing. Principles & Applications Wiley & Sons; 1994.
Haralick RM, Shapiro LG: Computer and Robot Vision. Volume 1. Addison-Wesley; 1992.
Yin L, Yang R, Gabbouj M, Neuvo Y: Weighted median filters: a tutorial. IEEE Trans Circ Syst 43(3):157-192.
Liao TW, Li YM: An automated radiographic NDT system for weld inspection. Part II. Flaw detection NDT&E Int 1998, 31(3):183-192.
Otsu N: A threshold selection method for gray level histograms. IEEE Trans Syst Man Cybern 1979, 9(1):62-66.
Jensen K, Anastassiou D: Subpixel edge localization and the interpolation of still images. IEEE Trans Image Process 1995, 4(3):285-295. 10.1109/83.366477
Sezgin M, Sankur B: Comparison of thresholding methods for non-destructive testing applications. IEEE Conference on Image Processing, Grèce 2001.
The authors declare that they have no competing interests.
IM conceived of the new defect detection algorithm, and the test on real radiographic images. Wrote the first version of the paper. SA framed the entire of the work, approved the new proposed algorithm, participated in design of the study, the sequence alignment and the manuscript reduction. FF approved the new idea for defect detection, participated in the design of the paper, and its sequence alignment. All authors read and approved the final version of the manuscript.
Authors’ original submitted files for images
Below are the links to the authors’ original submitted files for images.
About this article
Cite this article
Ben Mhamed, I., Abid, S. & Fnaiech, F. Weld defect detection using a modified anisotropic diffusion model. EURASIP J. Adv. Signal Process. 2012, 46 (2012). https://doi.org/10.1186/1687-6180-2012-46
- anisotropic diffusion
- defect detection
- radiographic images
- contrast enhancement
- image sharpening