连接的组件标签 [英] Connected Component Labeling

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

问题描述

在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是开源的.您可以查看文档源代码.

OpenCV is open source. You can look at the documentation and the source code.

您可以选择 2种算法来执行关联的组件标签:

两种加快连接组件算法的策略",SAUF(扫描树联合查找)变体,使用决策树Wu Kesheng等人.

"Two Strategies to Speed up Connected Components Algorithms", the SAUF (Scan array union find) variant using decision trees, Kesheng Wu, et al.

  • CCL_GRANA :基于

    用决策树标记的基于块的优化连接组件标签",Costantino 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中,您可以根据字段connectivityccltype:

    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屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