Open access peer-reviewed chapter

Image Segmentation

Written By

Kumaravel Subramaniam Tamilselvan and Govindasamy Murugesan

Submitted: 06 November 2017 Reviewed: 12 March 2018 Published: 04 July 2018

DOI: 10.5772/intechopen.76428

From the Edited Volume

Medical and Biological Image Analysis

Edited by Robert Koprowski

Chapter metrics overview

1,700 Chapter Downloads

View Full Metrics


Image segmentation is one of the important and useful techniques in medical image processing. As the image segmentation technique results robust and high degree of accuracy, it is very much useful for the analysis of different image modalities, such as computerized tomography (CT) and magnetic resonance imaging (MRI) in the medical field. CT imaging gives more importance than MRI because of its wider availability, inexpensive and sensitiveness. In most cases, CT offers information needed to make decisions during urgent situations.


  • computerized tomography
  • magnetic resonance imaging
  • watershed
  • wavelet transform
  • segmentation
  • neural network

1. Introduction

The main aim of image segmentation is to optimize the physician’s diagnosis by automatically detecting the suspicious patterns and classifying the abnormalities. In order to achieve this, several methods are employed. One of which is hybrid algorithm based on wavelet transform and watershed segmentation (WT-WS), used to isolate the tumor from different medical image modalities, especially from CT and MRI images. Various features like peak signal to noise ratio (PSNR), root mean square error (RMSE) and average difference (AD) can be measured to evaluate the efficiency of an algorithm.

This chapter elaborates the need for image segmentation, different types of segmentation, merits and demerits of each method and techniques to overcome the limitations of each method. Various categories of segmentation are clustering, edge detection and region extraction [1]. The main drawbacks with the conventional image segmentation techniques are over segmentation and high sensitivity to noise. To overcome these problems, image segmentation method based on the combination of wavelet transform and watershed segmentation algorithm can be employed. Over segmentation and noise problems are reduced by applying watershed technique to carry out the low pass filtered image from wavelet transform [2].

1.1. Need for image segmentation

Segmentation is an important stage of the image recognition system, because it extracts the objects of our interest, for further processing such as description or recognition. Segmentation of an image is in practice for the classification of image pixel [3]. Segmentation techniques are used to isolate the desired object from the image in order to perform analysis of the object. For example, a tumor, cancer or a block in the blood flow can be easily isolated from its background with the help of image segmentation technique [4]. Various techniques are available for the segmentation of monochrome images. The segmentation of color images is more complicated as each pixel in the color images is vector valued [5].

The existing image segmentation techniques have the limitations of over-segmentation and high sensitivity to noise. The earlier techniques frequently use the statistical methods to find those features in a complete brain MRI or CT images. Furthermore, the segmentation process takes more time for processing and some of the features are redundant and get overlapped [6]. The determination of features of the whole image is a difficult task too. Due to the presence of redundant and overlapped features, an accurate result cannot be obtained. These methods make use of both statistical and non-statistical features. For example, in the neural network-based segmentation, a neural network is first trained with statistical features and then trained with non-statistical features [7]. The two times training process of the neural network with different features gives the insignificant result [8]. Magnetic resonance imaging is an emerging field of research in medical imaging filed, which can be used to recognize the features of human brain. The main aim of research in this field is to identify and detect the abnormalities in human brain automatically [9].


2. Wavelet and watershed-based image segmentation method

The wavelet and watershed-based image segmentation method consists of three stages, namely image enhancement, image segmentation and feature extraction. In image enhancement step, the contrast level of the CT and MRI images are improved by employing wavelet-based filtering technique without distorting the sharp edges [10]. The contrast-enhanced images are then applied to watershed-based image segmentation technique. Performance measurement factors such as peak signal to noise ratio (PSNR), root mean square error (RMSE) and average difference (AD) are calculated in the feature extraction step. The extracted features are used to compare the segmentation efficiency of the present technique with other-segmentation techniques. The above mentioned image segmentation technique is illustrated in Figure 1.

Figure 1.

Block diagram wavelet transform and watershed-based image segmentation technique.

2.1. Image enhancement

