diff --git a/datasets/raise/extract_noise.py b/datasets/raise/extract_noise.py index 4cb5824..287ff4c 100755 --- a/datasets/raise/extract_noise.py +++ b/datasets/raise/extract_noise.py @@ -136,6 +136,10 @@ if minColor is None or maxColor is None: print(f'{minColor=}') print(f'{maxColor=}') +def saveNpArray(fileName, npArray): + with open(f'{fileName}.npy', 'wb') as f: + np.save(f, npArray) + if denoiser == 'mean': means = {} for color in Color: @@ -157,6 +161,5 @@ for color in colors: for imageFileName in tqdm(imagesFileNames, f'Denoising images for color {color}'): treatImage(imageFileName, color = color) - npArrayFilePath = f'mean_{imagesFolderPathFileName}_{denoiser}_{color}.npy' - with open(npArrayFilePath, 'wb') as f: - np.save(f, mean) + npArrayFilePath = f'mean_{imagesFolderPathFileName}_{denoiser}_{color}' + saveNpArray(npArrayFilePath, mean)