mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-09 04:00:55 +08:00
Add tests, coverage improvement.
This commit is contained in:
@@ -6,6 +6,7 @@ from scipy.signal import convolve2d
|
||||
import skimage
|
||||
from skimage.data import camera
|
||||
from skimage import restoration
|
||||
from skimage.restoration import uft
|
||||
|
||||
test_img = skimage.img_as_float(camera())
|
||||
|
||||
@@ -20,6 +21,13 @@ def test_wiener():
|
||||
path = pjoin(dirname(abspath(__file__)), 'camera_wiener.npy')
|
||||
np.testing.assert_allclose(deconvolved, np.load(path), rtol=1e-3)
|
||||
|
||||
_, laplacian = uft.laplacian(2, data.shape)
|
||||
otf = uft.ir2tf(psf, data.shape, is_real=False)
|
||||
deconvolved = restoration.wiener(data, otf, 0.05,
|
||||
reg=laplacian,
|
||||
is_real=False)
|
||||
np.testing.assert_allclose(deconvolved, np.load(path))
|
||||
|
||||
|
||||
def test_unsupervised_wiener():
|
||||
psf = np.ones((5, 5)) / 25
|
||||
@@ -31,6 +39,15 @@ def test_unsupervised_wiener():
|
||||
path = pjoin(dirname(abspath(__file__)), 'camera_unsup.npy')
|
||||
np.testing.assert_allclose(deconvolved, np.load(path), rtol=1e-3)
|
||||
|
||||
_, laplacian = uft.laplacian(2, data.shape)
|
||||
otf = uft.ir2tf(psf, data.shape, is_real=False)
|
||||
np.random.seed(0)
|
||||
deconvolved = np.real(restoration.unsupervised_wiener(
|
||||
data, otf, reg=laplacian, is_real=False,
|
||||
user_params={"callback": lambda x: None})[0])
|
||||
path = pjoin(dirname(abspath("./tests/")), 'camera_unsup2.npy')
|
||||
np.testing.assert_allclose(deconvolved, np.load(path))
|
||||
|
||||
|
||||
def test_richardson_lucy():
|
||||
psf = np.ones((5, 5)) / 25
|
||||
|
||||
Reference in New Issue
Block a user