-1

I have applied watershed segmentation algorithm on occluded leaves and found out the region of interest (ROI) for a single leaf. The regions have been labeled with different colors, as shown in the image given below. Now the main task is to extract the region of the original with the color having the largest region i.e. the sky blue region. Please provide me the MatLAB code. Thank you for the help.

ORIGINAL IMAGE enter image description here

SEGMENTED IMAGE enter image description here

SEGMENTED IMAGE SUPERIMPOSED ON ORIGINAL IMAGE enter image description here

  • "Please provide me the MatLAB code" is not considered a good question here ... – Dr. belisarius Apr 29 '12 at 16:57
  • @belisarius is right. If you really have been trying things, you could update your question to describe the problems you are having with `regionprops`. There are many properties you could use - like eccentricity, etc. - to identify the main leaf. – reve_etrange May 02 '12 at 23:58

1 Answers1

2

The regionprops function accepts a label matrix. See doc regionprops for all the various properties which can be extracted with this useful function.

props = regionprops(labelmatrix)
[~,ind] = max([props.Area]);
imshow(labelmatrix == ind);

You should take a look at all the areas (areas = [props.Area];) and make sure the largest one is always the one you want.

reve_etrange
  • 2,561
  • 1
  • 22
  • 36