 Research
 Open Access
Weld defect detection using a modified anisotropic diffusion model
 Issam Ben Mhamed^{1}Email author,
 Sabeur Abid^{1} and
 Farhat Fnaiech^{1, 2}
https://doi.org/10.1186/16876180201246
© Ben Mhamed et al; licensee Springer. 2012
 Received: 10 April 2011
 Accepted: 27 February 2012
 Published: 27 February 2012
Abstract
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 officeschemical and industrial analysis laboratories: Saybolt Tunisia". The new automatic defect detection method shows good performance in comparison with other existing algorithms.
Keywords
 anisotropic diffusion
 defect detection
 radiographic images
 contrast enhancement
 image sharpening
1. Introduction
Until now and in several real industrial applications radiographic film analysis are done exclusively by the radiograph inspector, such as in the society "Control officeschemical and industrial analysis laboratories: SayboltTunisia". 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 [1], 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 knearest 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 [2]. 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 Xray 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 knearest neighbor classifier. According to the literature, the method is robust and achieves good detection rate.
In [6], a welding defect classification method is proposed. In a first step, called image preprocessing, 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 [7] 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 [4] 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 wellknown technique namely the anisotropic diffusion model used to the weld detection defects [8].
Anisotropic diffusion has widely been used as an adaptive edgepreserving smoothing technique for edge detection [9], image restoration [10], image smoothing [11], image segmentation [12], and texture segmentation [13]. In this study, we extend the work of ShinMin Chao and Tsai [14] used to defect detection in TFTLCD screen (Thin Film TransistorLiquid 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 officeschemical 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 PeronaMalik anisotropic diffusion rules and the improved diffusion model proposed by ShinDu [14] 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 nondestructive tests. It is based upon exposing the target area to the short wavelength. In the society SayboltTunisia the γ ray is used from the Iridium192. 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 Xray. To produce effective γ ray a small pellet of Iridium192 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 [15].
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 [16]:

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.
3. Preprocessing steps
3.1. Digitization
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 SayboltTunisia. 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 [17]. 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 lowpass 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.
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
Note that the technique of ROI localization is commonly used by researchers in several works, see [1, 2, 21].
In the following, we shall present the classical diffusion model followed by the new proposed anisotropic weld defect detection algorithm.
4. Study of the PeronaMalik anisotropic diffusion model (PMAD)
4.1. Fundamental scheme
In 1990, Perona and Malik [8] 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.
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 largesmoothing in the zones of low gradient, and a weaksmoothing 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.
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 [8] 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.
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 $\left\nabla I\right$ is greater than 4K. Therefore, the diffusion stops when $\left\nabla I\right>4K$. The maximum smoothness occurs at $\left\nabla I\right=1K$, as can be seen in the corresponding flux function in Figure 5b. The classical model of PMAD can actually smooth intraregions 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.
Algorithm of the PMAD model
Initialisation: Chose initial zone parameters: K, c_{ t }(x, y) 

Step1: Digitization 
Step2: Region of Interest Localisation 
Step3: Median filtering 
Step4: Compute the 2D convolution masks: hN, hS, hF and hW 
Step5: For i = 1 to number of image windows 
Compute the gradient 
Compute the diffusion function c_{1}(x, y) of 4 neighbors 
Compute ${I}_{t+1}\left(x,y\right)={I}_{t}\left(x,y\right)+\frac{1}{4}\sum _{i=1}^{4}\left[{c}_{t}^{i}\left(x,y\right).\nabla {I}_{t}^{i}\left(x,y\right)\right]$ End 
Step6: Thresholding 
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 lowgradient regions and preserving highgradient edges. Some improvements of these results will be found with the ShinDu model.
4.2. ShinDu model
This model was proposed by ShinMin Chao and Tsai [14], it incorporated a sharpening strategy in the classical diffusion model in order to enhance the anomalies effectively in defected surfaces.
where the third term on the righthand side is the sharpening operator. The sharpening diffusion coefficient function has $v\left(\nabla {I}_{t}^{i}\left(x,y\right)\right)$ in order to ensure nonnegative monotonically increasing function with $v\left(0\right)=0\phantom{\rule{0.3em}{0ex}}and\phantom{\rule{0.3em}{0ex}}\underset{\left\nabla {I}_{t}^{i}\right\to \infty}{\mathsf{\text{lim}}}v\left(\nabla {I}_{t}^{i}\right)=1$
where α is the weight of sharpening coefficient function, and 0 ≤ α ≤ 1. It governs the degree of sharpness process.
Algorithm of the ShinDu model
Initialisation 

Chose initial zone parameters: K, c_{1}(x, y) 
Step1: Digitization 
Step2: Region of Interest selection 
Step3: Median filtering 
Step4: Compute the 2D convolution masks: hN, hS, hF and hW 
Step5: For i = 1 to number of image windows 
 Compute the gradient 
 Compute the diffusion function c_{1}(x, y) of 4 neighbors 
 Compute the sharpening diffusion coefficient 
$v\left(\nabla {I}_{i}^{t}\left(x,y\right)\right)$ 
 Compute 
$\begin{array}{c}{I}_{t+1}\left(x,y\right)={I}_{t}\left(x,y\right)+\frac{1}{4}\sum _{i=1}^{4}\left[{c}_{t}^{i}\cdot \nabla {I}_{t}^{i}\left(x,y\right)\right]\phantom{\rule{0.3em}{0ex}}\\ \frac{1}{4}\sum _{i=1}^{4}\left[{v}_{t}^{i}\left(x,y\right)\cdot \nabla {I}_{t}^{i}\left(x,y\right)\right]\end{array}$ 
End 
Step6: Thresholding 
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 $\left\nabla I\right<K/\sqrt{\alpha}$) and proceeds sharpening for higher gradient area (when $\left\nabla I\right>K/\sqrt{\alpha}$).
For defect detection in a lowcontrast glass substrates image [17], 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 ShinDu 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.
σ(x) is a sigmoidal function whose values are $\frac{1}{2}$ 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.

