Research Article | Open Access

Ali Abdullah Yahya, Jieqing Tan, Min Hu, "A Novel Model of Image Segmentation Based on Watershed Algorithm", *Advances in Multimedia*, vol. 2013, Article ID 120798, 8 pages, 2013. https://doi.org/10.1155/2013/120798

# A Novel Model of Image Segmentation Based on Watershed Algorithm

**Academic Editor:**Qingshan Liu

#### Abstract

A novel model of image segmentation based on watershed method is proposed in this paper. To prevent the oversegmentation of traditional watershed, our proposed algorithm has five stages. Firstly, the morphological reconstruction is applied to smooth the flat area and preserve the edge of the image. Secondly, multiscale morphological gradient is used to avoid the thickening and merging of the edges. Thirdly, for contrast enhancement, the top/bottom hat transformation is used. Fourthly, the morphological gradient of an image is modified by imposing regional minima at the location of both the internal and the external markers. Finally, a weighted function is used to combine the top/bottom hat transformation algorithm and the markers algorithm to get the new algorithm. The experimental results show the superiority of the new algorithm in terms of suppression over-segmentation.

#### 1. Introduction

A segmentation divides an image into its constituent regions or objects, and the segmentation must be stopped when the objects of interest in an application have been isolated [1]. Image segmentation is based on three principal concepts: edge detection, thresholding, and region growing. The most common one is thresholding. Thresholding has a high speed of operation and ease of implementation. However its performance is relatively limited since image pixels with the same gray level value will invariably be segmented into the same class [2]. Segmentation by morphological watersheds [3–10] embodies many of the concepts of the other three approaches, which produces more stable segmentation results, as well as providing simple framework. A simple watershed transformation causes oversegmentation [11]. In order to prevent this oversegmentation, the watershed method passed through several stages of evolution. The original watershed method was developed by Lantuejoul [12] and was widely described together with its applications by Beucher and Meyer [13]. The authors in [3] used FIFO queues to extend the original evolution with gray scale images [11]. Shafarenko et al. [14] applied FIFO to color images. In this paper we enhance the contrast of the gradient image by top/bottom hat transformation, modify the result of the enhancement by imposing regional minima at the locations of both the internal and the external markers, combine the top/bottom hat transformation algorithm and the markers algorithm by using suitable weight function, and subject the combination to the watershed algorithm. The new algorithm has a capability to prevent oversegmentation of the simple watershed segmentation algorithm. The other particularity of the proposed algorithm is insensitivity to noise.

#### 2. Proposed Algorithm

In the proposed algorithm we clean up the image by morphology reconstruction, avoid the thickening and merging of the edges by the multiscale gradient, enhance the contrast of the gradient image by top/bottom hat transformation, modify the enhanced image by internal and external markers, and subject the image combination (top/bottom image with marker image) to watershed segmentation algorithm.

##### 2.1. Morphological Reconstruction

Reconstruction is a morphological transformation involving two images and a structuring element. The first image is called marker and the second is called mask. Morphological image processing contains two fundamental operations: erosion and dilation. Dilation and erosion are operations that thicken and thin the objects in the image, respectively. The dilation and erosion of the image by structuring element with and as sets in , denoted by and , respectively, are defined as follows: The opening of image by structuring element is defined as follows: The closing of image by structuring element is defined as follows:

To smooth the image by reconstruction operator, we use the following equation: where is reconstruction operator, is reference image which is obtained by closing the image , times, and is the size of the structure element [4].

##### 2.2. Multiscale Morphological Gradient

Usually we use the gradient magnitude to preprocess a gray-scale image before using the watershed transformation for segmentation. Dilation and erosion can be used in combination with image subtraction to obtain the morphological gradient image of the smoothed image as follows: where is a structuring element (SE) of size .

The regions in an image are thickened and shrunk by dilation and erosion, respectively. Subtracting erosion from dilation will emphasize the boundaries between regions; in other words, the effect of the subtraction operation is enhancing the edges. Consequently it prevents merging them. For multiscale gradient image , we use a multiscale gradient algorithm first proposed by Wang [16]:

When we subject the multiscale gradient image to watershed segmentation algorithm, it is inevitable that there are so many watershed ridge lines that do not correspond to objects in which we are interested, that is, oversegmentation. Dilated multiscale gradient image with a structuring element can reduce this oversegmentation. Therefore the final gradient image can be expressed as follows:

##### 2.3. Top/Bottom Hat Transformation

The main goal of the top and bottom hats transforms is to lighten objects on a dark background and darken objects on a light background, respectively [17]. As a result the contrast of the image will be enhanced.

Top-hat transformation [18, 19] of a final gradient image is defined as follows:

Bottom-hat transformation of a final gradient image is defined as follows:

In this paper we use top/bottom hat transformation to enhance the contrast of the final gradient image , which contributes to reduce oversegmentation that is produced by subjecting the final gradient image to the watershed segmentation algorithm.

##### 2.4. Markers Extraction

