c# - EmguCV 3.0 中缺少 Image<TColor, TDepth>.FindContours

标签 c# emgucv

缺少Image.FindContours方法,使用最新的3.0版Emgu CV。 (我想这不是唯一的)

我在哪里可以找到它们?

更新:

我想在 C# 下完成同样的事情

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

最佳答案

是的,您是对的 - EmguCV 3.0 中缺少 Image.FindContours() 方法。还有很多其他的甚至还没有被新的包装 CvInvoke 包装器。

但是对于特定的 FindContours,您可以使用下面的代码片段使用 CvInvoke 静态方法包装器: (假设 imgBinary 是 Image 对象,)

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

然后你可以像这样使用获得的轮廓“数组”:

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

请注意 CvInvoke.FindContours() 现在不返回 Seq<Point>Contour<Point>检测到轮廓中的结构,但 VectorOfVectorOfPoint这实际上是 Point[][] .

关于c# - EmguCV 3.0 中缺少 Image<TColor, TDepth>.FindContours,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31583946/

相关文章:

c# - 如何使用 C# 从 NetSuite 中的 FileCabinet 下载文件

c# - 如何在 XSockets 中使用 C# 客户端 API 获取/设置属性

c# - EmguCV Blob 计数器

c# - 在 CSharpScript 的脚本类中访问全局变量

c# - 如何修复测试名称的无效 ReSharper View ?

c# - EmguCV 64 位构建运行时错误

c# - emguCV 3.1 - 人脸检测

c# - 如何在 EmguCV 中使用 C# 中的迭代器?

c# - 绑定(bind)到数据库的枚举

c# - 使用 OpenCV/EmguCV 提高人脸检测性能