Hi,
I am creating a interactive Grabcut algorithm which is taken from the Open CV. Iam doing this in c# Emgu 3.0. I was able to draw a rectangle to extract the foreground image using
the below code.
using (Matrix<double> bgdModel = new Matrix<double>(1, 13 * 5))
using (Matrix<double> fgdModel = new Matrix<double>(1, 13 * 5))
{
CvInvoke.GrabCut(original, mask1, new Rectangle(0, 0, original.Width, original.Height), bgdModel, fgdModel, 1, Emgu.CV.CvEnum.GrabcutInitType.InitWithRect);
CvInvoke.GrabCut(original, mask1, rect, bgdModel, fgdModel, 2, Emgu.CV.CvEnum.GrabcutInitType.Eval);
}
Now the next part is that, I want to create a Interactive touch but I cannot find any references to use the Grabcut method with mask in c#. Can any one please help me out.
Thanks,
Indra
What I have tried:
I was able to succeed in drawing the mask area and then passing the mask into below section but it is not working.
using (Matrix<double> bgdModel = new Matrix<double>(1, 13 * 5))
using (Matrix<double> fgdModel = new Matrix<double>(1, 13 * 5))
{
CvInvoke.GrabCut(original, mask1, new Rectangle(0, 0, original.Width, original.Height), bgdModel, fgdModel, 1, Emgu.CV.CvEnum.GrabcutInitType.InitWithRectMask);
CvInvoke.GrabCut(original, mask1, rect, bgdModel, fgdModel, 2, Emgu.CV.CvEnum.GrabcutInitType.Eval);
}<pre lang="c#">
I am unable to understand How to pass the selected area in this method.