用法:
skimage.restoration.rolling_ball(image, *, radius=100, kernel=None, nansafe=False, num_threads=None)
通過滾動/平移內核來估計背景強度。
在曝光不均勻的情況下,這種滾球算法會估計 ndimage 的背景強度。它是常用的滾球算法[1]的推廣。
- image:ndarray
要過濾的圖像。
- radius:int 可選
要在圖像中滾動/平移的球形內核的半徑。如果
kernel = None
使用。- kernel:ndarray,可選
要在圖像中滾動/翻譯的內核。它必須具有與
image
相同的維數。內核在該位置填充了內核的強度。- nansafe: bool, optional:
如果
False
(默認)假定image
中的所有值都不是np.nan
,並使用更快的實現。- num_threads: int, optional:
要使用的最大線程數。如果
None
使用OpenMP默認值;通常等於最大虛擬內核數。注意:這是線程數的上限。確切的數字由係統的OpenMP 庫確定。
- background:ndarray
圖像的估計背景。
參數:
返回:
注意:
對於估計了其背景強度的像素(在
center
處不失一般性),滾動球方法將kernel
居中並提升內核直到表麵在某個pos=(y,x)
處接觸圖像本影。然後使用該位置的圖像強度 (image[pos]
) 加上kernel[center] - kernel[pos]
的差異來估計背景強度。該算法假設暗像素對應於背景。如果您有明亮的背景,請在將圖像傳遞給函數之前反轉圖像,例如,使用 utils.invert 有關詳細信息,請參閱圖庫示例。
該算法對噪聲(尤其是椒鹽噪聲)敏感。如果這是您的圖像中的問題,您可以在將圖像傳遞給此函數之前應用溫和的高斯平滑。
參考:
- 1
Sternberg, Stanley R. “Biomedical image processing.” Computer 1 (1983): 22-34. DOI:10.1109/MC.1983.1654163
例子:
>>> import numpy as np >>> from skimage import data >>> from skimage.restoration import rolling_ball >>> image = data.coins() >>> background = rolling_ball(data.coins()) >>> filtered_image = image - background
>>> import numpy as np >>> from skimage import data >>> from skimage.restoration import rolling_ball, ellipsoid_kernel >>> image = data.coins() >>> kernel = ellipsoid_kernel((101, 101), 75) >>> background = rolling_ball(data.coins(), kernel=kernel) >>> filtered_image = image - background
相關用法
- Python skimage.restoration.richardson_lucy用法及代碼示例
- Python skimage.restoration.denoise_wavelet用法及代碼示例
- Python skimage.restoration.wiener用法及代碼示例
- Python skimage.restoration.cycle_spin用法及代碼示例
- Python skimage.restoration.unwrap_phase用法及代碼示例
- Python skimage.restoration.estimate_sigma用法及代碼示例
- Python skimage.restoration.inpaint_biharmonic用法及代碼示例
- Python skimage.restoration.denoise_tv_chambolle用法及代碼示例
- Python skimage.restoration.denoise_bilateral用法及代碼示例
- Python skimage.restoration.calibrate_denoiser用法及代碼示例
- Python skimage.restoration.unsupervised_wiener用法及代碼示例
- Python skimage.restoration.denoise_nl_means用法及代碼示例
- Python skimage.registration.optical_flow_tvl1用法及代碼示例
- Python skimage.registration.optical_flow_ilk用法及代碼示例
- 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用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.restoration.rolling_ball。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。