diff --git a/datasets/raise/extract_noise.py b/datasets/raise/extract_noise.py index 5bb0610..c8d4be1 100755 --- a/datasets/raise/extract_noise.py +++ b/datasets/raise/extract_noise.py @@ -6,18 +6,29 @@ import numpy as np from PIL import Image import os from tqdm import tqdm -import gzip +from multiprocessing import Pool imagesFolderPath = 'tif' -npArrayFolderPath = 'np' +''' for imageFileName in tqdm(os.listdir(imagesFolderPath)): - npArrayFilePath = f'{npArrayFolderPath}/{imageFileName}.npy.gz' + npArrayFilePath = f'mean.npy' if os.path.isfile(npArrayFilePath): continue imageFilePath = f'{imagesFolderPath}/{imageFileName}' imagePil = Image.open(imageFilePath) imageNpArray = img_as_float(np.array(imagePil)) imageNoiseNpArray = imageNpArray - denoise_tv_chambolle(imageNpArray, weight=0.2, channel_axis=-1) - with gzip.open(npArrayFilePath, 'wb') as f: + with open(npArrayFilePath, 'wb') as f: np.save(f, imageNoiseNpArray) +''' + +import time + +def treatImage(imageFilePath): + while True: + print(imageFilePath) + time.sleep(1) + +with Pool(22) as p: + p.map(treatImage, )