在C ++中连接组件标签 [英] Connected Component Labeling in C++

查看:224
本文介绍了在C ++中连接组件标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在C ++应用程式中的图片上使用连结元件标记演算法。我可以自己实现,但我试图使用Boost的联盟 - 发现/不相交集实施,因为它已在联合查找 wiki中提及文章。

I need to use the connected component labeling algorithm on an image in a C++ application. I can implement that myself, but I was trying to use Boost's union-find/disjoint sets implementation since it was mentioned in the union-find wiki article.

我不知道如何创建disjoint_sets对象,因此它将使用我有(无符号短片)的图像数据。我缺少什么? Boost文档中的示例对我没有任何意义。当我有一个图像时,我需要所有额外的图表mumbo-jumbo在这些例子吗? OR,是否已经有一个OpenCV连接的组件标号实现。目前我们使用OpenCV 1.1pre1和Boost 1.37。

I can't figure out how to create the disjoint_sets object so that it'll work with the image data I have (unsigned shorts). What am I missing? The examples in the Boost documentation aren't making any sense to me. Do I need all the extra Graph mumbo-jumbo in those examples when I have an image? OR, is there already an OpenCV connected component labeling implementation. Currently we're using OpenCV 1.1pre1 and Boost 1.37.

推荐答案

令人惊讶的是,OpenCV中没有CCL。但是,有一个解决方法,在参考手册中描述。请参见 cvDrawContours示例。当我试图使用它,我对图像的第一行和最后一行和列有一些奇怪的行为,但我可能做错了。

Surprisingly, there is no CCL in OpenCV. However, there is a workaround that is described in the reference manual. See the example for cvDrawContours. When I tried to use it, I had some strange behaviour on first and last rows and columns of an image, but I probably did something wrong.

另一种方法是请使用 cvBlobs 库。

An alternative way is to use cvBlobs library.

这篇关于在C ++中连接组件标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