Connected Component Labeling in 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++ 中的连接组件标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C++ 中的连接组件标签


基础教程推荐
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 设计字符串本地化的最佳方法 2022-01-01
- C++,'if' 表达式中的变量声明 2021-01-01
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01