Add and use raiseNotFlatFields

This commit is contained in:
Benjamin Loison 2024-04-17 14:10:11 +02:00
parent a6ef3977dd
commit e080e841f5
No known key found for this signature in database

View File

@ -14,15 +14,16 @@ imagesFolderPathFileName = imagesFolderPath.replace('/', '_')
denoiser = 'wavelet'
npArrayFilePath = f'mean_{imagesFolderPathFileName}_{denoiser}.npy'
raiseNotFlatFields = False
denoise = getattr(skimage.restoration, f'denoise_{denoiser}')
mean = None
numberOfImagesInMean = 0
imagesFileNames = os.listdir(imagesFolderPath + '/png')
imagesFileNames = os.listdir(imagesFolderPath + ('/png' if raiseNotFlatFields else ''))
requiresRaiseFiltering = True
if requiresRaiseFiltering:
if raiseNotFlatFields:
files = {}
with open('RAISE_all.csv') as csvfile:
@ -39,8 +40,11 @@ maxColor = None
def treatImage(imageFileName, computeExtremes = False):
global mean, numberOfImagesInMean, minColor, maxColor
imageFileName = imageFileName.replace('.png', '.NEF')
imageFilePath = f'{imagesFolderPath}/nef/{imageFileName}'
if raiseNotFlatFields:
imageFileName = imageFileName.replace('.png', '.NEF')
imageFilePath = f'{imagesFolderPath}/nef/{imageFileName}'
else:
imageFilePath = f'{imagesFolderPath}/{imageFileName}'
if imageFileName.endswith('.NEF') or imageFileName.endswith('.ARW'):
with rawpy.imread(imageFilePath) as raw:
colorDesc = raw.color_desc.decode('ascii')