连接的组件标签 [英] Connected Component Labeling
问题描述
在OpenCV 3.0中,有一个名为 connectedComponent 的功能一个>.
In OpenCV 3.0 there is a function called connectedComponent.
我知道它将二进制图像作为输入并返回标签和连接的组件数,但是内部使用什么算法?
I know that it takes as input a binary image and returns the labels and the number of connected components, but what algorithm is used internally?
推荐答案
OpenCV is open source. You can look at the documentation and the source code.
-
CCL_WU :基于
"Two Strategies to Speed up Connected Components Algorithms", the SAUF (Scan array union find) variant using decision trees, Kesheng Wu, et al.
CCL_GRANA :基于
这仅适用于8个连接的组件.
This works only for 8-connected components.
OpenCV中的默认值> = 3.2(CCL_DEFAULT
)使用Wu的算法进行4个连接,而使用Grana的算法进行8个连接.
The default in OpenCV >= 3.2 (CCL_DEFAULT
) uses Wu's algorithm for 4-connectivity, and Grana's algorithm for 8 connectivity.
在OpenCV 3.0.0中,您使用Wu算法进行4和8连接,;而在OpenCV> = 3.2中,您可以根据字段connectivity
和ccltype
:
In OpenCV 3.0.0 you use Wu's algorithm for both 4 and 8 connectivity, while in OpenCV >= 3.2 you can choose one of the 3 options, according to the fields connectivity
and ccltype
:
\ connectivity 4 | 8
\ |
type \ |
|
CCL_DEFAULT Wu | Grana
CCL_WU Wu | Wu
CCL_GRANA Wu | Grana
这篇关于连接的组件标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!