diff --git a/datasets/raise/benchmark_load_part_of_images.py b/datasets/raise/benchmark_load_part_of_images.py index 5105afa..d4e8c37 100755 --- a/datasets/raise/benchmark_load_part_of_images.py +++ b/datasets/raise/benchmark_load_part_of_images.py @@ -18,24 +18,26 @@ class Operation(Enum): OPERATION = Operation.LOAD_RAW RESOLUTION = 100 +print(f'{OPERATION = }') +if OPERATION == Operation.LOAD_NPY: + print(f'{RESOLUTION = }') for camera in tqdm(IMAGES_CAMERAS_FOLDER, 'Camera'): imagesCameraFolder = IMAGES_CAMERAS_FOLDER[camera] for file in tqdm(os.listdir(imagesCameraFolder), 'Image'): - if file.endswith('.NEF'): + if file.endswith('.NEF') or file.endswith('.ARW'): #print(file) imageFilePath = f'{imagesCameraFolder}/{file}' numpyFilePath = f'{imageFilePath}.npy' - for color in Color: - if OPERATION in [Operation.LOAD_RAW, Operation.SAVE]: + rawColorChannels = {} + if OPERATION in [Operation.LOAD_RAW, Operation.SAVE]: + for color in Color: rawColorChannel = getColorChannel(imageFilePath, color) - if OPERATION == Operation.SAVE: - np.save(numpyFilePath, {color: rawColorChannel}) - if OPERATION == Operation.LOAD_NPY: - rawColorChannel = np.load(numpyFilePath, allow_pickle = True) - #print(type(rawColorChannel)) - #print(rawColorChannel) - #print(rawColorChannel.shape) - print(rawColorChannel.item()[color].mean()) - break - break \ No newline at end of file + rawColorChannels[color] = rawColorChannel + if OPERATION == Operation.SAVE: + np.save(numpyFilePath, rawColorChannels) + if OPERATION == Operation.LOAD_NPY: + rawColorChannels = np.load(numpyFilePath, allow_pickle = True) + rawColorChannelsItem = rawColorChannels.item() + for color in Color: + print(color, rawColorChannelsItem[color].mean()) \ No newline at end of file