Contrast enhancement of the medical image is the technique of smoothing the image and removal of noise in the image [11]. As the noise removal is affecting the segmentation efficiency, this step is important in the image segmentation process. All the medical images contain both smoothing and detailed information. The smoothing information can be easily filtered out by using a number of morphological filters.

2.2. Wavelet decomposition

Wavelet transform decomposes the MRI image into a multiresolution representation, which consists of the low frequency approximation information and the high frequency detailed information. Given an MRI image, the multiresolution representation is generated by successive filtering using quadrature mirror filter. The basic function of a wavelet is to decompose the given image into different subbands. This can be done by using either uniform or octave band decomposition as shown in Figure 2.

Figure 2.

Two level wavelet decomposition.

From Figure 2, it is shown that, wavelet transform decompose a given image into four sub-images.

The decomposed images are,

  • Low-Low(LL): Low frequency in both horizontal and vertical directions

  • Low-High(LH): Low frequency in horizontal and high frequency in vertical direction

  • High-Low(HL): High frequency horizontal direction and low frequency in vertical direction

  • High-High(HH): High frequency in both horizontal and vertical directions

To decompose an image, filter banks are used with low pass and high pass filters.

Figure 3 shows the decomposition of an image into four sub-images.

Figure 3.

Four sub bands of decomposition of image.

The LL sub-image is called the approximation image, while the LH, HL and HH are called the detailed images which are illustrated in Figure 3. Various image processing techniques can be applied to the sub band images for different solutions. Increasing the number of decomposition produces coarse contours that may hide some relevant features of the carotid artery walls.

2.3. Pyramidal representation

Pyramidal representation of an image tends to examine an image in multi resolution methods. Different types of decomposing an image are Gaussian Pyramids, Laplacian Pyramids and wavelets. Out of the above methods, Gaussian and Laplacian Pyramid give some loss of information. But the wavelet-based decomposition will overcome these drawbacks. Haar wavelet transform can be selected for this purpose.

2.4. Steps in the Wavelet-based image enhancement

Steps to be followed when using wavelet decomposition of an image:

  1. Separate the given image into LL, LH, HL and HH sub-images using a low pass filter at a scale of 2j

  2. Repeat the process of decomposition on the LL sub band until the number of sub bands is equal to 4.

  3. Find the J scale transforms, for the original image as represented by,


for j = 1, 2, …, J

where W2i, WH2i, WV2i and WD2i represents transform results LL, LH, HL and HH at 2j scale, respectively. This representation is composed of a coarse signal at resolution 2i and a set of detailed signal at resolution 2i-2j.

2.5. Watershed-based image segmentation

In the watershed-based image segmentation, the image is splitted into different areas. Normally watershed-based segmentation will lead to an over-segmentation of the image, especially for noisy image such as medical CT images. To avoid this oversegmentation, either the input image must be preprocessed or the different regions of the image must be merged based on similarity [12].

It is easy to understand the watershed technique by consider the image as a plain surface where high pixel values correspond to peaks and low pixel values correspond to valleys. Same as actual watersheds in irrigation, if a drop of water falls on any particular point of the contour, automatically it will flow to lower ground till it reaches a local minimum which is catchment basin and the collected points in a particular basin is called as a member of that watershed. Expressions (2) and (3) represent the watershed transform.

AS a first step, we have to calculate the local gradients within a particular image Let the original image is ‘I’ and ‘G’ is a low variance Gaussian Kernel. The blurred gradient ‘B’ can be represented as in the expression (2).


where I is defined such that


The next step is to find the local minima of B. An element m(i, j) is said to be a local minimum if mij<pi0j0i0j0Nij where N(i,j) represents spatial neighborhood of the element at row i and column j in eight connectivity. The local minima mi represent the catchment basins of the image and are each assigned with a unique label greater than zero. The final step is to follow each element in B toward its lowest valued neighbor until it merges into one of the catchment basins mi. Eqs. (4) and (5) give the watershed and an edge map equation respectively. Once an element merges with catchment basin mi, it assumes the label of that basin. The above function can be represented as WS. So the watershed W is defined as in the Eq. (4).


The resulting edge map E is defined in the expression (5).


where W (i,j) is the label of watershed in which element (i,j) is a member after all of the watersheds have been labeled.

2.6. Limitations of watershed transform-based image segmentation

