mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-20 12:40:31 +08:00
remove truncate argument from gaussian_filter for scipy<0.14 compatibility
This commit is contained in:
@@ -122,7 +122,6 @@ def structural_similarity(X, Y, win_size=None, gradient=False,
|
||||
K1 = kwargs.pop('K1', 0.01)
|
||||
K2 = kwargs.pop('K2', 0.03)
|
||||
sigma = kwargs.pop('sigma', 1.5)
|
||||
truncate = kwargs.pop('truncate', 3.5)
|
||||
if K1 < 0:
|
||||
raise ValueError("K1 must be positive")
|
||||
if K2 < 0:
|
||||
@@ -150,9 +149,10 @@ def structural_similarity(X, Y, win_size=None, gradient=False,
|
||||
ndim = X.ndim
|
||||
|
||||
if gaussian_weights:
|
||||
# sigma = 1.5, truncate=3.5 to match 11-tap filter in Wang et. al. 2004
|
||||
# sigma = 1.5 to approximately match filter in Wang et. al. 2004
|
||||
# this ends up giving a 13-tap rather than 11-tap Gaussian
|
||||
filter_func = gaussian_filter
|
||||
filter_args = {'sigma': sigma, 'truncate': truncate}
|
||||
filter_args = {'sigma': sigma}
|
||||
|
||||
else:
|
||||
filter_func = uniform_filter
|
||||
|
||||
@@ -17,6 +17,7 @@ cam_noisy = cam_noisy.astype(cam.dtype)
|
||||
|
||||
np.random.seed(1234)
|
||||
|
||||
|
||||
def test_ssim_patch_range():
|
||||
N = 51
|
||||
X = (np.random.rand(N, N) * 255).astype(np.uint8)
|
||||
@@ -146,7 +147,7 @@ def test_gaussian_mssim_vs_IPOL():
|
||||
mssim_IPOL = 0.327309966087341
|
||||
mssim = ssim(cam, cam_noisy, gaussian_weights=True,
|
||||
use_sample_covariance=False)
|
||||
assert_almost_equal(mssim, mssim_IPOL, decimal=5)
|
||||
assert_almost_equal(mssim, mssim_IPOL, decimal=3)
|
||||
|
||||
|
||||
def test_gaussian_mssim_vs_author_ref():
|
||||
@@ -162,7 +163,7 @@ def test_gaussian_mssim_vs_author_ref():
|
||||
mssim_matlab = 0.327314295673357
|
||||
mssim = ssim(cam, cam_noisy, gaussian_weights=True,
|
||||
use_sample_covariance=False)
|
||||
assert_almost_equal(mssim, mssim_matlab, decimal=7)
|
||||
assert_almost_equal(mssim, mssim_matlab, decimal=3)
|
||||
|
||||
|
||||
def test_gaussian_mssim_and_gradient_vs_Matlab():
|
||||
@@ -177,7 +178,7 @@ def test_gaussian_mssim_and_gradient_vs_Matlab():
|
||||
mssim, grad = ssim(cam, cam_noisy, gaussian_weights=True, gradient=True,
|
||||
use_sample_covariance=False)
|
||||
|
||||
assert_almost_equal(mssim, mssim_matlab, decimal=7)
|
||||
assert_almost_equal(mssim, mssim_matlab, decimal=3)
|
||||
|
||||
# check almost equal aside from object borders
|
||||
assert_array_almost_equal(grad_matlab[5:-5], grad[5:-5])
|
||||
|
||||
Reference in New Issue
Block a user