C++ 中的连接组件标签

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

问题描述

我需要在 C++ 应用程序中的图像上使用 连接组件标签 算法.我可以自己实现,但我试图使用 Boost 的 union-find/disjoint sets 实现,因为它在 union-find 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 文档中的示例对我来说没有任何意义.当我有图像时,我是否需要这些示例中所有额外的 Graph mumbo-jumbo?或者,是否已经有 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++ 中的连接组件标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)