Correct raise not flat-fields processing

This commit is contained in:
Benjamin Loison 2024-04-16 16:48:00 +02:00
parent 817c016815
commit 8ca1972ddb
No known key found for this signature in database

View File

@ -9,7 +9,7 @@ from tqdm import tqdm
import csv
import rawpy
imagesFolderPath = '/mnt/HDD0/raise/nef'
imagesFolderPath = '/mnt/HDD0/raise'
imagesFolderPathFileName = imagesFolderPath.replace('/', '_')
denoiser = 'wavelet'
npArrayFilePath = f'mean_{imagesFolderPathFileName}_{denoiser}.npy'
@ -19,9 +19,7 @@ denoise = getattr(skimage.restoration, f'denoise_{denoiser}')
mean = None
numberOfImagesInMean = 0
imagesFileNames = os.listdir(imagesFolderPath)
#print(rawpy.imread(f'{imagesFolderPath}/{imagesFileNames[0]}').sizes.raw_height)
#exit(1)
imagesFileNames = os.listdir(imagesFolderPath + '/png')
requiresRaiseFiltering = True
if requiresRaiseFiltering:
@ -30,10 +28,10 @@ if requiresRaiseFiltering:
with open('RAISE_all.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in tqdm(list(reader), 'CSV parsing'):
file = row['File'] + '.NEF'
file = row['File'] + '.png'
files[file] = row
imagesFileNames = [imageFileName for imageFileName in tqdm(imagesFileNames, 'Filtering images') if files[imageFileName]['Device'] == 'Nikon D7000' and [getattr(rawpy.imread(f'{imagesFolderPath}/{imageFileName}').sizes, dimension) for dimension in ['width', 'height']] == [4992, 3280]]
imagesFileNames = [imageFileName for imageFileName in tqdm(imagesFileNames, 'Filtering images') if files[imageFileName]['Device'] == 'Nikon D7000' and Image.open(f'{imagesFolderPath}/png/{imageFileName}').size == (4946, 3278)]
#imagesFileNames = [f'DSC0{imageIndex}.ARW' for imageIndex in range(2807, 2911)]
minColor = None
@ -41,6 +39,7 @@ maxColor = None
def treatImage(imageFileName, computeExtremes = False):
global mean, numberOfImagesInMean, minColor, maxColor
imageFileName = imageFileName.replace('.png', '.NEF')
imageFilePath = f'{imagesFolderPath}/nef/{imageFileName}'
if imageFileName.endswith('.NEF') or imageFileName.endswith('.ARW'):
with rawpy.imread(imageFilePath) as raw: