當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python skimage.filters.rank.pop_bilateral用法及代碼示例

用法:

skimage.filters.rank.pop_bilateral(image, footprint, out=None, mask=None, shift_x=False, shift_y=False, s0=10, s1=10)

返回像素的本地數量(人口)。

像素數定義為足跡和掩碼中包含的像素數。此外,像素必須在區間 [g-s0, g+s1] 內具有灰度級,其中 g 是中心像素的灰度值。

參數

image二維數組(uint8,uint16)

輸入圖像。

footprint二維陣列

鄰域表示為 1 和 0 的二維數組。

out二維數組(與輸入相同的 dtype)

如果沒有,則分配一個新數組。

maskndarray

定義包含在本地鄰域中的圖像的 (>0) 區域的掩碼數組。如果沒有,則使用完整的圖像(默認)。

shift_x, shift_yint

添加到封裝中心點的偏移量。 Shift 受限於封裝尺寸(中心必須在給定封裝內)。

s0, s1int

圍繞中心像素的灰度值定義 [s0, s1] 區間,以計算該值。

返回

out二維數組(與輸入圖像相同的 dtype)

輸出圖像。

其他參數

selemDEPRECATED

已棄用以支持足跡。

例子

>>> import numpy as np
>>> from skimage.morphology import square
>>> import skimage.filters.rank as rank
>>> img = 255 * np.array([[0, 0, 0, 0, 0],
...                       [0, 1, 1, 1, 0],
...                       [0, 1, 1, 1, 0],
...                       [0, 1, 1, 1, 0],
...                       [0, 0, 0, 0, 0]], dtype=np.uint16)
>>> rank.pop_bilateral(img, square(3), s0=10, s1=10)
array([[3, 4, 3, 4, 3],
       [4, 4, 6, 4, 4],
       [3, 6, 9, 6, 3],
       [4, 4, 6, 4, 4],
       [3, 4, 3, 4, 3]], dtype=uint16)

相關用法


注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.filters.rank.pop_bilateral。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。