mcs project - enhanced watershed

15
Enhanced Watershed Enhanced Watershed Image Processing Image Processing Segmentation Segmentation Aamir Shahzad Aamir Shahzad CIIT/SP05-MCS-002/WAH CIIT/SP05-MCS-002/WAH

Upload: asakpke

Post on 25-Jun-2015

810 views

Category:

Technology


2 download

DESCRIPTION

This is presentation of my MCS degree project 'Enhanced Watershed'.

TRANSCRIPT

Page 1: MCS Project - Enhanced Watershed

Enhanced Watershed Enhanced Watershed Image Processing Image Processing SegmentationSegmentation

Aamir ShahzadAamir Shahzad

CIIT/SP05-MCS-002/WAHCIIT/SP05-MCS-002/WAH

Page 2: MCS Project - Enhanced Watershed

AbstractAbstract

• Watershed enhancement can be done in Watershed enhancement can be done in three different ways.three different ways.

• One is to perform preprocessing. Second is One is to perform preprocessing. Second is to improve the watershed algorithm. And to improve the watershed algorithm. And the third one is to perform post processing.the third one is to perform post processing.

• I choose the last option for enhancement I choose the last option for enhancement because this option has more opportunities because this option has more opportunities for enhancement. In this option, I use the for enhancement. In this option, I use the technique “Fusion of edge based enhanced technique “Fusion of edge based enhanced watershed segmentation” or “edge based watershed segmentation” or “edge based enhanced watershed segmentation”.enhanced watershed segmentation”.

Page 3: MCS Project - Enhanced Watershed

What is Watershed What is Watershed Segmentation?Segmentation?

• What is segmentation?What is segmentation?

• Understanding the watershed Understanding the watershed transform requires that you think transform requires that you think of an image as a surface.of an image as a surface.

• The key behind watershed is to The key behind watershed is to change your image into another change your image into another image whose catchment basins image whose catchment basins are the objects you want to are the objects you want to identify.identify.

Page 4: MCS Project - Enhanced Watershed

Marker-Controlled Marker-Controlled WatershedWatershed• In simple watershed, we face In simple watershed, we face

the problem of over the problem of over segmentation.segmentation.

• Marker control is a improved Marker control is a improved form of watershed.form of watershed.

• Here we use internal and Here we use internal and external markers define by external markers define by automatically or from userautomatically or from user

Page 5: MCS Project - Enhanced Watershed

Proposed system – enhanced Proposed system – enhanced watershed segmentationwatershed segmentation

• Following are the high level main stepsFollowing are the high level main steps– Perform watershed segmentation on main Perform watershed segmentation on main

imageimage– Get edge image from main imageGet edge image from main image– Enhance edge image resultsEnhance edge image results– Merge the results based on the best resultsMerge the results based on the best results

Page 6: MCS Project - Enhanced Watershed

Algorithms used in main Algorithms used in main algorithmalgorithm

• Connect edge with borderConnect edge with border

• Fill one missing pixelFill one missing pixel

• Get big object numberGet big object number

• Connect object with borderConnect object with border

• Get minimum object sizeGet minimum object size

• Get object start pixelGet object start pixel

• Get object numberGet object number

• Get object sizeGet object size

• Get select objectGet select object

Page 7: MCS Project - Enhanced Watershed

Proposed algorithmProposed algorithm1.1. Read imageRead image2.2. Convert image to gray scale, if required Convert image to gray scale, if required 3.3. Perform canny edge detection and get edgesPerform canny edge detection and get edges4.4. connect edges with borderconnect edges with border5.5. Fill missing pixel in edgesFill missing pixel in edges6.6. make edges logical (i.e. 0/1)make edges logical (i.e. 0/1)7.7. Complement the imageComplement the image8.8. Perform labeling function on edges and get label 1 and total objects in Perform labeling function on edges and get label 1 and total objects in

label 1label 19.9. Get biggest object number in the label 1Get biggest object number in the label 110.10. Connect objects with borderConnect objects with border11.11. Perform labeling function again and get label 1 and total objects in label Perform labeling function again and get label 1 and total objects in label

1112.12. Get biggest object number again in the label 1Get biggest object number again in the label 113.13. Perform existing watershed method and get the label 2Perform existing watershed method and get the label 214.14. Perform labeling function on label 2 and get total objects in label 2Perform labeling function on label 2 and get total objects in label 215.15. Get biggest object number in the label 2Get biggest object number in the label 216.16. Get the size of minimum object in label 2Get the size of minimum object in label 217.17. loop through 1st object to total object in label 1loop through 1st object to total object in label 1

a.a. if current object number is equal to biggest number in label 1 then continueif current object number is equal to biggest number in label 1 then continueb.b. Get the current object’s start pixel in x and y variable from label 1Get the current object’s start pixel in x and y variable from label 1c.c. Get the object number at x and y position in label 2Get the object number at x and y position in label 2d.d. if object number is equal to the biggest object number of label 2 thenif object number is equal to the biggest object number of label 2 then

