mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-02 03:00:05 +08:00
Update denoising example for new TV implementation
This commit is contained in:
@@ -32,7 +32,7 @@ import matplotlib.pyplot as plt
|
||||
from skimage import data, color, img_as_float
|
||||
from skimage.filter import denoise_tv, denoise_bilateral
|
||||
|
||||
lena = img_as_float(data.lena())
|
||||
lena = color.rgb2gray(img_as_float(data.lena()))
|
||||
lena = lena[220:300, 220:320]
|
||||
|
||||
noisy = lena + 0.5 * lena.std() * np.random.random(lena.shape)
|
||||
@@ -40,17 +40,19 @@ noisy = np.clip(noisy, 0, 1)
|
||||
|
||||
fig, ax = plt.subplots(nrows=2, ncols=3, figsize=(8, 5))
|
||||
|
||||
plt.gray()
|
||||
|
||||
ax[0, 0].imshow(noisy)
|
||||
ax[0, 0].axis('off')
|
||||
ax[0, 0].set_title('noisy')
|
||||
ax[0, 1].imshow(denoise_tv(noisy, weight=0.1))
|
||||
ax[0, 1].imshow(denoise_tv(noisy, weight=40))
|
||||
ax[0, 1].axis('off')
|
||||
ax[0, 1].set_title('TV')
|
||||
ax[0, 2].imshow(denoise_bilateral(noisy, sigma_range=0.03, sigma_spatial=15))
|
||||
ax[0, 2].axis('off')
|
||||
ax[0, 2].set_title('Bilateral')
|
||||
|
||||
ax[1, 0].imshow(denoise_tv(noisy, weight=0.2))
|
||||
ax[1, 0].imshow(denoise_tv(noisy, weight=20))
|
||||
ax[1, 0].axis('off')
|
||||
ax[1, 0].set_title('(more) TV')
|
||||
ax[1, 1].imshow(denoise_bilateral(noisy, sigma_range=0.06, sigma_spatial=15))
|
||||
|
||||
Reference in New Issue
Block a user