Add easy support for single or multiple colors

This commit is contained in:
Benjamin Loison 2024-04-18 00:35:02 +02:00
parent cca81927dd
commit be5952bbc7
No known key found for this signature in database

View File

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