rank_order
-
skimage.filters.rank_order(image)
[source] -
Return an image of the same shape where each pixel is the index of the pixel value in the ascending order of the unique values of
image
, aka the rank-order value.Parameters: image: ndarray
Returns: labels: ndarray of type np.uint32, of shape image.shape
New array where each pixel has the rank-order value of the corresponding pixel in
image
. Pixel values are between 0 and n - 1, where n is the number of distinct unique values inimage
.original_values: 1-D ndarray
Unique original values of
image
Examples
123456789101112>>> 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
]))
Please login to continue.