You are on page 1of 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.


Improved Watershed Algorithm for Cell Image Segmentation

Article  in  Advanced Materials Research · July 2012

DOI: 10.4028/


0 460

2 authors, including:

Yu Zhang
University of Vermont


All content following this page was uploaded by Yu Zhang on 17 September 2015.

The user has requested enhancement of the downloaded file.

Improved Watershed Algorithm for Cell Image Segmentation

Yu Zhang1,a, Duanquan Xu1,b

Department of Electronics and Information Engineering, Huazhong University of Science and
Technology, Wuhan, China

Keywords: Watershed, Gradient Transformation, Open-Close Reconstruction, Distance

Transformation, Segmentation.

Abstract.Watershed is an image segmentation algorithm based on mathematical morphology,

which can determine the boundary of connected section efficiently and effectively. But the
traditional watershed algorithm is sensitive to noise. To overcome the weakness of classical
watershed, this paper presents an improved watershed algorithm based on gradient transform, open-
close reconstruction and distance transform. The experiment result shows that application of this
improved watershed algorithm in cell image segmentation has a good performance.

Watershed is an image segmentation algorithm based on mathematical morphology [1]. But the
classical watershed algorithm is sensitive to noise, which can cause serious over-segmentation [2].
Basing on gradient transform, open-close reconstruction and distance transform, this paper proposes
an improved watershed algorithm, which inherits the advantage of classical watershed algorithm
and improves the noise immunity of classical watershed algorithm. This algorithm not only
overcome the over-segmentation, but also has an apparently better performance than the approach
of employing watershed simply based on open-close operation and distance transformation [3].
Image segmentation is one of the fundamental and important tasks in medical image analysis
since only on the basis of a successful segmentation can meaningful cell feature be extracted. The
cell has a round shape which is fit for distance transformation and watershed transformation. And
considering the high speed and accuracy of Watershed Algorithm in solving connected region
segmentation, we apply our improved watershed algorithm in cell image segmentation to solve the
adhesion cell segmentation [4].


A. Morphological Reconstruction
Morphological reconstruction can be thought of conceptually as repeated dilations of an image,
called the marker image, until the contour of the marker image fits under a second image, called the
mask image. In morphological reconstruction, the peaks in the marker image "spread out," or dilate
Figure 1 Processing of Reconstruction in 1-Dimension

Fig 1 illustrates this processing in 1-Dimension. Each successive dilation is constrained to lie
underneath the mask. When further dilation ceases to change the image, the processing stops. The
final dilation is the reconstructed image. The figure shows the successive dilations of the marker.

B. Gradient Transform
To simplify the discussion follows, we use the notation in fig 2 to denote image points in a 3x3
region. For example,

Figure 2 Example for 3x3 region

the center point z5 denotes f(x,y), and z1 denotes f(x-1,y-1). Denote the cross differences [6]:

Then we compute the gradient as

C. OTSU Method
Otsu method is firstly proposed by Nobuyuki Otsu [7] in 1979, which is an adaptive method of
determining the threshold. Divide the image into background and objective by its gray scale feature.
The greater the between-class variance between background and objective, the greater difference
between the two parts of the image will have. When some of the objectives are classified wrong into
background or some of the background is classified wrong into objectives, the difference between
these two parts will decrease. Thus, the Otsu method can make the probability of wrong division the
D. Distance Transform
Assume the input image is BW, and the output image is D. Gradient Transform computes the
Euclidean distance transform of the binary image BW. For each pixel in BW, the distance transform
assigns a number that is the distance between that pixel and the nearest nonzero pixel of BW. BW
can have any dimension. D is the same size as BW [8].

E. Median Filter
Median filter replaces the value of a pixel by the median of the gray levels in the neighborhood
of that pixel (the original value of the pixel is included in the computation of the median). Median
filters are particularly effective in the presence of impulse noise, also called salt-and- pepper noise
because of its appearance as white and black dots superimposed on an image [9].
Assume the input matrix is A, and the dimension of its neighborhood is m-by-n. In this paper, we
performs median filtering of the matrix A in two dimensions. Each output pixel contains the median
value in the m-by-n neighborhood around the corresponding pixel in the input image. This paper
pads the image with 0s on the edges, so the median values for the points within [m n]/2 of the edges
might appear distorted.

F. Watershed Algorithm [10]

Suppose that a hole is punched in each regional minimum and that the entire topography is
flooded from below by letting water rise through the holes at a uniform rate. When the rising water
in distinct catchment basins is about to merge, a dam is built to prevent the merging. The flooding
will eventually reach a stage when only the tops of the dams are visible above the water line. These
dam boundaries correspond to the divide lines of the watersheds. Therefore, they are the continuous
boundaries extracted by a watershed segmentation algorithm.

Cell Image Segmentation Method

