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


Python skimage.filters.rank_order用法及代码示例


用法:

skimage.filters.rank_order(image)

返回相同形状的图像,其中每个像素是像素值的索引,按 image 的唯一值的升序排列,也就是 rank-order 值。

参数

imagendarray

返回

labelsnp.uint32 类型的 ndarray,形状为 image.shape

新数组,其中每个像素具有 image 中相应像素的 rank-order 值。像素值介于 0 和 n - 1 之间,其中 n 是 image 中不同唯一值的数量。

original_values一维ndarray

image 的唯一原始值

例子

>>> a = np.array([[1, 4, 5], [4, 4, 1], [5, 1, 1]])
>>> a
array([[1, 4, 5],
       [4, 4, 1],
       [5, 1, 1]])
>>> rank_order(a)
(array([[0, 1, 2],
       [1, 1, 0],
       [2, 0, 0]], dtype=uint32), array([1, 4, 5]))
>>> b = np.array([-1., 2.5, 3.1, 2.5])
>>> rank_order(b)
(array([0, 1, 2, 1], dtype=uint32), array([-1. ,  2.5,  3.1]))

相关用法


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