Flaw detection in radiographic weldment images using morphological watershed segmentation technique

Flaw detection in radiographic weldment images using morphological watershed segmentation technique

ARTICLE IN PRESS NDT&E International 42 (2009) 2– 8 Contents lists available at ScienceDirect NDT&E International journal homepage: www.elsevier.com...

872KB Sizes 3 Downloads 40 Views

ARTICLE IN PRESS NDT&E International 42 (2009) 2– 8

Contents lists available at ScienceDirect

NDT&E International journal homepage: www.elsevier.com/locate/ndteint

Flaw detection in radiographic weldment images using morphological watershed segmentation technique Alaknanda a,, R.S. Anand a, Pradeep Kumar b a b

Department of Electrical Engineering, Indian Institute of Technology, Roorkee, Roorkee 247 667, India Department of Mechanical and Industrial Engineering, Indian Institute of Technology, Roorkee, Roorkee 247 667, India

a r t i c l e in f o

a b s t r a c t

Article history: Received 9 May 2007 Received in revised form 23 January 2008 Accepted 17 June 2008 Available online 20 June 2008

In this paper, the concept of application of morphological multistage watershed segmentation for detection of flaws in radiographic weld images is discussed. It is simple and intuitive and always produces a complete division of the image. The multistage watershed segmentation used here reduces the problem of over segmentation besides generating boundaries with very less deviation from their original position. Two-stage water segmentation is implemented here. At the first stage, watershed transform is applied to an X-ray image and the resultant mosaic image pattern is further thresholded by Otsu’s thresholding method and converted into the binary image. Then, morphology and top-hat transformation is applied on binary image to separate partially overlapping objects. Euclidean distance map is calculated for each basin to label resultant segments uniquely and to separate ridges. This follows the second stage of watershed segmentation to obtain better-defined boundaries while removing over-segmented regions. Watershed segmentation algorithm has been able to detect flaws like slag inclusions and wormholes-type weld flaws. It shows all defects with reasonable accuracy having close contours. Similarly, small cavities are also highlighted successfully. & 2008 Elsevier Ltd. All rights reserved.

Keywords: Radiographic images Flaw detection Multistage watershed segmentation Catchment basin

Contents 1. 2. 3. 4.

5. 6.

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Watershed transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Watershed segmentation algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Implementation steps of multistage watershed segmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.1. Filtered and gradient image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.2. Initial watershed and mosaic transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.3. Region merging post-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.4. Region-merging criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Results and discussion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1. Introduction Radiography is one of the most widely used non-destructive testing (NDT) methods in industry. The quality of X-ray image generated due to its travel through the object under test is

 Corresponding author.

E-mail addresses: [email protected] ( Alaknanda), [email protected] (R.S. Anand). 0963-8695/$ - see front matter & 2008 Elsevier Ltd. All rights reserved. doi:10.1016/j.ndteint.2008.06.005

affected by inhomogeneity of the material. This introduces noise in the image and makes some information imperceptible for human eyes. This information can be made visible by applying image processing techniques to it and further processing of these images helps in obtaining the desired information. Digital image processing techniques open the opportunity to accelerate the image analysis process, which may ease the operator from a lot of tedious task. Feature extraction resulting by implementation of digital image processing provides geometric parameters of an image which are useful in ensuring better design

ARTICLE IN PRESS Alaknanda et al. / NDT&E International 42 (2009) 2–8

and inspection in improving the product reliability, to assess serviceability of the product, prevention of accidents, the reduction of time for quality control and inspection, detecting, locating, identifying, measuring defects in composites, size structures and the nature of the flaw. First step in the processing of radiographic images is the preprocessing that is implemented to reduce noise, which otherwise would adversely affect the feature detection stage in weldment X-ray images. The background shading correction is also needed as it varies abruptly in the object. These two steps have been implemented here using suitable filtering such as median filtering and histogram equalization. The feature extraction, which is the next step, is a pixel identification process based on their gray value or texture in a digitized image. The pixels that form lines or region in an image are identified first and then are used for shaping an object by forming suitable boundary. For detecting flaws like slag inclusion, incomplete penetration, transverse cracks, lack of root penetration, undercuts and gas cavities the edge-based segmentation and region-growing segmentation were used on the weld images, but few flaws like wormhole type, gas cavities, lack of fusion, slag inclusion and slag line were not determined successfully. The suitability of another image-segmentation technique like watershed-transform technique to detect these above mentioned flaws was aimed in the present work and reported in this paper. The single watershed segmentation generates over-segmentation as many small catchment basins are formed due to multiple local minima in input image and thus no accurate boundaries are detected. The algorithm implemented in this work, i.e. multistage watershed algorithm eliminates the problem of over-segmentation as well as gives good results in context to determination of shape and size of the flaw. Almost accurate delineation of shape is achieved. Other problems generated by normal watershed algorithm like poor detection of thin structures, poor detection of significant areas with low-contrast boundaries and sensitivity to noise are also solved well by implemented multistage watershed transformation in this work. The multistage watershed algorithm performs the task of segmenting the image to form the region boundaries. The objects with defined boundaries can be considered as flaws whose type and geometric parameters such as area, perimeter and orientation are determined next. The defects like lack of penetration, lack of fusion, gas cavities, porosities and wormholes are easily detected by this approach. A detailed description of the concept of watershed transform is presented in Section 2. The watershed segmentation segmented algorithm is discussed in Section 3, while Section 4 describes the procedural steps of implementation of multistage watershed algorithm. Results and related discussions are presented in Section 5 followed by the conclusions described in Section 6.

