From be83fcf154ba144045e296f2f0e6d0d8deb58ca4 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Wed, 5 Jun 2024 16:27:40 +0200 Subject: [PATCH] Add PRNU estimation computation --- datasets/raise/fft/verify_dots.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/datasets/raise/fft/verify_dots.py b/datasets/raise/fft/verify_dots.py index c68a8d8..99760fb 100644 --- a/datasets/raise/fft/verify_dots.py +++ b/datasets/raise/fft/verify_dots.py @@ -8,21 +8,23 @@ sys.path.insert(0, '../') from utils import isARawImage, Color, getColorChannel, mergeSingleColorChannelImagesAccordingToBayerFilter, iterativeMean -#images = [] folder = '../rafael/230424' meanImages = iterativeMean() +filePaths = [f'{folder}/{file}' for file in os.listdir(folder) if isARawImage(file)] -for file in tqdm(os.listdir(folder)): - if isARawImage(file): - #print(file) - filePath = f'{folder}/{file}' - imageColorChannels = {color: getColorChannel(filePath, color) for color in Color} - imageMergedColorChannels = mergeSingleColorChannelImagesAccordingToBayerFilter(imageColorChannels) - #images += [imageMergedColorChannels] - meanImages.add(imageMergedColorChannels) +for filePath in tqdm(filePaths): + imageColorChannels = {color: getColorChannel(filePath, color) for color in Color} + imageMergedColorChannels = mergeSingleColorChannelImagesAccordingToBayerFilter(imageColorChannels) + meanImages.add(imageMergedColorChannels) -#print(np.mean(images, axis = 0).shape) -print(meanImages.shape) +#print(meanImages.mean.shape) -plt.imshow() +# Is not there anything clever than this to do? See [Robust_image_source_identification_on_modern_smartphones/issues/72](https://gitea.lemnoslife.com/Benjamin_Loison/Robust_image_source_identification_on_modern_smartphones/issues/72). +estimatedPrnu = iterativeMean() +for filePath in tqdm(filePaths): + imageColorChannels = {color: getColorChannel(filePath, color) for color in Color} + imageMergedColorChannels = mergeSingleColorChannelImagesAccordingToBayerFilter(imageColorChannels) + estimatedPrnu.add(imageMergedColorChannels - meanImages.mean) + +plt.imshow(estimatedPrnu.mean) plt.show() \ No newline at end of file