备注
单击 here 下载完整的示例代码或通过活页夹在浏览器中运行此示例
图像反褶积¶
在这个例子中,我们使用维纳和无监督维纳算法对噪声图像进行去卷积。这种算法基于线性模型,不能像非线性方法(如电视恢复)那样恢复锐利的边缘,但速度要快得多。
维纳过滤¶
基于PSF(点扩展函数)、先验正则化(高频的惩罚)以及数据和先验充分性之间的权衡的逆滤波。正则化参数必须手动调整。
无人监督的维纳¶
该算法具有基于数据学习的自调整正则化参数。这并不常见,并基于以下出版物 1. 该算法基于迭代Gibbs采样器,该采样器交替地提取图像的后验条件律、噪声功率和图像频率功率的样本。
- 1
François Orieux、Jean-François Giovannelli和Thomas Rodet,“Wiener-Hunt反卷积的正则化和点扩展函数参数的贝叶斯估计”,J.Opt。SoC。上午好。A 27,1593-1607(2010)

import numpy as np
import matplotlib.pyplot as plt
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()
脚本的总运行时间: (0分0.586秒)