First, a filtering procedure is applied to the image gradient as follows:${\nabla}^{*}{I}_{t}^{i}\left(x,y\right)=\mathsf{\text{MEDIAN}}\left(\nabla {I}_{t}^{i}\left(x,y\right)\right)$(21)

Second, a sharpening function is added to the edge stopping rule. Then the new proposed formula is given by Equation (22)$g\left({\nabla}^{*}{I}_{t}^{i}\right)=\left[\frac{1}{\left[1+{\left({\nabla}^{*}{I}_{t}^{i}/K\right)}^{2}\right]}\cdot \left(\frac{1}{\left[1+\mathsf{\text{exp}}\left(a*\left({\nabla}^{*}{I}_{t}^{i}/K\right)\right)\right]}\right)\right]$(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).
Algorithm of the proposed model
Initialisation 

Chose initial zone parameters: K, c_{1}(x, y) 
Step1: Digitization 
Step2: Region of Interest selection 
Step3: Median filtering 
Step4: Compute the 2D convolution masks: hN, hS, hF and hW 
Step5: For i = 1 to number of image windows 
 Compute the gradient 
 Compute the diffusion function c_{1}(x, y) of 4 neighbors 
 compute the 
${\nabla}^{*}{I}_{t}^{i}\left(x,y\right)=median\left(\nabla {I}_{t}^{i}\left(x,y\right)\right)$ 
 Compute the sharpening diffusion coefficient 
$v\left({\nabla}^{*}{I}_{t}^{i}\left(x,y\right)\right)$ 
 Compute 
