简体   繁体   English

图片 <TColor, TDepth> .EmguCV 3.0中缺少.FindContours

[英]Image<TColor, TDepth>.FindContours missing from EmguCV 3.0

The Image.FindContours method is missing, using the latest 3.0 version of Emgu CV. 使用最新的Emgu CV 3.0版本,缺少Image.FindContours方法。 (i guess that is not the only one) (我想那不是唯一的)

Where can I find them? 在哪里可以找到它们?

Update: 更新:

I want to accomplish the same under C# 我想在C#下完成相同的操作

Mat edges; //from canny
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
findContours(edges, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE);

Yes, you are right - the Image.FindContours() method is missing from the EmguCV 3.0. 是的,您是对的-EmguCV 3.0中缺少Image.FindContours()方法。 And there is a lot of others even has not been wrapped by the new CvInvoke wrapper. 还有许多其他功能甚至还没有被新的CvInvoke包装器包装。

But as for the FindContours particular one you can use the snippet below using CvInvoke static methods wrapper: (suppose imgBinary is the Image object, ) 但是对于特定的FindContours,您可以使用CvInvoke静态方法包装器使用以下代码段:(假设imgBinary是Image对象,)

VectorOfVectorOfPoint contoursDetected = new VectorOfVectorOfPoint();
CvInvoke.FindContours(imgBinary, contoursDetected, null, Emgu.CV.CvEnum.RetrType.List, Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxSimple);

And then you can use the obtained contours "array" for example like this: 然后,您可以使用获得的轮廓“数组”,例如:

contoursArray = new List<VectorOfPoint>();
int count = contoursDetected.Size;
for (int i = 0; i < count; i++)
{
    using (VectorOfPoint currContour = contoursDetected[i])
    {
        contoursArray.Add(currContour);
    }
}

Note that the CvInvoke.FindContours() now doesn't return Seq<Point> or Contour<Point> structures into the contoursDetected but the VectorOfVectorOfPoint which is actually Point[][] . 请注意, CvInvoke.FindContours()现在不会将Seq<Point>Contour<Point>结构返回到VectorOfVectorOfPoint ,但实际上是Point[][]VectorOfVectorOfPoint

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM