Journal of Information & Communication Technology
Vol. 2, No. 1, (Spring 2008) 01-09
Enhanced Watershed Image Processing Segmentation
*
Amir Shahzad
*
Muhammad Sharif
*
Mudassar Raza
Khalid Hussain*
Department of Computer Sciences
COMSATS Institute of Information Technology, Wah Cantt, Punjab-Pakistan
ABSTRACT
Watershed is a most popular image processing method. Because image
processing is emerging field and segmentation of nontrivial images is
one of the very difficult tasks in image processing area. The proposed
system is to enhance the watershed method.
INSPEC Classification : C1250M; C4240; C5260B
1) INTRODUCTION
Watershed is method of image processing segmentation. To understand watershed image
processing segmentation, one need to know what is image processing and what image
processing segmentation is.
A. Image processing
There are number of ways to define image processing but in simple words we can define
image processing as follows:
“The field of digital image processing refers to processing digital images by means of
digital computer” (Luc,1991).
B. Image processing segmentation
R. Gonzalez and R. Woods write in their widely used textbook (Digital Image Processing)
that "segmentation of nontrivial images is one of the most difficult tasks in image processing.
Segmentation accuracy determines the success or failure of computerized analysis
procedures” (RAFAEL C, 2004).
C. Watershed image processing segmentation
The material presented by the authors does not necessarily portray the viewpoint of the editors
and the management of the Institute of Business and Technology (BIZTEK) or COMSATS Institute of
Information Technology, Wah Cantt, Punjab-Pakistan.
*
*
Amir Shahzad
* Muhammad Sharif
* Mudassar Raza
*
Khalid Hussain
C
: asakpke@yahoo.com
: muhammadsharifmalik@yahoo.com
: mudassarkazmi@yahoo.com
: khalidusmani_65@yahoo.com
JICT is published by the Institute of Business and Technology (BIZTEK).
Ibrahim Hydri Road, Korangi Creek, Karachi-75190, Pakistan.
Enhanced Watershed Image Processing Segmentation
When we call watershed method, it will return a label image. In label image, all the different
objects identified will have different pixel value i.e. all pixel of 1st object will have value
one and all pixel of 2nd object will have value two and so on
D. Enhanced watershed image processing
Enhanced watershed image processing is to improve the results of watershed image
processing. Proposed system is to enhance the watershed algorithm. Here the enhancement
is in terms of robustness i.e. the outcome. For example if watershed algorithm identifies
three objects from an image containing six objects. Then proposed system will try to
identify four or five object from the same image containing the six objects.
2) PROPOSED METHOD FOR ENHANCEMENT
Proposed algorithm is based on merging watershed result with enhanced edge detection
result (Edges are those places in an image that correspond to object boundaries.). Hence
it enhances the watershed result. Simple edge detection result is not sufficient to enhance
watershed result so 1st we need to enhance the edge detection result. When we enhance
the edge detection, this ultimately enhances the final result but using proper algorithm to
merge the both results of watershed and enhance edge detection.
For this purpose we need to make following small algorithms
A. Enhanced watershed
This is the main algorithm. It controls the all other algorithm. It calls the watershed method,
edge detection method, enhances edge detection result and algorithm given below.
B. Connect edge with border
Fig. 1
Edges not connected with border
In edge detection method most edges are not connected with border line. This connects
the edges with border line of image.
Fig. 2
Edges connected with border
C. Fill 1 missing pixel
Vol. 2, No. 1, (Spring 2008)
02
Amir Shahzad, Muhammad Sharif, Mudassar Raza, Khalid Hussain
Fig. 3
Missing pixel
Fill the pixel, if there is one missing pixel i.e. if there are three pixel having values 1 0 1,
it convert the value of 2nd pixel from 0 to 1 if value of 1st and 3rd pixel is one
Fig. 4
Without missing pixel
D. Get big object no
Read the whole label image and return the biggest object number.
E. Connect object with border
Fig. 5
Object not connected with border
Connects the start/end pixel of object at border i.e. if object two has start pixel position
24 and end pixel position 33 at border then this will connect there two pixels with a line
at border
03
Journal of Information & Communication Technology
Enhanced Watershed Image Processing Segmentation
Fig. 6
Object connected with border
F. Get minimum object size
Read the label image and return the size of minimum object in label image.
G. Get object start pixel
This will return the starting pixel of an object i.e. if we give object number two then this
will return starting pixel of object two.
H. Get object no
This method will get the x, y values and give the object number at that pixel.
I. Get object size
This method will get the object number and return the size of that object.
J. Get select object
This method will get the object number and return the image having only pixel of this
object.
3) PROPOSED ALGORITHM
I proposed the following method for enhancing watershed result
1. Read image
2. Convert image to gray scale, if required
3. Perform canny edge detection and get edges
4. connect edges with border
5. Fill missing pixel in edges
6. make edges logical (i.e. 0/1)
7. Complement the image
8. Perform labeling function on edges and get label 1 and total objects in label 1
9. Get biggest object number in the label 1
10. Connect objects with border
11. Perform labeling function again and get label 1 and total objects in label 1
Vol. 2, No. 1, (Spring 2008)
04
Amir Shahzad, Muhammad Sharif, Mudassar Raza, Khalid Hussain
12. Get biggest object number again in the label 1
13. Perform existing watershed method and get the label 2
14. Perform labeling function on label 2 and get total objects in label 2
15. Get biggest object number in the label 2
16. Get the size of minimum object in label 2
17. loop through 1st object to total object in label 1
a.
b.
c.
d.
if current object number is equal to biggest number in label 1 then continue
Get the current object's start pixel in x and y variable from label 1
Get the object number at x and y position in label 2
if object number is equal to the biggest object number of label 2 then
i.
ii.
iii.
iv.
Increase the value of total objects in label 2 by one
Find the rows and columns pixels of current object in label 1
Find the total pixels (i.e. total rows or columns) in above find rows and columns
Loop through 1st pixel to the last pixel of current object in label 1
1. Change the current pixel value at label 2 to total objects value in label 2
2. if there is other objects pixel in between rows then change the pixel to total
objects value
v. continue the loop at 17
e. Get the current object size from label 1
f. Get the size of object number (see 17.c
g. If current object's size is greater than object number's size then
i. Find the rows and columns pixels of current object in label 1
ii. Find the total pixels (i.e. total rows or columns) in above find rows and columns
iii. Loop through 1st pixel to the last pixel of current object in label 1
1. Change the current pixel value at label 2 to object number value (see 17.c)
iv. continue the loop at 17
h. if current object's size is greater than double size of minimum object in label 2
i.
ii.
iii.
iv.
Find the rows and columns pixels of current object in label 1
Find the total pixels (i.e. total rows or columns) in above find rows and columns
Increase the value of total objects in label 2 by one
Loop through 1st pixel to the last pixel of current object in label 1
1. Change the current pixel value at label 2 to total object value
2. if there is other objects pixel in between rows then change the pixel to total
objects value
v. continue the loop at 17
18. Convert the label2 to RGB and display the final enhanced watershed result
4) ENHANCED RESULTS
A. Set 1
Following is set 1 summary of segmentation results
05
Journal of Information & Communication Technology
Enhanced Watershed Image Processing Segmentation
Fig. 7
Segmentation Results on Set1
Image
Watershed%
Propose%
1
35.48%
45.16%
2
0%
26.67%
3
9.09%
18.18%
4
9.09%
27.27%
5
11.11%
55.56%
Following is bar chart & graph comparison
Fig. 8
Comparison on Set 1
*At X-axis- Image Number
*At Y-axis Percentage
Fig. 9
Comparison on Set 1
B. Set 2
Vol. 2, No. 1, (Spring 2008)
06
Amir Shahzad, Muhammad Sharif, Mudassar Raza, Khalid Hussain
Following is set 2 summary of segmentation results
Fig. 10
Segmentation Results on Set2
Image
Watershed%
Propose%
1
0
24.21
2
36.36
45.45
3
11.76
11.76
4
0
20
5
25
75
Following is bar chart & graph comparison
Fig. 11
Comparison on Set 2
Fig. 12
Comparison on Set 2
07
Journal of Information & Communication Technology
Enhanced Watershed Image Processing Segmentation
C. Set 3
Following is set 3 summary of segmentation results
Fig.13
Segmentation Results on Set3
Image
Watershed%
Propose%
1
20
40
2
11
33
3
7.14
10.71
4
0
52.63
5
25
78.35
Following is bar chart & graph comparison
Fig. 14
Comparison on Set 3
Fig. 15
Comparison on Set 3
Vol. 2, No. 1, (Spring 2008)
08
Amir Shahzad, Muhammad Sharif, Mudassar Raza, Khalid Hussain
5) CONCLUSION
The evaluation of the segmentation is done by comparing the each object in true segmentation
with the object in marker-controlled watershed segmentation or proposed method. So on
the basis of this, percentage is calculated on different sets of images and draws the
comparison graph between marker-controlled watershed and proposed method. Conclusion
is that the proposed method enhances the result of marker-controlled watershed.
6) FUTURE WORK
Image processing is very hot field which needs extensive research and hard work. Following
are the suggestions for future work.
"
Improve the speed by using parallel processing either on clusters system or multiprocessor system
"
Merge this technique with some other technique to get the better results
"
Fill missing pixel technique can be useful for other purposes
"
Implement the same method on C++ for efficiency reasons
7) REFERENCES
LUC VINCENT, PIERRE SOILLE, (1991) "Watersheds in Digital Spaces: An Efficient
Algorithm Based on Immersion Simulations", IEEE Transaction on Pattern Analysis
and Machine Intelligence, IEEE, 1991
RAFAEL C. GONZALEZ, RICHARD E. WOODS., STEVEN L. EDDINS, (2004) Digital
Image Processing Using MATLAB, Pearson Education Inc, 2004
Segmentation (image processing), From Wikipedia, the free-encyclopedia,
http://en.wikipedia.org/wiki/Segmentatio n_(mage_processing)
Image Segmentation And Mathematical Morphology,
http://cmm.ensmp.fr/~beucher/wtshed.html
The Watershed Transform, Strategies for Image Segmentation, by Steve Eddins ,
http://www.mathworks. com/company/newsletters/news_notes/win02/watershed.html
Digital Image Processing Chapter 5, Part III
Segmentation: Region growing segmentation
http://www.icaen.uiowa.edu/~dip/LECTURE/Segmentation3.html#watershed
3D imaging analysis and modeling of porous cereal products using X-Ray Microtomography,
Gerard Van Dalen e.t. all, Image Anal Stereol 2007;26:169-177
Mathematical Modeling of Watershed Hydrology (2002), by V P Singh, D A Woolhiser,
Journal of Hydrologic Engineering (2002)
09
Journal of Information & Communication Technology