用法:
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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。