用法:
skimage.restoration.denoise_bilateral(image, win_size=None, sigma_color=None, sigma_spatial=1, bins=10000, mode='constant', cval=0, multichannel=False, *, channel_axis=None)
使用雙邊濾波器對圖像進行去噪。
- image:ndarray,形狀(M,N[,3])
輸入圖像,2D 灰度或 RGB。
- win_size:int
過濾的窗口大小。如果未指定win_size,則計算為
max(5, 2 * ceil(3 * sigma_spatial) + 1)
。- sigma_color:浮點數
灰度值/顏色距離的標準偏差(輻射相似度)。較大的值會導致對具有較大輻射差異的像素進行平均。如果
None
,將使用image
的標準偏差。- sigma_spatial:浮點數
距離的標準偏差。較大的值導致具有較大空間差異的像素的平均。
- bins:int
顏色過濾的高斯權重的離散值的數量。較大的值會提高準確性。
- mode:{‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’}
如何處理圖像邊界之外的值。有關詳細信息,請參閱
numpy.pad
- cval:string
與模式‘constant’(圖像邊界外的值)結合使用。
- multichannel:bool
圖像的最後一個軸是否被解釋為多個通道或另一個空間維度。不推薦使用此參數:改為指定 channel_axis。
- channel_axis:int 或無,可選
如果為 None,則假定圖像是灰度(單通道)圖像。否則,此參數指示數組的哪個軸對應於通道。
- denoised:ndarray
去噪圖像。
- multichannel:DEPRECATED
已棄用以支持channel_axis。
參數:
返回:
其他參數:
注意:
這是一個edge-preserving,去噪濾波器。它根據像素的空間接近度和輻射相似度對像素進行平均 [1] 。
空間接近度是通過兩個像素之間的歐幾裏得距離和一定標準偏差(sigma_spatial)的高斯函數來衡量的。
輻射相似度是通過兩個顏色值之間的歐幾裏得距離和某個標準偏差 (sigma_color) 的高斯函數來衡量的。
請注意,如果圖像是任何int數據類型,
image
將使用img_as_float函數和標準差 (sigma_color) 將在範圍內[0, 1]
.有關scikit-image 的數據類型轉換以及如何在這些轉換中重新縮放圖像的更多信息,請參閱:https://scikit-image.org/docs/stable/user_guide/data_types.html.
參考:
- 1
C. Tomasi and R. Manduchi. “Bilateral Filtering for Gray and Color Images.” IEEE International Conference on Computer Vision (1998) 839-846. DOI:10.1109/ICCV.1998.710815
例子:
>>> from skimage import data, img_as_float >>> astro = img_as_float(data.astronaut()) >>> astro = astro[220:300, 220:320] >>> rng = np.random.default_rng() >>> noisy = astro + 0.6 * astro.std() * rng.random(astro.shape) >>> noisy = np.clip(noisy, 0, 1) >>> denoised = denoise_bilateral(noisy, sigma_color=0.05, sigma_spatial=15, ... channel_axis=-1)
相關用法
- Python skimage.restoration.denoise_wavelet用法及代碼示例
- Python skimage.restoration.denoise_tv_chambolle用法及代碼示例
- Python skimage.restoration.denoise_nl_means用法及代碼示例
- 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.richardson_lucy用法及代碼示例
- Python skimage.restoration.calibrate_denoiser用法及代碼示例
- Python skimage.restoration.unsupervised_wiener用法及代碼示例
- Python skimage.restoration.rolling_ball用法及代碼示例
- 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.denoise_bilateral。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。