From 3a4f774e282c9ef38374dc820193c98bde18e954 Mon Sep 17 00:00:00 2001 From: Benjamin Loison <12752145+Benjamin-Loison@users.noreply.github.com> Date: Tue, 16 Apr 2024 03:27:26 +0200 Subject: [PATCH] Make `denoise` arguments depend on `denoiser` --- datasets/raise/extract_noise.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/datasets/raise/extract_noise.py b/datasets/raise/extract_noise.py index 3b330c2..74eaeaf 100755 --- a/datasets/raise/extract_noise.py +++ b/datasets/raise/extract_noise.py @@ -60,8 +60,14 @@ def treatImage(imageFileName, computeExtremes = False): else: imagePil = Image.open(imageFilePath) imageNpArray = img_as_float(np.array(imagePil)) - # As the arguments differ from a denoiser to the other should use a match instead. - imageDenoisedNpArray = denoise(imageNpArray, rescale_sigma=True) + # Could make not `.nef` compatible. + match denoiser: + case 'wavelet': + imageDenoisedNpArray = denoise(imageNpArray, rescale_sigma=True) + case 'bilateral': + imageDenoisedNpArray = denoise(imageNpArray, sigma_color=0.05, sigma_spatial=15) + case 'tv_chambolle': + imageDenoisedNpArray = denoise(imageNpArray, weight=0.2) imageNoiseNpArray = imageNpArray - imageDenoisedNpArray if mean is None: mean = imageNoiseNpArray