mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-12 12:50:49 +08:00
DOC: shows example of wavelet denoising
This commit is contained in:
@@ -29,7 +29,7 @@ import numpy as np
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
from skimage import data, img_as_float
|
from skimage import data, img_as_float
|
||||||
from skimage.restoration import denoise_tv_chambolle, denoise_bilateral
|
from skimage.restoration import denoise_tv_chambolle, denoise_bilateral, denoise_wavelet
|
||||||
|
|
||||||
|
|
||||||
astro = img_as_float(data.astronaut())
|
astro = img_as_float(data.astronaut())
|
||||||
@@ -38,7 +38,7 @@ astro = astro[220:300, 220:320]
|
|||||||
noisy = astro + 0.6 * astro.std() * np.random.random(astro.shape)
|
noisy = astro + 0.6 * astro.std() * np.random.random(astro.shape)
|
||||||
noisy = np.clip(noisy, 0, 1)
|
noisy = np.clip(noisy, 0, 1)
|
||||||
|
|
||||||
fig, ax = plt.subplots(nrows=2, ncols=3, figsize=(8, 5), sharex=True,
|
fig, ax = plt.subplots(nrows=2, ncols=4, figsize=(8, 5), sharex=True,
|
||||||
sharey=True, subplot_kw={'adjustable': 'box-forced'})
|
sharey=True, subplot_kw={'adjustable': 'box-forced'})
|
||||||
|
|
||||||
plt.gray()
|
plt.gray()
|
||||||
@@ -52,16 +52,22 @@ ax[0, 1].set_title('TV')
|
|||||||
ax[0, 2].imshow(denoise_bilateral(noisy, sigma_color=0.05, sigma_spatial=15))
|
ax[0, 2].imshow(denoise_bilateral(noisy, sigma_color=0.05, sigma_spatial=15))
|
||||||
ax[0, 2].axis('off')
|
ax[0, 2].axis('off')
|
||||||
ax[0, 2].set_title('Bilateral')
|
ax[0, 2].set_title('Bilateral')
|
||||||
|
ax[0, 3].imshow(denoise_wavelet(noisy, sigma=0.4*astro.std()))
|
||||||
|
ax[0, 3].axis('off')
|
||||||
|
ax[0, 3].set_title('Wavelet')
|
||||||
|
|
||||||
ax[1, 0].imshow(denoise_tv_chambolle(noisy, weight=0.2, multichannel=True))
|
ax[1, 1].imshow(denoise_tv_chambolle(noisy, weight=0.2, multichannel=True))
|
||||||
ax[1, 0].axis('off')
|
|
||||||
ax[1, 0].set_title('(more) TV')
|
|
||||||
ax[1, 1].imshow(denoise_bilateral(noisy, sigma_color=0.1, sigma_spatial=15))
|
|
||||||
ax[1, 1].axis('off')
|
ax[1, 1].axis('off')
|
||||||
ax[1, 1].set_title('(more) Bilateral')
|
ax[1, 1].set_title('(more) TV')
|
||||||
ax[1, 2].imshow(astro)
|
ax[1, 2].imshow(denoise_bilateral(noisy, sigma_color=0.1, sigma_spatial=15))
|
||||||
ax[1, 2].axis('off')
|
ax[1, 2].axis('off')
|
||||||
ax[1, 2].set_title('original')
|
ax[1, 2].set_title('(more) Bilateral')
|
||||||
|
ax[1, 3].imshow(denoise_wavelet(noisy, sigma=0.6*astro.std()))
|
||||||
|
ax[1, 3].axis('off')
|
||||||
|
ax[1, 3].set_title('(more) Wavelet')
|
||||||
|
ax[1, 0].imshow(astro)
|
||||||
|
ax[1, 0].axis('off')
|
||||||
|
ax[1, 0].set_title('original')
|
||||||
|
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user