From faaf3eb263688790125ef418d96abba42cbba252 Mon Sep 17 00:00:00 2001 From: Benjamin Loison <12752145+Benjamin-Loison@users.noreply.github.com> Date: Thu, 18 Apr 2024 00:35:34 +0200 Subject: [PATCH] Ease support for single or multiple colors --- datasets/raise/extract_noise.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/datasets/raise/extract_noise.py b/datasets/raise/extract_noise.py index 824abd6..74fa4d3 100755 --- a/datasets/raise/extract_noise.py +++ b/datasets/raise/extract_noise.py @@ -10,11 +10,14 @@ import csv import rawpy from utils import Color -imagesFolderPath = '/mnt/HDD0/raise' +imagesFolderPath = 'rafael/arw' imagesFolderPathFileName = imagesFolderPath.replace('/', '_') -denoiser = 'wavelet' +denoiser = 'bilateral' raiseNotFlatFields = False +singleColorChannel = Color.GREEN_RIGHT + +colors = Color if singleColorChannel is None else [singleColorChannel] denoise = getattr(skimage.restoration, f'denoise_{denoiser}') @@ -33,7 +36,7 @@ if raiseNotFlatFields: SKY = range(2_699, 2_807) WALL = range(2_807, 2_912) -#imagesFileNames = [f'DSC0{imageIndex}.ARW' for imageIndex in SKY] +imagesFileNames = [f'DSC0{imageIndex}.ARW' for imageIndex in SKY] minColor = None maxColor = None @@ -102,7 +105,7 @@ def treatImage(imageFileName, computeExtremes = False, color = None): # Assuming same intensity scale across color channels. for imageFileName in tqdm(imagesFileNames, 'Computing extremes of images'): - for color in Color: + for color in colors: treatImage(imageFileName, computeExtremes = True, color = color) # To skip this step next time. @@ -110,7 +113,7 @@ for imageFileName in tqdm(imagesFileNames, 'Computing extremes of images'): print(f'{minColor=}') print(f'{maxColor=}') -for color in Color: +for color in colors: mean = None numberOfImagesInMean = 0