Noise is a great challenge in the segmentation process of an image with watershed-based technique and over segmentation is another important drawback with watershed-based image segmentation. These drawbacks can be avoided by using region merging method. A combination of wavelet and watershed-based image segmentation method can also be used to address the above problems.

2.7. Steps of the watershed algorithm-based image segmentation

STEP 1:  Read the original image (I0).

STEP 2:  Take L level wavelet transform of image (IL).

STEP 3: Smooth the image and remove noise particles using wavelet denoising.

STEP 4:  Apply watershed segmentation.

STEP 5:  Resulting merged region image is projected onto the IL-1 layer by an Inverse wavelet transform.

STEP 6:  Go to step3 and repeat the above procedure until L equals 0 (initial stage).

Acquisition the source image: Get the MRI image, which is the source image for the segmentation process obtained from a clinic.

Contrast maximization: maximization of contrast of an image is adopted to identify and minimize number of valley points. Wavelet transform is preferred for contrast enhancement.

To maximize the contrast, first compute αn,s using the Eq. (6) and (7).

Let n be the decomposition level,


where s is the sub band which indicates LH, HL and HH. En,s is the average absolute value of a specific sub band s in level n. N is the number of coefficients of each sub band. x¯n,s(i,j) is enhanced sub band from each sub band xn,s(i,j) and can be computed by Eq. (8).


Enhanced image is computed for each sub band and reconstructed the image using inverse wavelet transform. Resulting image is the contrast-enhanced image.

Conversion of objects of interest: the watershed transform detects intensity valleys in the image. The enhanced image is converted into the objects of interest with high intensity valleys.

Detection of intensity valleys: all the intensity valleys are below a particular threshold. The location rather than the size of the regions is important. The min function modifies the image to contain only those valleys found by the extended min function. The min function will also change a valleys pixel value to zero (deepest possible valley for unit 8 images). All regions containing an imposed minimum will be detected by the watershed transform.

Watershed segmentation: watershed segmentation of the imposed minima image is accomplished with the watershed function. The watershed function returns a label matrix containing non-negative numbers that correspond to watershed regions. Pixels that do not fall into any watershed region are given a pixel value of zero.

However, the image is degraded by noise and so cause over-segmentation. Therefore over-segmentation images are further merged in some regions. The region to be merged is based on homogeneity and similarity criteria based on the wavelet coefficients. Mean, second- and third-order central moments values of the wavelet coefficients of each of the regions are calculated.

Merging over-segmentation regions: The watershed transform is sensitive to the change of the data therefore the noise objective brim and then changes inside objectives can lead to over-segmentation. Over segmentation is caused by the watershed transform, and the image background is divided into several parts and merged using the following conditions:

  1. The regions that will be combined are neighbors.

  2. The characteristics of the region, which will be combined, should be similar.

  3. The big region after combining is useful.

The regions which are neighbors and similar pixel values can be combined. After combination, the background and the target image are separated. Usually, similitude can be defined according to gray, texture, and so on.

If Bi is set of boundary points of catchment basin I (CBi), Ni is the number of Bi, then the definition of B mean (i) is given by the Eq. (9).


During projection from Ith layer to (I-1)th layer, a parent-child spatial relationship between the image elements of two successive layers is defined. This relationship is evaluated by means of a similarity measure. The children of a layer may belong to different parents in the upper layer. The similarity between a child image element and its possible parents describes the similarities.


3. Feature extraction and segmentation quality evaluation

The feature extraction is mainly done in evaluating the quality and efficiency of the proposed image segmentation algorithm. The different parameters such as root mean square error (RMSE), peak signal to noise ratio (PSNR) and average difference (AD) are used to measure the performance of the resultant segmented image of different techniques and compared with that of the proposed algorithm.

3.1. Root mean square error (RMSE)

RMSE is used to measure the difference between the source image and the segmented image, the smaller the value of RMSE, the better the segmentation performance. Mathematical representation of RMSE is given in Eq. (10).


where M and N are size of the image, i and j are the pixel positions in the image. M(i,j) is the segmented image and F(i,j) is the original image.

3.2. Peak signal to noise ratio (PSNR)

