用法:
skimage.segmentation.clear_border(labels, buffer_size=0, bgval=0, in_place=False, mask=None, *, out=None)
清除连接到标签图像边框的对象。
- labels:(M[, N[, ..., P]]) int 或 bool 的数组
成像数据标签。
- buffer_size:int 可选
检查的边框宽度。默认情况下,仅删除与图像外部接触的对象。
- bgval:浮点数或 int 可选
清除的对象设置为此值。
- in_place:布尔型,可选
是否就地操作标签数组。自 0.19 版起已弃用。请改用 out。
- mask:bool的ndarray,形状相同图片, 可选的。
图像数据掩码。标签图像中与掩码的假像素重叠的对象将被删除。如果定义,参数buffer_size 将被忽略。
- out:ndarray
与标签形状相同的数组,其中放置输出。默认情况下,会创建一个新数组。
- out:(M[, N[, ..., P]]) 数组
具有清晰边界的成像数据标签
参数:
返回:
例子:
>>> import numpy as np >>> from skimage.segmentation import clear_border >>> labels = np.array([[0, 0, 0, 0, 0, 0, 0, 1, 0], ... [1, 1, 0, 0, 1, 0, 0, 1, 0], ... [1, 1, 0, 1, 0, 1, 0, 0, 0], ... [0, 0, 0, 1, 1, 1, 1, 0, 0], ... [0, 1, 1, 1, 1, 1, 1, 1, 0], ... [0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> clear_border(labels) array([[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> mask = np.array([[0, 0, 1, 1, 1, 1, 1, 1, 1], ... [0, 0, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1]]).astype(bool) >>> clear_border(labels, mask=mask) array([[0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]])
相关用法
- Python skimage.segmentation.active_contour用法及代码示例
- Python skimage.segmentation.relabel_sequential用法及代码示例
- Python skimage.segmentation.flood_fill用法及代码示例
- Python skimage.segmentation.felzenszwalb用法及代码示例
- Python skimage.segmentation.watershed用法及代码示例
- Python skimage.segmentation.expand_labels用法及代码示例
- Python skimage.segmentation.find_boundaries用法及代码示例
- Python skimage.segmentation.random_walker用法及代码示例
- Python skimage.segmentation.slic用法及代码示例
- Python skimage.segmentation.flood用法及代码示例
- Python skimage.segmentation.join_segmentations用法及代码示例
- Python skimage.feature.graycomatrix用法及代码示例
- Python skimage.color.lab2lch用法及代码示例
- Python skimage.draw.random_shapes用法及代码示例
- Python skimage.feature.blob_doh用法及代码示例
- Python skimage.feature.blob_dog用法及代码示例
- Python skimage.filters.unsharp_mask用法及代码示例
- Python skimage.registration.optical_flow_tvl1用法及代码示例
- Python skimage.filters.rank.noise_filter用法及代码示例
- Python skimage.exposure.histogram用法及代码示例
注:本文由纯净天空筛选整理自scikit-image.org大神的英文原创作品 skimage.segmentation.clear_border。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。