Objecting a gradient image directly to the watershed segmentation algorithm can lead to oversegmentation due to noise and other local irregularities of the gradient. The ideal method to prevent this oversegmentation is based on the concept of markers whose aim is to pinpoint regions that are homogeneous in terms of texture, color, and intensity and then merge them to get relatively accurate segmentation. Internal markers are inside each of the objects of interest, whilst external markers are contained within the background. These markers are used to modify the gradient image using minima imposition technique. This technique will modify the image wherefore regional minima takes place only in marked location. The image obtained by marker image is a binary image such that a pixel belonging to homogeneous region will be marker (made black), otherwise it will be white. The concept of markers is a good method for avoiding oversegmentation. Nevertheless in this method some objects will leave without marks, which means that the final segmentation will miss these objects.

##### 2.5. A Combined Algorithm

As mentioned above, a multiscale gradient usually leads to oversegmentation, whilst markers extraction leaves some objects without marks. Therefore the combining of these two methods by appropriate weight function can overcome the shortcomings of these two methods. In other words, the combination with proper weight can be expected to segment the objects that are left without marks and at the same time prevent oversegmentation that is caused by multiscale gradient, which can provide more perfect results when we use watershed segmentation algorithm. Considering the characteristics of the multiscale gradient (enhanced by top/bottom hat transformation) method and the markers method, we propose a weight function as follows: where is a pixel at position , is a foreground of the image, and is a background of the image. The new algorithm that is obtained by combining the enhanced final gradient image with marker image is as follows:

From we can expect the following. (i)In the regions that have large number of segmented regions (oversegmentation) the new algorithm will play good role to control oversegmentation; namely, the new algorithm will highlight the markers method since is close to 1 in this case.(ii)In the regions that contain the objects which are left without marks, the new algorithm will play good role to segment these objects; in other words, the new algorithm will highlight the role of since is close to 0 in this case.

#### 3. Experimental Results

To evaluate the proposed algorithm, we select four images as examples. The results of the proposed segmentation algorithm are shown in Figures 1, 2, 3, and 4, where in each figure are illustrated, respectively, the original image, the result by traditional watershed algorithm, the result by final multiscale gradient algorithm, the result by the algorithm in [4], the result by the algorithm in [15], and the result by the new algorithm. From Figures 1, 2, 3, and 4 it is obvious to see that the proposed algorithm gives optimal results. The results of the new segmentation algorithm are compared with those of the traditional watershed segmentation algorithm, final multiscale gradient segmentation algorithm, the algorithm in [4], and the algorithm in [15], respectively.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

The result of the traditional watershed segmentation algorithm suffers from serious oversegmentation that makes the result virtually useless.

Since the final multiscale gradient algorithm reduces the effect of the noise, the results look much better than traditional watershed. Nevertheless there are some watershed ridge lines that do not correspond to the objects in which we are interested. The proposed algorithm overcomes the problems of oversegmentation and noise sensitiveness of the traditional watershed segmentation algorithm, so the oversegmentation is almost reduced, and the location of the edges is very accurate.

From Figure 1, we can see that the watershed ridge lines between the rice grains have completely disappeared in the image that was segmented by the proposed segmentation algorithm and the algorithm in [4], unlike in the cases of traditional watershed segmentation algorithm and final multiscale gradient segmentation algorithm, where we can see many closed and connected regions whose boundaries follow the contours of the image that made the image look very messy, especially in the case of traditional watershed segmentation algorithm. As for the case of the algorithm in [15] the rice grains almost left without marked.

From Figures 2, 3, and 4 we can find that the traditional watershed, final multiscale gradient, and the algorithms in [4, 15] oversegment the image into peak, pit and saddle regions, which result in many watershed ridge lines that do not correspond to the objects in which we are interested, while only peak and pit, regions appear in the image by the proposed algorithm. From Figures 2, 3, and 4 we see that the traditional watershed, final multiscale gradient, and the algorithms in [4, 15] lead to oversegmentation. Nevertheless the proposed algorithm leads to correct segmentation.

Table 1 lists the computational costs for different equations for four images. From this table, it can be seen that (11) proposed in our paper takes less computation time than (14) and (2) proposed in [4] and [15], respectively, which means that our proposed algorithm saves more computation time than the other two algorithms; in other words, the proposed algorithm is much economical.

#### 4. Conclusion

To solve the oversegmentation and noise sensitiveness of the simple watershed transform, the new algorithm is proposed in this paper. The proposed segmentation algorithm was implemented for several images and produced very satisfactory results with respect to suppression of oversegmentation. Appropriate weight function is used to combine the enhanced final multiscale gradient algorithm with markers algorithm to get the new algorithm. A combination of these two algorithms can contribute to overcome the oversegmentation and undersegmentation which are caused by enhanced final multiscale gradient algorithm and markers algorithm, respectively. The experimental results show that the new algorithm is superior to the final multiscale gradient algorithm, the algorithm in [4], and the algorithm in [15] in terms of suppression of oversegmentation of traditional segmentation algorithm.

#### Acknowledgments

This work is supported by the NSFC-Guangdong Joint Foundation (Key Project) under Grant no. U1135003 and the National Natural Science Foundation of China under Grant no. 61070227.

#### References