We use the improved watershed algorithm to segment cell image, and this algorithm follows these
Step 1: Apply open-reconstruction and close-reconstruction to the gray scale cell image
Through applying the open-reconstruction and close-reconstruction filtering to gray scale cell
image, we eliminate the burrs in the cell, isolate the small adhesions between cells, fill the small
holes in cells and smooth the cell boundaries, meanwhile, do not change the size and shape of the
cell images. This pretreatment makes it easier to segment the cell image.
Step 2: Calculate the gradient image of the filtered image
Apply the gradient transform to the image got in step 1. In the gradient image, the gradients of the
boundaries between cells and background in original cell image are much larger than that of region
in cells.
Step 3: Use the OTSU algorithm to get the binary image of the gradient image
Transform the gradient image got in step 2 to binary image using OTSU algorithm. OTSU
algorithm is an adaptive algorithm which can find the best binary threshold. The threshold
determined by OTSU is objective and reasonable, which can lead to a good binarization performance.
After binarization, the boundaries between cells and background can be detected.
Step 4: Fill the cell areas
After detecting the cell boundaries, we fill the cell areas to accomplish the extraction of the cells
in image [11]. Then we segment the adhesion cells.
Step 5: Apply open operation to the filled cell image
Open operation can eliminate the region smaller than structure element and cut off slender
connection. In order to prevent from segmenting non-existent cells, use the open operation to
eliminate the small false cell areas.
Step 6: Apply the distance transform to filled cell image
Apply distance transform to the image got in step 5 to get a gray scale image. Get the complement
image as a new distance image and use median filter method to eliminate the noise in image. In the
new distance image, the values of pixel increase from the inner cell to outer cell. The value of
innermost pixel in cell is the smallest, and the value of outermost pixel in cell is the largest. And the
value of the background pixel is 255.
Step 7: Apply Watershed Transform to gray scale distance image
Find the local minimum point in each cell in the distance image, which is the center of each cell.
We use the minimum points to mark each cell area and use the pixel of value 255 to mark the
background. Then apply the watershed algorithm to the distance image to segment the adhesion cells
and mark the cell regions with different colors.
Step 8: Add the segmentation result to the original image
Add the segmentation result to the original image to show the final result.

Experiment and Results

We use the staining liquid based cell microscopic image as sample image to test the performance
of the presented algorithm. And the results of each step are shown in Figure 3.
Fig 3(a) is the original cell image. The algorithm is illustrated from fig 3(b) to fig 3(i), where fig(b)
is the image after open-reconstruction filtering, fig(c) is the image after close-reconstruction filtering,
fig(d) is the distance transformed image of (d), fig(e) is the binary image of (d), fig(f) is the filled
image of (e), fig(g) is the image after open operation filtering, fig(h) is the distance transformed
image of (g) and fig(i) is the watershed transformed image of (h). Fig 3(j) is the final segmentation
From fig 3(j), we can find that the result is satisfactory and precisely divide the cell and
background in this image with no over-segmentation.

Figure 3 Improved watershed segmentation for cell image

This paper presents an improved watershed algorithm based on open-close reconstruction,
gradient transformation, median filter and distance transformation. This improved watershed
algorithm overcomes the weakness of classical watershed while inherits the advantage of classical
watershed. Through the experiment, we can conclude that this algorithm has a good performance in
cell image segmentation. The experiment result is satisfactory and successfully segments the
adhesion cells, providing convenience for the further medical processing.

This work is supported by Hubei Provincial Natural Science Foundation of China under Grant No.
2009CDB296 and National University Innovative Foundation of China under Grant No. 091048709.

[1] Luc Vincent and Pierre soille, “Watersheds in digital spaces: an efficient algorithm based on
immersion simulations,” IEEE Transactions on Pattern Analysis and Machine Intelligence,
1991, Vol.13, No.6, pp.583-598.
[2] Huang Qi-kun and Zhou Yun-cai, “A method based on watershed algorithm for core particles
image segmentation,” Computer Science and Information Technology (ICCSIT), 2010 3rd
IEEE International Conference on, 2010, vol.3, pp.408-410.
[3] Yuqian Zhao, Jianxin Liu, Huifen Li and Guiyuan Li, “Improved watershed algorithm for
dowels image segmentation,” Proceedings of the 7th world congress on intelligent control and
automation, June 25-27, 2008, Chongqing, China, pp.7644-7648
[4] Yu Zhang and Duanquan Xu, “Improvement on Watershed algorithm of OpenCV and its
application in cell image segmentation,” unpublished.
[5] Vincent, L., "Morphological Grayscale Reconstruction in Image Analysis: Applications and
Efficient Algorithms," IEEE Transactions on Image Processing, Vol. 2, No. 2, April, 1993, pp.
[6] Rafael C. Gonzalez and Richard E. Woods, Digital Image Processing, 2nd ed, Prentice Hall,
2002, pp.134-137.
[7] Otsu, N., "A Threshold Selection Method from Gray-Level Histograms," IEEE Transactions on
Systems, Man, and Cybernetics, Vol. 9, No. 1, 1979, pp. 62-66.
[8] Maurer, Calvin, Rensheng Qi, and Vijay Raghavan, "A Linear Time Algorithm for Computing
Exact Euclidean Distance Transforms of Binary Images in Arbitrary Dimensions," IEEE
Transactions on Pattern Analysis and Machine Intelligence, Vol. 25, No. 2, February 2003, pp.
[9] Rafael C. Gonzalez and Richard E. Woods, Digital Image Processing, 2nd ed, Prentice Hall,
2002, pp.123-124.
[10] Meyer, Fernand, "Topographic distance and watershed lines," Signal Processing , Vol. 38, July
1994, pp. 113-125.
[11] Soille, P., Morphological Image Analysis: Principles and Applications, Springer-Verlag, 1999,
pp. 173-174.

View publication stats