用法:
skimage.restoration.denoise_tv_chambolle(image, weight=0.1, eps=0.0002, max_num_iter=200, multichannel=False, *, channel_axis=None)
對 n 維圖像執行 total-variation 去噪。
- image:整數、單位或浮點數的 ndarray
輸入要降噪的數據。 image 可以是任何數字類型,但它被轉換為浮點數的 ndarray 以計算去噪圖像。
- weight:浮點數,可選
去噪權重。權重越大,去噪越多(以犧牲輸入的保真度為代價)。
- eps:浮點數,可選
確定停止標準的成本函數值的相對差異。算法在以下情況下停止:
(E_(n-1) - E_n) < 每股收益 * E_0
- max_num_iter:int 可選
用於優化的最大迭代次數。
- multichannel:布爾型,可選
對每個通道分別應用total-variation 去噪。這個選項應該適用於彩色圖像,否則去噪也適用於通道維度。此參數已棄用:改為指定 channel_axis。
- channel_axis:int 或無,可選
如果為 None,則假定圖像是灰度(單通道)圖像。否則,此參數指示數組的哪個軸對應於通道。
- out:ndarray
去噪圖像。
- multichannel:DEPRECATED
已棄用以支持channel_axis。
- n_iter_max:DEPRECATED
已棄用以支持max_num_iter。
參數:
返回:
其他參數:
注意:
確保為彩色圖像設置適當的多通道參數。
全變差去噪的原理在https://en.wikipedia.org/wiki/Total_variation_denoising
全變差去噪的原理是使圖像的總變差最小化,可以粗略地說明為圖像梯度範數的積分。全變差去噪傾向於產生“cartoon-like”圖像,即piecewise-constant圖像。
此代碼是 Chambolle 在[1] 中提出的 Rudin、Fatemi 和 Osher 算法的實現。
參考:
- 1
A. Chambolle, An algorithm for total variation minimization and applications, Journal of Mathematical Imaging and Vision, Springer, 2004, 20, 89-97.
例子:
宇航員圖像上的 2D 示例:
>>> from skimage import color, data >>> img = color.rgb2gray(data.astronaut())[:50, :50] >>> rng = np.random.default_rng() >>> img += 0.5 * img.std() * rng.standard_normal(img.shape) >>> denoised_img = denoise_tv_chambolle(img, weight=60)
合成數據的 3D 示例:
>>> x, y, z = np.ogrid[0:20, 0:20, 0:20] >>> mask = (x - 22)**2 + (y - 20)**2 + (z - 17)**2 < 8**2 >>> mask = mask.astype(float) >>> rng = np.random.default_rng() >>> mask += 0.2 * rng.standard_normal(mask.shape) >>> res = denoise_tv_chambolle(mask, weight=100)
相關用法
- Python skimage.restoration.denoise_wavelet用法及代碼示例
- Python skimage.restoration.denoise_bilateral用法及代碼示例
- 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_tv_chambolle。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。