$\begin{array}{c}{I}_{t+1}\left(x,y\right)={I}_{t}\left(x,y\right)+\frac{1}{4}\sum _{i=1}^{4}\left[{c}_{t}^{i}\cdot \nabla {I}_{t}^{i}\left(x,y\right)\right]\phantom{\rule{0.3em}{0ex}}\\ \frac{1}{4}\sum _{i=1}^{4}\left[{v}_{t}^{i}\left(x,y\right)\cdot \nabla {I}_{t}^{i}\left(x,y\right)\right]\end{array}$ 
End 
Step6: Thresholding 
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 lowgradient regions and preserving highgradient 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 8bit 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 [24] results of the filtered images.
6. conclusion
In this article, the anisotropic diffusion scheme for defect detection in the TFTLCD 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.
Declarations
Authors’ Affiliations
References
 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 13076884Google Scholar
 Sofia M, Redouane D: Shapes recognition system applied to the nondestructive testing. Proceeding of the 8th European Conference on NonDestructive Testing (ECNDT 2002), Barcelona 2002.Google Scholar
 Liao TW: Classification of welding flaw types with fuzzy expert systems. Expert Syst Appl 2003, 25(1):101111. 10.1016/S09574174(03)000101View ArticleGoogle Scholar
 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):890901. 10.1109/TRA.2002.805646View ArticleGoogle Scholar
 Wang G, Liao W: Automatic identification of different types of welding defects in radiographic images. NDT&E Int 2002, 35: 519528. 10.1016/S09638695(02)000257View ArticleGoogle Scholar
 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 NonDestructive Testing (ECNDT 2002), Barcelona 2002.Google Scholar
 Liao TW, Li YM: An automated radiographic NDT system for weld inspection. Part I Weld extraction NDT& E Int 1996, 29(3):157162.MathSciNetGoogle Scholar
 Perona P, Malik J: Scalespace and edge detection using anisotropic diffusion. IEEE Trans Pattern Anal Mach Intell 1990, 12: 629639. 10.1109/34.56205View ArticleGoogle Scholar
 Alvarez L, Lions PL, Morel JM: Image selective smoothing and edge detection by nonlinear diffusion (II). SIAM J Numer Anal 1992, 29: 845866. 10.1137/0729052MathSciNetView ArticleGoogle Scholar
 Sapiro G, Ringach DL: Anisotropic diffusion of multivalued images with applications to color filtering. IEEE Trans Image Process 1996, 5: 15821586. 10.1109/83.541429View ArticleGoogle Scholar
 TorkamaniAzar F, Tait KE: Image recovery using the anisotropic diffusion equation. IEEE Trans Image Process 1996, 5: 15731578. 10.1109/83.541427View ArticleGoogle Scholar
 Niessen WJ, Vincken KL, Weickert JA, Viergever MA: Nonlinear multiscale representations for image segmentation. Comput Vis Image Understand 1997, 66: 233245. 10.1006/cviu.1997.0614View ArticleGoogle Scholar
 Deng H, Liu J: Unsupervised segmentation of textured images using anisotropic diffusion with annealing function. International Symposium on Multimedia Information Processing 2000, 6267.Google Scholar
 Chao SM, Tsai DM: An anisotropic diffusionbased defect detection for lowcontrast glass substrates. Image Vis Comput 2008, 26: 187200. 10.1016/j.imavis.2007.03.003View ArticleGoogle Scholar
 Quinn RA, Sigl CC: Radiography in Modern Industry. Eastman Kodak Company 4th edition. 1980.Google Scholar
 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):573578.View ArticleGoogle Scholar
 Gonzalez S, Woods RE: Digital Image Processing. AddisonWesley; 2007.Google Scholar
 Baxes GA: Digital Image Processing. Principles & Applications Wiley & Sons; 1994.Google Scholar
 Haralick RM, Shapiro LG: Computer and Robot Vision. Volume 1. AddisonWesley; 1992.Google Scholar
 Yin L, Yang R, Gabbouj M, Neuvo Y: Weighted median filters: a tutorial. IEEE Trans Circ Syst 43(3):157192.Google Scholar
 Liao TW, Li YM: An automated radiographic NDT system for weld inspection. Part II. Flaw detection NDT&E Int 1998, 31(3):183192.View ArticleGoogle Scholar
 Otsu N: A threshold selection method for gray level histograms. IEEE Trans Syst Man Cybern 1979, 9(1):6266.MathSciNetView ArticleGoogle Scholar
 Jensen K, Anastassiou D: Subpixel edge localization and the interpolation of still images. IEEE Trans Image Process 1995, 4(3):285295. 10.1109/83.366477View ArticleGoogle Scholar
 Sezgin M, Sankur B: Comparison of thresholding methods for nondestructive testing applications. IEEE Conference on Image Processing, Grèce 2001.Google Scholar
Copyright
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.