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

问题描述

我在寻找一个OpenCV函数,它可以找到连接的组件并对它们执行一些任务(例如获取像素数,轮廓,对象中的像素列表等)。

I am looking for an OpenCV function that can find connected components and perform a few tasks on them ( like getting the number of pixels, contour, list of pixels in the object etc.. )

是否有类似于MatLab的regionprops的OpenCV(C ++)函数?

Is there a function of OpenCV (C++) that is similar to MatLab's regionprops ?

推荐答案

请查看功能。它非常通用 - 它可以找到内部和外部轮廓,并以各种格式(例如,平面列表与树结构)返回结果。一旦获得轮廓,等功能可用于确定连接的基本属性

Have a look at the cvFindContours function. It's very versatile -- it can find both interior and exterior contours, and return the results in a variety of formats (e.g. flat list vs. tree structure). Once you have the contours, functions like cvContourArea allow you to determine basic properties of the connected component corresponding to a particular contour.

如果你喜欢使用较新的C ++接口(而不是上面介绍的C语言接口),那么函数名称是。

If you prefer to use the newer C++ interface (as opposed to the older C-style interface I described above), then the function names are similar.

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

07-31 06:01