OpenCV 中的 Blob 提取
我正在使用 OpenCV 过滤图像中的某些颜色,因此我得到了检测到的区域的二值图像。
现在我想侵蚀这些区域,然后去掉较小的区域,并找到最大“斑点”的 x,y 坐标,
我一直在寻找关于最好使用什么库的建议?我见过 cvBlob 和 cvBlobsLib 但我不太确定如何设置它们。我想将它们与项目一起编译还是想将它们编译并安装到系统中(就像我对 OpenCV 所做的那样)?
我目前正在 Ubuntu 上使用 Code::Blocks IDE(尽管这不应该限制事情)
I'm using OpenCV to filter an image for certain colours, so I've got a binary image of the detected regions.
Now I want to erode those areas and then get rid of the smaller ones, and find the x,y coordinates of the largest 'blob'
I was looking for recommendations as to what the best library would be to use? I've seen cvBlob and cvBlobsLib but I'm not too sure how to set them up. Do I want to compile them along with the project or do I want to compile and install them to the system (like I did with OpenCV)?
I'm currently using the Code::Blocks IDE on Ubuntu (although that shouldn't restrict things)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我迟到了,但我想插话一下,有一种方法可以在 opencv 中实现连接组件,只是还没有主流化。
更新:它已被主线化,只是多年来一直等待 3.0 的发布。 文档链接
请参阅http://code.opencv.org/issues/1236 和 http://code.opencv.org/attachments/467/opencv-connectedcomponents.patch
免责声明 - 我是作者。
I'm late to the party, but I'd just like to chime in that there is a way to do connected components in opencv, it's just not mainlined yet.
Update: It is mainlined, it's just been stuck waiting for 3.0 to release for multiple years. Linky to documentation
See http://code.opencv.org/issues/1236 and http://code.opencv.org/attachments/467/opencv-connectedcomponents.patch
Disclaimer - I'm the author.
您可以使用 findContours 来执行此操作,请参阅 opencv 手册和教程查找连接的组件。
编辑:教程中的代码(来自 Archive.org)
You can use
findContours
to do that, see the opencv manual and a Tutorial to find connected components.Edit: Code from the tutorial (via Archive.org)
不幸的是,OpenCV 没有任何连接的组件标记功能,这对于计算机视觉库来说似乎是一个严重的遗漏。无论如何,我最近有类似的要求,所以我实现了自己的 CCL 例程 - 上描述了几种不同的算法CCL 维基百科页面,它们的实现都非常简单。
Unfortunately OpenCV doesn't have any connected component labelling functionality, which seems like a serious omission for a computer vision library. Anyway I had a similar requirement recently so I implemented my own CCL routine - there are a couple of different algorithms described on the CCL Wikipedia page and they are both pretty simple to implement.
我认为使用 OpenCV 处理 blob 的最佳且简单的选择是使用 cvBlob 库。它是 OpenCV 的补充库,非常易于使用。
I think the best and easy option to work with blobs with OpenCV is to use cvBlob library. Its a complemntary library with OpenCV a its so easy to use.