Add deconvolution module to skimage.

This module add three function to skimage. The `wiener` function is a
simple wiener deconvolution. The `unsupervised_wiener` is a more
sophisticated wiener deconvolution with automatic estimation of
regularisation parameters. The third function is a literal traduction
in python of the rychardson lucy deconvolution of wikipedia.
This commit is contained in:
François Orieux
2013-12-10 22:45:07 +01:00
parent 0d5b822110
commit 33aedfd9aa
8 changed files with 922 additions and 0 deletions
@@ -0,0 +1,38 @@
import warnings
import numpy as np
import numpy.testing.assert_array_almost_equal
from scipy.signal import convolve2d as conv2
from skimage import data, deconvolution
# Test deconvolution
# ===========================
test_img = data.camera().astype(np.float)
def test_wiener():
psf = np.ones((5, 5))
data = conv2(test_img, psf, 'same')
np.random.seed(0)
data += 0.1 * data.std() * np.random.standard_normal(data.shape)
deconvolued = deconvolution.wiener(data, psf, 25)
numpy.testing.assert_array_almost_equal(deconvolued,
np.load("./camera_wiener.npy"))
def test_unsupervised_wiener():
psf = np.ones((5, 5))
data = conv2(test_img, psf, 'same')
np.random.seed(0)
data += 0.1 * data.std() * np.random.standard_normal(data.shape)
deconvolued, _ = deconvolution.unsupervised_wiener(data, psf)
numpy.testing.assert_array_almost_equal(deconvolued,
np.load("./camera_unsup.npy"))
def test_rychardson_lucy():
return True