opencv - 等效于emgu中的层次结构

标签 opencv image-processing emgucv

我正在将Python OpenCV代码转换为Emgu。
在Python中,函数findContours可以返回hierarchy

hierarchy – Optional output vector, containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i] , the elements hierarchy[i][0] , hiearchy[i][1] , hiearchy[i][2] , and hiearchy[i][3] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.



不幸的是,在Emgu中,我无法为findContours函数返回这样的数组。

最佳答案

如果选择CV_RETR_TREE作为检索类型,则返回的Contour<Point>将包含分层树结构。

这张来自here的图片显示了如何使用OpenCV中的h_nextv_next指针(即Emgu CV中的HNextVNext)在层次结构中进行导航。

这样,您可以获得整个层次结构。

关于opencv - 等效于emgu中的层次结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15555615/

相关文章:

opencv - 当我运行以下代码时,我在内存位置0x003faf00处出现cv::Exception,注意到它完美地运行了一两次

c++ - OpenCV - 查找或访问未被 bg 包围的形状轮廓,仅由轮廓分隔

具有复杂内核的 OpenCV 卷积/filter2d

c++ - 最佳实践,在 Opencv 中检测 Mat 是否为黑白

c# - opencv(emgu)中的模板匹配usink掩码

wpf - 在颜色位置获取深度,Kinect SDK

c - 如何从流中获取视频和音频并输出到视频文件和图像

php - 使用 PHP 的透明圆形裁剪图像

php - 我们如何使用 PHP 代码删除图像白色背景颜色

opencv - Opencv Surf 和 FindExtrinsicCameraParams2