i.i. Increase the value of total objects in label 2 by oneIncrease the value of total objects in label 2 by oneii.ii. Find the rows and columns pixels of current object in label 1Find the rows and columns pixels of current object in label 1iii.iii. Find the total pixels (i.e. total rows or columns) in above find rows and columnsFind the total pixels (i.e. total rows or columns) in above find rows and columns

Page 8: MCS Project - Enhanced Watershed

iv.iv. Loop through 1st pixel to the last pixel of current object in label 1Loop through 1st pixel to the last pixel of current object in label 1• Change the current pixel value at label 2 to total objects value in label 2Change the current pixel value at label 2 to total objects value in label 2• if there is other objects pixel in between rows then change the pixel to if there is other objects pixel in between rows then change the pixel to

total objects valuetotal objects value

v.v. continue the loop at 17continue the loop at 17e.e. Get the current object size from label 1Get the current object size from label 1f.f. Get the size of object number (see 17.c)Get the size of object number (see 17.c)g.g. If current object’s size is greater thanIf current object’s size is greater than object number’s size object number’s size

thentheni.i. Find the rows and columns pixels of current object in label 1Find the rows and columns pixels of current object in label 1ii.ii. Find the total pixels (i.e. total rows or columns) in above find rows Find the total pixels (i.e. total rows or columns) in above find rows

and columnsand columnsiii.iii. Loop through 1st pixel to the last pixel of current object in label 1Loop through 1st pixel to the last pixel of current object in label 1

• Change the current pixel value at label 2 to object number value (see Change the current pixel value at label 2 to object number value (see 17.c)17.c)

iv.iv. continue the loop at 17continue the loop at 17h.h. If current object’s size is greater than double size of minimum If current object’s size is greater than double size of minimum

object in label 2object in label 2i.i. Find the rows and columns pixels of current object in label 1Find the rows and columns pixels of current object in label 1ii.ii. Find the total pixels (i.e. total rows or columns) in above find rows Find the total pixels (i.e. total rows or columns) in above find rows

and columnsand columnsiii.iii. Increase the value of total objects in label 2 by oneIncrease the value of total objects in label 2 by oneiv.iv. Loop through 1st pixel to the last pixel of current object in label 1Loop through 1st pixel to the last pixel of current object in label 1

• Change the current pixel value at label 2 to total object valueChange the current pixel value at label 2 to total object value• if there is other objects pixel in between rows then change the pixel to if there is other objects pixel in between rows then change the pixel to

total objects valuetotal objects valuev.v. continue the loop at 17continue the loop at 17

18.18. Convert the label2 to RGB and display the final enhanced Convert the label2 to RGB and display the final enhanced watershed resultwatershed result

Page 9: MCS Project - Enhanced Watershed

Example 1Example 1Original Image Simple Watershed Result

Marker-Controlled Watershed Result My Watershed Result

Page 10: MCS Project - Enhanced Watershed

Example 2Example 2

Original Image

Marker-Controlled Watershed Result My Watershed Result

Page 11: MCS Project - Enhanced Watershed

Example 3Example 3

Original Image

Marker-Controlled Watershed Result My Watershed Result

Page 12: MCS Project - Enhanced Watershed

Example 4Example 4Original Image Marker-Controlled Watershed Result My Watershed Result

Page 13: MCS Project - Enhanced Watershed

NoNo ImageImage WatersheWatershedd

My My watershedwatershed

EnhancemeEnhancement nt FaultFault

11 70%70% 80%80% 10%10% 1%1%

22 50%50% 70%70% 20%20% 3%3%

33 40%40% 50%50% 10%10% 1%1%

44 0%0% 70%70% 70%70% 1%1%

55 0%0% 30%30% 30%30% 1%1%

66 0%0% 20%20% 20%20% 1%1%

Note: Results approximate

Page 14: MCS Project - Enhanced Watershed

NoNo ImageImage WatersheWatershedd

My My watershedwatershed

EnhancemeEnhancement nt FaultFault

77 0%0% 70%70% 70%70% 1%1%

88 50%50% 53%53% 3%3% 1%1%

99 5%5% 30%30% 25%25% 2%2%

1010 0%0% 90%90% 90%90% 1%1%

1111 0%0% 70%70% 705705 1%1%

1212 0%0% 30%30% 30%30% 2%2%

Page 15: MCS Project - Enhanced Watershed

NoNo ImageImage WatersheWatershedd

My My watershedwatershed

EnhancemeEnhancement nt FaultFault

1313 30%30% 35%35% 5%5% 1%1%

1414 0 %0 % 90%90% 90%90% 1%1%

1515 30%30% 25%25% 0%0% 10%10%

Average Average 18%18% 54%54% 36%36% 2%2%

<< The End >>