图像反褶积

在本例中,我们使用Richardson-Lucy去卷积算法对图像进行去卷积 (1, 2) 。

该算法基于点扩展函数,其中点扩展函数被描述为光学系统的脉冲响应。模糊的图像通过多次迭代进行锐化,需要手动调整。

1

威廉·哈德利·理查森,《基于贝叶斯的迭代图像复原方法》,J.Opt。SoC。上午好。A 27,1593-1607(1972), DOI:10.1364/JOSA.62.000055

2

https://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution

Original Data, Noisy data, Restoration using Richardson-Lucy

输出:

/scikit-image/doc/examples/filters/plot_deconvolution.py:35: FutureWarning:

`iterations` is a deprecated argument name for `richardson_lucy`. It will be removed in version 1.0. Please use `num_iter` instead.

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=(8, 5))
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()

脚本的总运行时间: (0分0.721秒)

Gallery generated by Sphinx-Gallery