From 9a3cfd7ba1b47a9cfbd8346b868a27506051439e Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Thu, 28 Mar 2024 22:24:16 +0100 Subject: [PATCH] Add PRNU showing such --- datasets/noise_free_test_images/estimate_prnu.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/datasets/noise_free_test_images/estimate_prnu.py b/datasets/noise_free_test_images/estimate_prnu.py index 959cb46..407686b 100644 --- a/datasets/noise_free_test_images/estimate_prnu.py +++ b/datasets/noise_free_test_images/estimate_prnu.py @@ -12,20 +12,20 @@ from image_utils import showImageWithMatplotlib, randomGaussianImage datasetPath = 'no_noise_images' # Note that contrarily to `datasets/fake/`, here we do not have images being Gaussian with `scale` `1` but actual images with pixel values between 0 and 255. # In addition to the range difference, note that the distribution in the first set of images was a Gaussian and here is very different and specific. -PRNU_FACTOR = 255 * 0.1 +PRNU_FACTOR = 0.1 IMAGE_SIZE_SHAPE = (469, 704) np.random.seed(0) -# Should first try with an image showing `PRNU`. -prnu = randomGaussianImage(scale = PRNU_FACTOR, size = IMAGE_SIZE_SHAPE) +#prnuNpArray = 255 * randomGaussianImage(scale = PRNU_FACTOR, size = IMAGE_SIZE_SHAPE) +prnuPil = Image.open('prnu.png').convert('F') +prnuNpArray = np.array(prnuPil) * PRNU_FACTOR for imageName in os.listdir(datasetPath): if imageName.endswith('.png'): - #print(imageName) imagePath = f'{datasetPath}/{imageName}' imagePil = Image.open(imagePath).convert('F') imageNpArray = np.array(imagePil) - showImageWithMatplotlib(imageNpArray) - showImageWithMatplotlib(imageNpArray + prnu) + #showImageWithMatplotlib(imageNpArray) + showImageWithMatplotlib(imageNpArray + prnuNpArray) break \ No newline at end of file