#29: Add Nikon D7000 4946x3278 PRNU estimation from NEF to PNG images

This commit is contained in:
Benjamin Loison 2024-04-15 16:06:05 +02:00
parent 847d4bb42f
commit a09f2ba1c0
No known key found for this signature in database

View File

@ -7,7 +7,7 @@ from PIL import Image
import os
from tqdm import tqdm
imagesFolderPath = 'flat-field'
imagesFolderPath = 'raise_nef_png'
denoiser = 'wavelet'
npArrayFilePath = f'mean_{imagesFolderPath}_{denoiser}.npy'
@ -16,7 +16,35 @@ denoise = getattr(skimage.restoration, f'denoise_{denoiser}')
mean = None
numberOfImagesInMean = 0
import csv
import magic
import re
deviceFiles = {}
resolutionFiles = {}
files = {}
resolutionFiles = {}
with open('RAISE_all.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in tqdm(list(reader)):
file = row['File'] + '.png'
device = row['Device']
resolution = row['Image Size']
deviceFiles[file] = device
#resolutionFiles[file] = resolution
image = Image.open(f'{imagesFolderPath}/{file}')
#t = magic.from_file(f'{imagesFolderPath}/{file}.png')
resolution = image.size
resolutionFiles[file] = resolution#re.search('(\d+) x (\d+)', t).groups()
#print(device, resolution)
#files[f'{file}.png'] = row
imagesFileNames = os.listdir(imagesFolderPath)
#print(len(imagesFileNames))
# imageFileName.replace('.png', '')
imagesFileNames = [imageFileName for imageFileName in imagesFileNames if deviceFiles[imageFileName] == 'Nikon D7000' and resolutionFiles[imageFileName] == (4946, 3278)]
#print(len(imagesFileNames))
def treatImage(imageFileName):
global mean, numberOfImagesInMean