2. Watershed transform Watershed transform is one of the methods based on regionbased segmentation. The watershed transform comes from the field of mathematical morphology. Watershed transform has interesting properties that make it useful for many different image-segmentation applications. It is a simple and intuitive and always produces a complete division of the image [1–4]. The segmentation by watersheds embodies many of the concepts of the approaches like shareholding, detection of discontinuities and region processing and it produces more stable segmentation results including continuous segmentation boundaries. Watershed transformation is built by implementation of flooding process on a gray-tone image [5].

3

The basic concept of watershed is based on visualizing an image in three dimensions i.e. two spatial coordinates versus gray levels. In such a topographic interpretation, three types of points are considered, such as, (a) points belonging to a regional minimum, (b) points at which a drop of water, if placed at the location of any of those points, would fall with certainty to a single minimum; and (c) points at which water would be equally likely to fall to more than one such minimum. For a particular regional minimum, the set of points satisfying condition (b) are called catchment basin or watershed of that minimum. The points satisfying condition (c) form crest line on the topographic surface and are termed as watershed lines or divide lines. The principal objective of segmentation algorithms based on these concepts is to find the watershed lines. The punching holes at each regional minimum and entire topography is flooded from below by letting water rise through the hole uniformly when rising water in distinct catchment basin is about to merge a dam is built to prevent the merging. The flooding will eventually reach a stage when only the tops of dams are visible above the water line. The dam boundaries correspond to the divide lines of the watersheds. Therefore, they are continuous boundaries extracted by a watershed segmentation algorithm. Watershed segmentation algorithm is applied to the gradient of an image rather than to the image itself. This is based on the concept that regions characterized by small variations in gray levels have small gradient values. In the formulation of watershed segmentation, the regional minima of catchment basins correlate nicely with the small value of the gradient corresponding to the objects of interest. The classical idea of building the watershed is illustrated in Fig. 1. As shown in Fig. 1(a(i)) a hole is pinched at the basin’s minima point and then water is filled through that holes as shown in Fig. 1(a(ii)),which rises uniformly. It keeps flooding till its level reaches at dividing lines as shown in Fig. 1(a(iv)), when only the top edges of dam are visible above the water line. Dam is shown in Fig. 1(b). The boundaries which are obtained as the dam boundaries are watersheds and that is why watersheds formed are close counters.

3. Watershed segmentation algorithms Let the region minima points of a gradient image are denoted by set of coordinates (p0, p1,yy, pl1, pl) of an image f (x, y). Let A(pi) be a set denoting the coordinates of point in catchment basin for which the regional minima is pi. The notation min and max will be used to denote the minimum and maximum values of f(x, y). For a gray-scale image the set of integers from 0 to 255 is taken. The plateau or flat zone of gray value n is a level component of the image [6], i.e. a connected component of pixels of constant gray value n. The threshold set of f(x, y) at level n: T½n ¼ fðs; tÞ=f ðs; tÞong

(1)

T[n] is representing the set of coordinates of points in f(x, y) lying below the plane f(x, y) ¼ n. The topography will be flooded in integer flood increments, from n ¼ min+1 to n ¼ max+1. At any step n of the flooding process, the algorithm needs to know the number of points below the flood depth. If the coordinates of threshold set T[n] are below the plane f(x, y) ¼ n then they are marked as black and all other coordinates are made white. Now, on looking down in x– y plane at any increment n of flooding, a binary image is observed having the points below f(x, y) ¼ n as black and point above it as white.

ARTICLE IN PRESS 4

Alaknanda et al. / NDT&E International 42 (2009) 2–8

Dividing Lines

