Make denoise arguments depend on denoiser

This commit is contained in:
Benjamin Loison 2024-04-16 03:27:26 +02:00
parent caf7025504
commit 3a4f774e28
No known key found for this signature in database

View File

@ -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