Reputation: 421
I have added Emgu.Cv files to my project and I want to use it's watershed function but I dont't know how to use this. Can any one help me and explain the function,it's arguments and it's return?
Upvotes: 1
Views: 4677
Reputation: 31
Check out the answer to the following question:
watershed function provided by EmguCv
You need to set the values of the mask file to zero (use cvZero
for that). Use a second reference circle (preferably with a different greyvalue) and then retrieve the result from your mask file, after converting it to a greyvalue image.
Upvotes: 1
Reputation: 2702
Here is some vanilla code that makes use of watershed function on a generic input image using emgucv:
public void TestWaterShed()
{
Image<Bgr, Byte> image = new Image<Bgr, byte>("myImage.jpg");
Image<Gray, Int32> marker = new Image<Gray, Int32>(image.Width, image.Height);
Rectangle rect = image.ROI;
marker.Draw(
new CircleF(
new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f),
(float)(Math.Min(image.Width, image.Height) / 4.0f)),
new Gray(255),
0);
CvInvoke.cvWatershed(image, marker);
}
Upvotes: 4