PSNR is the ratio between the maximum value of an image and the value of background noise. In terms of RMSE, PSNR is given in the Eq. (11).


where fmax is the maximum value of pixels in the segmented image. The larger the PSNR value, better the segmentation performance.

3.3. Average difference (AD)

Average difference is the difference in each pixel value between the input source image and the segmented image. Lower value of AD shows better segmentation performance.

The average difference between segmented image (f) and reference image (r) is given by the expression (12).


4. Sample results and discussion

This section demonstrates the performance of the proposed image segmentation algorithm for isolating the tumor part in the clinical MRI image.

The sample of normal and abnormal MRI images obtained from Kovai Medical Centre Hospital, Coimbatore, Tamil Nadu, India is illustrated in the Figure 4.

Figure 4.

Sample normal and abnormal clinical MRI images.

Segmentation algorithm is tested with MatLab tool and the simulation results are analyzed in this section. Figures 5(a) and 6(a) shows the input MRI images which are the source images for segmentation. As the source images have a low contrast level, they are enhanced with wavelet transform and the resulting contrast-enhanced images are shown in Figures 5(b) and 6(b). This step is also known as preprocessing step of image segmentation.

Figure 5.

Simulation results for brain MRI image segmentation: (a) original MRI image (b) enhanced image (c) two level decomposition of enhanced image (d) boundary extraction of LL image using a watershed algorithm (e) boundary superimposed on first level decomposed image (LL) (f) boundary extraction of reconstructed image using a watershed algorithm (g) boundary superimposed on the original image.

Figure 6.

Simulation results for head MRI image segmentation: (a) original MRI image 2 (b) enhanced image (c) two level decomposition of enhanced image (d) boundary extraction of LL image using a watershed algorithm (e) boundary superimposed on first level decomposed image (LL) (f) boundary extraction of reconstructed image using a watershed algorithm (g) boundary superimposed on the original image.

The contrast-enhanced MRI images are then subjected to second level decomposition using wavelet transforms. They are shown in Figures 5(c) and 6(c). In this step, the high frequency terms (H terms) in the images which are identified as noise terms are separated from the image and the low frequency (L terms) terms which are identified as a region of interest. The first level decomposition produces HH, HL, LH and LL sub images. The second level decomposition produces HHHH, HHHL, LLHL and LLLL.

The decomposed images with LL term are applied to watershed segmentation process, where the boundary of the LL images has extracted to isolate the tumor from its background. This is shown in the Figures 5(d) and 6(d). The extracted boundary of the images is superimposed on first level decomposed image (LL) which is shown in the Figures 5(e) and 6(e). Boundary extractions of synthesized images by the watershed algorithm are shown in the Figures 5(f) and 6(f). The boundaries are superimposed on the original images as shown in Figures 5(g) and 6(g).

The performance values for different types of image segmentation techniques are analyzed. From the analysis, it is evident that, the RMS error of the proposed image segmentation technique is 0.0154 which is minimum compared with other segmentation techniques (0.0236 for wavelet alone and 0.0312 for watershed alone). The value of RMSE should be minimum for an efficient segmentation technique.

The PSNR value obtained for the hybrid technique is 55.498 which is higher value than the existing techniques. The measured PSNR value is 55.416 for wavelet alone and 55.434 for watershed alone. For an efficient segmentation technique, the PSNR value should be maximum.

The average difference (AD) is the difference in each pixel value between the input source image and the segmented image. From the analysis, the value of AD of the hybrid method is 2.3611e-004 and that of the wavelet and watershed alone are 5.714e-004 and 9.725e-004, respectively. This shows that the hybrid method has a minimum value of AD compared with other segmentation techniques. Lower the value of AD, the better the segmentation performance.

It is inferred from the above analysis and discussion that by considering the values of performance factors, the hybrid image segmentation method which includes the wavelet and watershed method performs better than the other existing techniques.

Figure 7(a) shows the comparative chart of RMSE for proposed segmentation technique with that of other existing techniques. From the chart, it is clear that the RMSE value of the proposed technique is the minimum which ensures that the proposed segmentation technique performs well. Figure 7(b) illustrates the comparison of PSNR for the proposed method with existing techniques, which also prove that the proposed system in terms of PSNR is better than the other techniques. The average difference in each pixel value between the input source image and the segmented image is given in the Figure 7(c). It shows that the value of AD is comparatively minimum for the proposed method. For an efficient segmentation technique, the value of average difference should be minimum. Therefore, from the simulation results and from the observation of performance measurement factors, it is evident that the proposed image segmentation algorithm which comprises of wavelet transform and watershed segmentation performs better.

