Give a try to get image size with rawpy but it seems far slower

As got:

```
Filtering images:   0%|▏                                                                               | 21/8156 [00:11<1:17:28,  1.75it/s]
```
This commit is contained in:
Benjamin Loison 2024-04-16 04:06:49 +02:00
parent 04e0de4d33
commit 817c016815
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'
imagesFolderPath = '/mnt/HDD0/raise/nef'
imagesFolderPathFileName = imagesFolderPath.replace('/', '_')
denoiser = 'wavelet'
npArrayFilePath = f'mean_{imagesFolderPathFileName}_{denoiser}.npy'
@ -19,7 +19,9 @@ denoise = getattr(skimage.restoration, f'denoise_{denoiser}')
mean = None
numberOfImagesInMean = 0
imagesFileNames = os.listdir(imagesFolderPath + '/png')
imagesFileNames = os.listdir(imagesFolderPath)
#print(rawpy.imread(f'{imagesFolderPath}/{imagesFileNames[0]}').sizes.raw_height)
#exit(1)
requiresRaiseFiltering = True
if requiresRaiseFiltering:
@ -28,10 +30,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'] + '.png'
file = row['File'] + '.NEF'
files[file] = row
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 = [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 = [f'DSC0{imageIndex}.ARW' for imageIndex in range(2807, 2911)]
minColor = None