mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 18:25:32 +08:00
TST: update existing tests for wavelet_denoise
This commit is contained in:
@@ -310,16 +310,20 @@ def test_no_denoising_for_small_h():
|
||||
|
||||
|
||||
def test_wavelet_denoising():
|
||||
for img in [astro_gray, astro]:
|
||||
for img, multichannel in [(astro_gray, False), (astro, True)]:
|
||||
noisy = img.copy() + 0.1 * np.random.randn(*(img.shape))
|
||||
noisy = np.clip(noisy, 0, 1)
|
||||
# less energy in signal
|
||||
denoised = restoration.denoise_wavelet(noisy, sigma=0.3)
|
||||
denoised = restoration.denoise_wavelet(noisy, sigma=0.3,
|
||||
multichannel=multichannel)
|
||||
assert denoised.sum()**2 <= img.sum()**2
|
||||
|
||||
# test changing noise_std (higher threshold, so less energy in signal)
|
||||
assert (restoration.denoise_wavelet(noisy, sigma=0.2).sum()**2 <=
|
||||
restoration.denoise_wavelet(noisy, sigma=0.1).sum()**2)
|
||||
res1 = restoration.denoise_wavelet(noisy, sigma=0.2,
|
||||
multichannel=multichannel)
|
||||
res2 = restoration.denoise_wavelet(noisy, sigma=0.1,
|
||||
multichannel=multichannel)
|
||||
assert (res1.sum()**2 <= res2.sum()**2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user