python skimage.measure.label标记不同连通域

本文介绍了如何使用skimage.measure.label函数在Python中对图像进行连通域标记,演示了如何定义背景、选择连接方式,并通过实例展示了如何处理不同类型的输入数据。此功能对于图像处理和分析至关重要,例如在计算机视觉和机器学习任务中区分不同的对象区域。

python 的skimage库中的measure.label可用于标记不同连通域,从而方便图像分析

skimage.measure.label(label_image, background=None, return_num=False, connectivity=None)

源码如下:

@deprecate_kwarg({
   
   "input": "label_image"}, removed_version="1.0")
def label(label_image, background=None, return_num=False, connectivity=None):
    r"""Label connected regions of an integer array.
    Two pixels are connected when they are neighbors and have the same value.
    In 2D, they can be neighbors either in a 1- or 2-connected sense.
    The value refers to the maximum number of orthogonal hops to consider a
    pixel/voxel a neighbor::
      1-connectivity     2-connectivity     diagonal connection close-up
           [ ]           [ ]  [ ]  [ ]             [ ]
            |               \  |  /                 |  <- hop 2
      [ ]--[x]--[ ]      [ ]--[x]--[ ]        [x]--[ ]
            |               /  |  \             hop 1
           [ ]           [ ]  [ ]  [ ]
    Parameters
    ----------
    label_image : ndarray of dtype int
        Image to label.
    background : int, optional
        Consider all pixels with this value as background pixels, and label
    
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值