- R. C. Gonzalez, R. E. Woods, and S. L. Eddins,
*Digital Image Processing Using Matlab*, Publishing House of Electronics Industry, Beijing, China, 2009. - C. F. Sin and C. K. Leung, “Image segmentation by changing template block by block,” in
*Proceedings of the IEEE Region 10th International Conference on Electrical and Electronic Technology*, vol. 1, pp. 302–305, China, August 2001. View at: Google Scholar - L. Vincent and P. Soille, “Watersheds in digital spaces: an efficient algorithm based on immersion simulations,”
*IEEE Transactions on Pattern Analysis and Machine Intelligence*, vol. 13, no. 6, pp. 583–598, 1991. View at: Publisher Site | Google Scholar - K. Nallaperumal, K. Krishnaveni, J. Varghese, S. Saudia, S. Annam, and P. Kumar, “A novel multi-scale morphological watershed segmentation algorithm,”
*International Journal of Imaging Science and Engineering*, vol. 1, no. 2, pp. 60–64, 2007. View at: Google Scholar - M. Pesaresi and J. A. Benediktsson, “A new approach for the morphological segmentation of high-resolution satellite imagery,”
*IEEE Transactions on Geoscience and Remote Sensing*, vol. 39, no. 2, pp. 309–320, 2001. View at: Publisher Site | Google Scholar - K. Haris, S. N. Efstratiadis, N. Maglaveras, and A. K. Katsaggelos, “Hybrid image segmentation using watersheds and fast region merging,”
*IEEE Transactions on Image Processing*, vol. 7, no. 12, pp. 1684–1699, 1998. View at: Publisher Site | Google Scholar - S. Mukhopadhyay and B. Chanda, “Multiscale morphological segmentation of gray-scale images,”
*IEEE Transactions on Image Processing*, vol. 12, no. 5, pp. 533–549, 2003. View at: Publisher Site | Google Scholar - H. T. Nguyen, M. Worring, and R. van den Boomgaard, “Watersnakes: energy-driven watershed segmentation,”
*IEEE Transactions on Pattern Analysis and Machine Intelligence*, vol. 25, no. 3, pp. 330–342, 2003. View at: Publisher Site | Google Scholar - G. Hamarneh and X. Li, “Watershed segmentation using prior shape and appearance knowledge,”
*Image and Vision Computing*, vol. 27, no. 1-2, pp. 59–68, 2009. View at: Publisher Site | Google Scholar - X. Han, Y. Fu, and H. Zhang, “A fast two-step marker-controlled watershed image segmentation method,” in
*Proceedings of the IEEE International Conference on Mechatronics and Automation*, pp. 1375–1380, Beijing, China, 2012. View at: Google Scholar - P. R. Hill, C. N. Canagarajah, and D. R. Bull, “Image segmentation using a texture gradient based watershed transform,”
*IEEE Transactions on Image Processing*, vol. 12, no. 12, pp. 1618–1633, 2003. View at: Publisher Site | Google Scholar - C. Lantuejoul,
*La Squelettisatoin et son Application aux Mesures Topologiques des Mosaiques Polycristalines [Ph.D. dissertation]*, School of Mines, Paris, France, 1978. - S. Beucher and F. Meyer, “The morphological approach to segmentation: the watershed transformation,” in
*Mathematical Morphology and Its Applications to Image Processing*, E. R. Dougherty, Ed., vol. 34, pp. 433–481, Marcel Dekker, New York, NY, USA, 1993. View at: Google Scholar - L. Shafarenko, M. Petrou, and J. Kittler, “Automatic watershed segmentation of randomly textured color images,”
*IEEE Transactions on Image Processing*, vol. 6, no. 11, pp. 1530–1544, 1997. View at: Publisher Site | Google Scholar - Y. Liu and Q. Zhao, “An improved watershed algorithm based on multi-scale gradient and distance transformation,” in
*Proceedings of the IEEE 3rd International Congress on Image and Signal Processing (CISP '10)*, pp. 3750–3754, Yantai, China, October 2010. View at: Publisher Site | Google Scholar - D. Wang, “A multiscale gradient algorithm for image segmentation using watersheds,”
*Pattern Recognition*, vol. 30, no. 12, pp. 2043–2052, 1997. View at: Google Scholar - R. C. Gonzalez and R. E. Woods,
*Digital Image Processing*, Publishing House of Electronics Industry, Beijing, China, 3rd edition, 2010. - A. C. Jalba, M. H. F. Wilkinson, and J. B. T. M. Roerdink, “Morphological hat-transform scale spaces and their use in pattern classification,”
*Pattern Recognition*, vol. 37, no. 5, pp. 901–915, 2004. View at: Publisher Site | Google Scholar - A. C. Jalba, J. B. T. M. Roerdink, and M. H. F. Wilkinson, “Morphological hat-transform scale spaces and their use in texture classification,” in
*Proceedings of the IEEE International Conference on Image Processing (ICIP '03)*, vol. 1, pp. I-329–I-332, Orlando, Fla, USA, September 2003. View at: Google Scholar

#### Copyright

Copyright © 2013 Ali Abdullah Yahya et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.