当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python skimage.filters.rank.otsu用法及代码示例


用法:

skimage.filters.rank.otsu(image, footprint, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False)

每个像素的局部 Otsu 阈值。

参数

image([P,] M, N) ndarray (uint8, uint16)

输入图像。

footprintndarray

邻域表示为 1 和 0 的 ndarray。

out([P,] M, N) 数组(与输入的 dtype 相同)

如果没有,则分配一个新数组。

maskndarray(整数或浮点数),可选

定义包含在本地邻域中的图像的 (>0) 区域的掩码数组。如果没有,则使用完整的图像(默认)。

shift_x, shift_y, shift_zint

添加到封装中心点的偏移量。 Shift 受限于封装尺寸(中心必须在给定封装内)。

返回

out([P,] M, N) ndarray (与输入图像相同的 dtype)

输出图像。

其他参数

selemDEPRECATED

已弃用以支持足迹。

参考

1

https://en.wikipedia.org/wiki/Otsu’s_method

例子

>>> from skimage import data
>>> from skimage.filters.rank import otsu
>>> from skimage.morphology import disk, ball
>>> import numpy as np
>>> img = data.camera()
>>> rng = np.random.default_rng()
>>> volume = rng.integers(0, 255, size=(10,10,10), dtype=np.uint8)
>>> local_otsu = otsu(img, disk(5))
>>> thresh_image = img >= local_otsu
>>> local_otsu_vol = otsu(volume, ball(5))
>>> thresh_image_vol = volume >= local_otsu_vol

相关用法


注:本文由纯净天空筛选整理自scikit-image.org大神的英文原创作品 skimage.filters.rank.otsu。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。