Figure 7.

Comparison of performance measurement parameters for different image segmentation techniques: (a) comparison of RMSE (b) comparison of PSNR (c) comparison of average difference.


5. Conclusion of the chapter

A new segmentation technique by combining wavelet transform and watershed algorithm is proposed in this section to detect the tumor in human brain. The existing method of tumor extraction is concentrated on wavelet transform or watershed transform. But the existing techniques have a drawback of over-segmentation due to noise. The hybrid segmentation method is a multiresolution technique for image segmentation and it can be achieved without any loss of any edge information in the image. Initially, we have to choose the required resolution level of the image according to the size and number of connected objects in the image. It is also described that how regions are projected onto lower layer and build hierarchical parent-child regions relationship of successive two layers.


  1. 1. Chawla M, Sharma S, Jayanthi S, Kishore LT. A method for automatic detection & classification of stroke from brain CT images. In: Proceedings of IEEE Engineering in Medicine and Biology Society Conference; 2009
  2. 2. Qurat-Ul-Ain, Latif G, Kazmi SB, Jaffar A, Anwar Mirza M. Classification and segmentation of brain tumor using texture analysis. In: International Conference on Recent Advances in Artificial Intelligence, Knowledge Engineering and Databases; 2011. pp. 147-155
  3. 3. Cai WL, Chen SC, Zhang DQ. Fast and robust fuzzy C-means clustering algorithms incorporating local information for image segmentation. Pattern Recognition Journal. 2007;40(3):825-838
  4. 4. Gadpayle P, Mahajani PS. Detection and classification of brain tumor in MRI images. International Journal of Emerging Trends in Electrical & Electronics. 2013;5(1):45-49
  5. 5. Aggarwal P, Vig R, Bhadoria S, Dethe CG. Role of segmentation in medical imaging: A comparative study. International Journal of Computer Applications. 2011;29(1):55-64
  6. 6. Postma GJ, Luts J, Idema AJ, Julia-Sape M, Moreno-Torres A, Gajewicz W, Suykens JAK, Heerschap A, Huffel SV, Buydens LMC. On the relevance of automatically selected single-voxel MRS and multimodal MRI and MRSI features for brain tumor differentiation. Journal of Computers in Biology and Medicine. 2011;41:87-97
  7. 7. Somasundaram K, Kalaiselvi T. Fully automatic method to identify abnormal MRI head scans using fuzzy segmentation and fuzzy symmetric measure. ICGST-GVIP Journal. 2010;10(3):1-9
  8. 8. Rajapakse JC, Giedd JN, Rapoport JL. Statistical approach to segmentation of single-channel cerebral MR images. IEEE Transactions on Medical Imaging. 1997;16(2):176-186
  9. 9. Castellani U, Perina A, Murino V, Bellani M, Rambaldelli G, Tansella M, Brambilla P. Brain morphometry by probabilistic latent semantic analysis. In: Proceedings of the 13th International Conference on Medical Image Computing and Computer-Assisted Intervention; 2010. pp. 177-184
  10. 10. Liu H, Chen Z, Chen X, Chen Y. Multiresolution medical image segmentation based on wavelet transform. In: Proceedings of the 2005 IEEE Engineering in Medicine and Biology 27th Annual Conference; Shanghai, China; 2005
  11. 11. Sendur L, Selesnick IW. Bivariate shrinkage functions for wavelet-based denoising exploiting interscale dependency. IEEE Transactions on Signal Processing. 2002;50(11):2744-2756
  12. 12. Padma A, Sukanesh R. A wavelet based automatic segmentation of brain tumor in CT images using optimal statistical texture features. International Journal of Image Processing. 2011;5(5):552-563

Written By

Kumaravel Subramaniam Tamilselvan and Govindasamy Murugesan

Submitted: 06 November 2017 Reviewed: 12 March 2018 Published: 04 July 2018