赞
踩
基于PSF(点扩散函数)的逆滤波器,先前的正则化(高频惩罚)以及数据与先前充分性之间的权衡。 必须手动调整正则化参数。
在此示例中,我们使用Wiener和无监督的Wiener算法对图像的噪声版本进行去卷积。 该算法基于线性模型,不能像非线性方法(如电视恢复)那样恢复锐边,但速度要快得多。
import numpy as np import matplotlib.pyplot as plt %matplotlib inline from skimage import color, data, restoration astro = color.rgb2gray(data.astronaut()) from scipy.signal import convolve2d as conv2 psf = np.ones((5, 5)) / 25 astro = conv2(astro, psf, 'same') astro += 0.1 * astro.std() * np.random.standard_normal(astro.shape) deconvolved, _ = restoration.unsupervised_wiener(astro, psf) fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(8, 5), sharex=True, sharey=True) plt.gray() ax[0].imshow(astro, vmin=deconvolved.min(), vmax=deconvolved.max()) ax[0].axis('off') ax[0].set_title('Data') ax[1].imshow(deconvolved) ax[1].axis('off') ax[1].set_title('Self tuned restoration') fig.tight_layout() plt.show()
维纳滤波是频域的图像修复算法,而LR算法是时域的一种图像修复算法。该算法基于PSF(点扩散函数),PSF被描述为光学系统的脉冲响应。 通过多次迭代锐化模糊图像,需要手动调整
import numpy as np import matplotlib.pyplot as plt from scipy.signal import convolve2d as conv2 from skimage import color, data, restoration astro = color.rgb2gray(data.astronaut()) psf = np.ones((5, 5)) / 25 astro = conv2(astro, psf, 'same') # Add Noise to Image astro_noisy = astro.copy() astro_noisy += (np.random.poisson(lam=25, size=astro.shape) - 10) / 255. # Restore Image using Richardson-Lucy algorithm deconvolved_RL = restoration.richardson_lucy(astro_noisy, psf, iterations=30) fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(18, 9)) plt.gray() for a in (ax[0], ax[1], ax[2]): a.axis('off') ax[0].imshow(astro) ax[0].set_title('Original Data') ax[1].imshow(astro_noisy) ax[1].set_title('Noisy data') ax[2].imshow(deconvolved_RL, vmin=astro_noisy.min(), vmax=astro_noisy.max()) ax[2].set_title('Restoration using\nRichardson-Lucy') fig.subplots_adjust(wspace=0.02, hspace=0.2, top=0.9, bottom=0.05, left=0, right=1) plt.show()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。