Dividing Lines watersheds water lines

Dam Basins (i)

Basins (ii)

Dividing Lines

Dividing Lines Catchment Basin

Basins (iii)

Minima

Basins (iv)

Fig. 1. Basic concept of watershed segmentation: (a) immersion algorithm and (b) water lines and flooding concept.

Let An(pi) denote the set of coordinates of point in the catchments basin associated with minimum pi which are flooded at stage n. In above context, now An(pi) can be viewed as a binary image given by An ðpi Þ ¼ Aðpi Þ \ T½n

(2)

which means An(pi) ¼ 1 at location (x, y) if (x, y)AA(pi) AND (x, y)ATn, Otherwise An(pi) ¼ 0. AND operation is used to isolate the flooding portion, at n stage of the binary image in Tn, associated with regional minimum pi. Let A[n] denote the union of flooded catchments basins portion at stage ‘n’ A½n ¼

R [

An ðpi Þ

(3)

i¼1

then, A[max+1] is the union of all catchments basins A½max þ 1 ¼

R [

Aðpi Þ

(4)

i¼1

As it can be observed here, the elements in both An(pi) and T[n] are never replaced during execution of the algorithm, and the number of elements in these two sets either increases or remains the same as n increases. Thus, it follows that A[n1] is a subset of A[n]. A[n] is a subset of T[n]. As per Eqs. (2) and (3), A[n] is a subset of T[n]. Thus, it follows that A[n1] is a subset of T[n]. This gives an important result that each connected component of A[n1] is contained in exactly one connected component of T[n]. The algorithm for finding the watershed lines is initialized with A[min+1] ¼ T[min+1]. The algorithm then proceeds recursively, assuming at step n that A[n1] has been constructed. A procedure for obtaining A[n] from A[n1] is as follows: Let Q denote the set of connected components in T[n]. Then, for each connected component qAQ[n] there are three possibilities (a) q\A[n1] is empty. (b) q\A[n1] contains one connected component of A[n1]. (c) q\A[n1] contains more than one connected of A[n1]. Construction of A[n] from A[n1] depends on which of these three conditions is satisfied. Condition (a) occurs when a new minimum is encountered, in which case connected component q is incorporated into A[n1] to from A[n].

Condition (b) occurs when q lies within the catchments basin of some regional minimum, in which case q is incorporated into A[n1] to form A[n]. Condition (c) occurs when all or part of a ridge separating two or more catchment basins is encountered. Further flooding would cause the water level in these catchments basins to merge. Thus, a dam (or dams if more than two catchments basins are involved) must be built within q to prevent the overflow between the catchment basin. Now, a onepixel-thick dam is constructed when needed by dilating q\A[n1] with a 3  3 structuring element of 1’s and constraining the dilation to q. Algorithm efficiency is improved by using only those values of n that correspond to existing gray-level values in f(x, y). These values, as well as the values of min and max can be determined from the histogram of f(x, y).

4. Implementation steps of multistage watershed segmentation A multistage watershed transform has been used here to take care of the over segmentation. The systematic block diagram of the proposed method is shown in Fig. 2. The detailed description of block diagram is presented below: 4.1. Filtered and gradient image A pre-processed weld image is used in watershed transformation. Filtering is used for pre-processing to reduce the noise level efficiently with the help of MATLAB. The pre-processed smoothed image is used for gradient calculation. Any one of the gradient operators like Sobel, Prewitt or Gaussian derivative is used in this segmentation. Since the noise level is efficiently reduced by filtering, these operators perform well on filtered images. 4.2. Initial watershed and mosaic transformation The above obtained gradient image is partitioned into primitive regions using image-gradient magnitude. The edgebased segmentation is obtained by using intensity gradient and then, by grouping these edges in order to form contour/surfaces. Edge detection is based on gradient processing. The image pixels are labeled as edge or non-edge [7]. However, there is always a

ARTICLE IN PRESS Alaknanda et al. / NDT&E International 42 (2009) 2–8

Filtered image

5

Binary Opening

Gradient Image Second watershed Initial Watershed Identification of OverSegmented Regions

Boundary Extraction of the Merged Regions

Mosaic Transformation

Binary Image

Iterative Region Merging to remove over segmentation

Final Segmented Image

Fig. 2. The proposed multi-stage watershed segmentation approach.

Fig. 3. Filtered and gradient X-ray weldment image showing wormhole-type gas cavities.

Fig. 4. Initial watershed-transformed mosaic image of gradient image of Fig. 3.

Fig. 5. Binary image of Fig. 4.

possibility of either accepting a non-edge as an edge or rejecting an edge as non-edge, since the labeling decision is local for each pixel. The first type of error corresponds to the detection of false edges, while the second results in breaking of contour into small edge groups separated by small gaps. This type of error does not allow contour formation for higher-level analysis. These problems are solved by using morphological watershed transformation to the gradient image. Initial watershed transformation gives many small homogeneous regions that result in oversegmentation or undesired small regions in homogeneous regions.

The fragmented regions can be merged after applying watershed transform again. The boundaries produced by the segmentation at this stage do not have same brightness (gray level). Those, which are inside the homogeneous region, are weaker. In order to compare these boundaries, the neighborhood relation between them is used, which is built on the basis of connectivity graph from partitioned or mosaic image. It can be 4-neighbors (adjacent) or 8-neighbor (adjacent) connectivity [8]. The mosaic image is compared by assigning the average of pixel to each corresponding region, resulting from watershed image. The mosaic-image pattern is further thresholded by Otsu’s

ARTICLE IN PRESS 6

Alaknanda et al. / NDT&E International 42 (2009) 2–8

Fig. 6. Opening of image in Fig. 5 (removal of extraneous region).

Fig. 7. Second watershed segmentation to obtain better result of flaw.

Fig. 8. Boundary extraction of the merged region of second watershed segmentation of Fig. 3.

thresholding method [9] and converted into the binary image. The mosaic image of original image having wormhole-type flaws (Fig. 3) is shown in Fig. 4, while binary-thresholded image is shown in Fig. 5. The binary image morphology and top-hat transformation is used to find the bright objects. It finds peaks in the image function that differ from local background. In this process, shape of the structuring element plays an important role, while gray-level shape of peak does not play any role. Watershed segmentation takes account of sources of information and supersedes the tophat method [10]. Watershed can also separate partially overlapping objects. First of all, with the help of morphological opening by reconstruction—small objects are removed. The separation of small objects is followed by removal of sporadic variations along the object edge. The result of opening is shown in Fig. 6. The Euclidean distance map (EDM) of the resulting image is calculated. The brightness of each pixel in EDM of binary image codes its distance to the nearest boundary. To accomplish binary image segmentation, watershed immersion algorithm is applied to the inverse EDM. At the location of overlap in the binary image, the inverse EDM has a ridge where the two catchment basins of each overlapping objects meet. Therefore, each basin and ridge separating them is labeled uniquely as watershed. The watershed of EDM is shown in Fig. 7. The resulting watershed-labeled image is marked by the binary morphological eroded image to match the object and background boundaries and to overcome false separation of the overlapping regions. The marked image gives the region shape with the clue of false separation boundaries. From this resulting image, the region properties are calculated for designing estimation criteria of region merging post-processing.

4.3. Region merging post-processing Region merging post-processing is used to compensate oversegmentation problem. The small regions are merged in a homogeneous region since they have some homogeneous intensity characteristics. The region-growing segmentation is used. The labeled image is used for region merging. Watershed transformation algorithm converts the original image into a labeled image. Each label represents different region. Two important aspects used together [11], for region merging of different regions are: (i) regions are adjacent or not, (ii) how similar/dissimilar regions are with each other. Neighboring regions having homogeneity are merged according to certain decision rule, considering feature space and spatial relationship between pixels. 4.4. Region-merging criteria For the region merging following criteria are used (i) If the edge strength along the boundary is greater than the threshold edge strength value, then split the regions. (ii) If the average gray level along the boundary between the two regions is below than the brightness threshold, then merge the regions. (iii) If the edge strength along the boundary is below than strength threshold, then merge the regions.

ARTICLE IN PRESS Alaknanda et al. / NDT&E International 42 (2009) 2–8

7

Fig. 9. Segmented image (Fig. 8) is superimposed on original image.

Fig. 10. Original X-ray image having gas cavity (wormhole)-type flaws: (a) original X-ray image, (b) segmented images and (c) superimposed on original image.

(iv) If region area is less than threshold areas, then eliminate the region. Finally, the boundary extraction is performed as shown in Fig. 8. A superimposed segmented image on original image is shown in Fig. 9.

5. Results and discussion Watershed segmentation has been applied on many X-ray images having various types of faults. The results and subsequent observations on few images are described below: Fig. 10(a) shows an X-ray image having gas cavity-type of flaws. Its segmented image (Fig. 10(b)) is superimposed on original image and is shown in Fig. 10(c). As it can be observed, here, all the gas cavities are seen clearly. In case of multiple flaws (shown in Fig. 11(a) (having slag line, incomplete penetration and

wormhole gas cavities-type defects), the segmented image highlights all the types of flaws. A comprehensive examination on the results obtained from multi-stage watershed segmentation shows that for slag inclusions, the watershed transform based segmented image shows flaws properly. All the flaws of such type are identified properly having close contours. Similarly, in case of wormholes, it shows all defects with reasonable accuracy having close contours. In case of big porosity-type gas cavities watershed does not perform well as flaws are not seen clearly while for small cavities it gives good results highlighting all the flaws. Segmentation in case of incomplete penetration is better in many cases, but in few cases results obtained are not satisfactory. Undercuts are not identified clearly by watershed segmentation. The results obtained for cracks found are also not very good. Here, the crack is identified but not very clearly. The lack of fusion is identified very clearly with all details shown properly. Similar is the results in the case of weaving faults.

ARTICLE IN PRESS 8

Alaknanda et al. / NDT&E International 42 (2009) 2–8

Fig. 11. X-ray image having slag line, incomplete penetration and wormhole gas cavities-type defects: (a) original X-ray image, (b) segmented images superimposed on original image and (c) segmented cropped image showing more detailed results.

Table 1 Results of various types of flaws detected by multi-stage watershed transformation S. Type of flaw no.

Comments

1 2

Slag inclusion Wormhole

3

Porosity

4 5 6

Incomplete penetration Under cuts Cracks

Flaws identified properly and clearly. Best suited Flaw identified with less distortion, shape and size properly given, best results Small pores clearly identified with proper boundaries, boundary of big pores not completely traceable Flaw information missing, over-segmentation

7

Lack of fusion

8

Weaving fault

9

Slag line

Flaws not properly identified, over-segmentation Cracks identified in few cases while not identified in few other cases Flaw completely detectable, best results, all details are present Flaw is identified clearly in most of the cases, more details available, best results Flaw identified clearly, best results

A summary of results obtained on various types of flaws is presented in Table 1.

6. Conclusions The single-stage watershed segmentation generates oversegmentation as many small basins are formed due to multiple local minima in input image and thus, no accurate boundaries are detected. The algorithm, implemented in this work, i.e. multiple watershed algorithms, eliminates the problem of over-segmentation as well as gives good results in context to determination of shape and size of the flaw. Almost accurate delineation of shape is achieved. The problems generated by normal watershed algorithm like poor detection of thin structures, poor detection of significant areas with low-contrast boundaries, sensitivity to

noise and over-segmentation are solved well by multi-stage watershed transformation developed and implemented in this work. A qualitative evaluation of the results obtained here has also been performed by comparing these with two other segmentation techniques viz. edge-based and region-growing method. It has been observed that each of these segmentation techniques have their own domain of application for detection of weld flaws. For example, edge-based technique is suitable for slag inclusion, incomplete penetration and transverse cracks, while regiongrowing approach provides best results for lack of root penetration, undercuts and gas cavities. Similarly, as it has been seen watershed technique is useful for flaws of wormhole type gas cavities, lack of fusion, slag inclusion and slag line. References [1] Bienick A, Moga A. An efficient watershed algorithm based on connected components. Pattern Recognition 2000;33(3):907–16. [2] Roerdink JBTM, Meijster A. The watershed transform: definitions, algorithms and parallelization. Fundam Informaticae 2000;41:187–228. [3] Serra J. Image analysis and mathematical morphology. New York: Academic Press; 1982. [4] Serra J. Image analysis and mathematical morphology, vol. II, theoretical advances. New York: Academic Press; 1986. [5] Vincent L, Soille P. Watersheds in digital spaces: an efficient algorithm based on immersion simulations. IEEE Trans Pattern Anal Mach Intell 1991;13(5):583–98. [6] Gorzalez RC, Wood RE. Digital image processing. 2nd ed. Pearson Education Asia; 2002. [7] Haris K, Efstratiadis S, Maglaveras N, Katsaggelos AK. Hybrid image segmentation using watersheds and fast region merging. IEEE Trans Image Process 1998;7(12):1684–99. [8] Ding J-J. The class of ‘‘time-frequency analysis and wavelet transform’’. In: Petrou M, Bosdogianni P, editors. Image processing the fundamentals. UK: Wiley; 2004 /en.wikipedia.org/wiki/Region_growingS. [9] Otsu N. A threshold selection method from gray-level histograms. IEEE Trans Syst Man Cybern 1979;9(1):62–6. [10] Sonka M, Lavac VH, Bolye R. Image processing, analysis and machine vision. 2nd ed. London and New York: Chapman & Hall; 2003. [11] Pavlidis T. Structural pattern recognition. Berlin, Heidelberg: Springer; 1977.