0

I have done a watershed segmentation in OpenCV, but I want to split the segments. I thought about splitting it based on the each segment's RGB value.Since RGB value of different segments will be different. But I can't seem to find out how to do it. Anyone knows how to do this splitting based on RGB values? Or any other way of splitting the watershed segments?

What I want is to separate the two different colour zones( brown and pink in this picture) into two images or windows.

Miki
  • 40,887
  • 13
  • 123
  • 202
Abhishek V. Pai
  • 241
  • 1
  • 10
  • 27
  • Splitting segment??? The watershed is going to give you zones/areas with different labels, not segments. Could you share an image of what your mean? – FiReTiTi Nov 11 '15 at 17:28
  • ^Hey, I have added the image and what I intend to do with it. – Abhishek V. Pai Nov 12 '15 at 04:05
  • Can you post the original image, and the code you used to get to this result? Also, post the image in a non compressed format, such as png. – Miki Nov 14 '15 at 10:30
  • Possible duplicate of [How to draw contours of each segmented object](http://stackoverflow.com/questions/33577297/how-to-draw-contours-of-each-segmented-object) – Miki Nov 14 '15 at 10:31
  • ^ the code is long.. I can mail it to you if you want. I could really use some help with it. – Abhishek V. Pai Nov 16 '15 at 05:14

1 Answers1

0

Then it is the direct result of the watershed. So let's say I is your original image, W the watershed result containing two values A and B, and Ra, Rb the two final results.

for all (x,y) in I
    If W(x,y) == A then Ra(x,y) = I(x,y) and Rb(x,y) = 0
    else Rb(x,y) = I(x,y) and Ra(x,y) = 0

Then the values of the original image are going to be in Ra and Rb according to the watershed segmentation results.

FiReTiTi
  • 5,597
  • 12
  • 30
  • 58