Can't perform WaterShed segmentation

Ask question on using Emgu CV with C#
Post Reply
Posts: 1
Joined: Thu Mar 12, 2020 6:02 am

Can't perform WaterShed segmentation

Post by babouche_maf » Thu Mar 12, 2020 6:20 am

Good morning :)

I'm trying to do a water shed on images, to separate my blob from the others, but I can't do it.
I do the following code :arrow:

Image<Gray, Int32> marker = new Image<Gray, Int32>(img.ROI.Width, img.ROI.Height);
if (contourBinary.Size > 0)
for (int i = 0; i < contourBinary.Size; i++)
// ********** test *************
CvInvoke.DrawContours(marker, contourBinary, i, new MCvScalar(255, 0, 0));
CvInvoke.Circle(marker, new System.Drawing.Point(5, 5), 3, new MCvScalar(255), -1);

CvInvoke.Watershed(img, marker);

I create this code thanks to exemples, but i dont understand some things. The circle is used for what ??

What didn't I understand about doing the watershed properly? Like you can see on the image i link on my post, i want to separate the blob who merged and get them back.
testMarker.png (4.34 KiB) Viewed 16665 times

Site Admin
Posts: 1011
Joined: Thu Feb 28, 2008 4:16 pm

Re: Can't perform WaterShed segmentation

Post by canming » Tue Mar 24, 2020 8:49 am

FYI, more detail information regarding WaterShed can be found here:
https://opencv-python-tutroals.readthed ... rshed.html

The tutorial is written in python but you get the idea.

Post Reply