1

I just started to learn Emgu and OpenCV. So it might be a stupid question. When I look at Emgu documentation (see link http://www.emgu.com/wiki/files/3.1.0/document/html/cb24a129-d9ce-57f3-19ad-0eaa27a77317.htm ), I cannot find an example. But I suppose you used it in the form of

CvInvoke.FindContours(...)

But when I searched stackoverflow, I found this person just used the following form in the middle-bottom section of his code enter link description here

grayImage.FindContours()

However, when I tried the later, Visual studio simply doesn't accept it. (ie, when I typed in grayImage.F the pop up simply doesn't have FindContours function).

I am using the latest opencv and emgu. Any ideas?

Community
  • 1
  • 1
wildcolor
  • 564
  • 1
  • 9
  • 23

1 Answers1

3

You are using the latest version.

If you have a quick look in the docs of the versions 2.4 , 3.1 you can see, that the function FindContours() has been removed from the Image Class but is still part of the CvInvoke Class.

If you insist on having the seen syntax you can add your own Extension:

 public static class Extension
{
    public static VectorOfVectorOfPointF FindContour(this UMat img,Mat hierarchy = null, Emgu.CV.CvEnum.RetrType type = Emgu.CV.CvEnum.RetrType.List,Emgu.CV.CvEnum.ChainApproxMethod method = Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxSimple  )
    {
        VectorOfVectorOfPointF contours = new VectorOfVectorOfPointF();
        CvInvoke.FindContours(img, contours, hierarchy, type, method);
        return contours;
    }

}

this is just a sample extension in c# ..

  • 3
    Note that `VectorOfVectorOfPointF ` throws an exception `(mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN (type0) && ((1 << type0) & fixedDepthMask) != 0))` while `VectorOfVectorOfPoint` does not. Though I still have no idea how you make use of this object anyways – Douglas Gaskell Jun 15 '17 at 20:15
  • Any idea why they removed it? – Pedro77 Jul 05 '18 at 02:20