Add datasets/noise_free_test_images/estimate_prnu.py
This commit is contained in:
parent
0953fb7475
commit
a99e942d3a
29
datasets/noise_free_test_images/estimate_prnu.py
Normal file
29
datasets/noise_free_test_images/estimate_prnu.py
Normal file
@ -0,0 +1,29 @@
|
||||
# Notes: https://gitea.lemnoslife.com/Benjamin_Loison/Robust_image_source_identification_on_modern_smartphones/issues/25
|
||||
|
||||
import os
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, '../../algorithms/image_utils/')
|
||||
|
||||
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
|
||||
IMAGE_SIZE_SHAPE = (469, 704)
|
||||
|
||||
# Should first try with an image showing `PRNU`.
|
||||
prnu = randomGaussianImage(scale = PRNU_FACTOR, size = IMAGE_SIZE_SHAPE)
|
||||
|
||||
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)
|
||||
break
|
Loading…
Reference in New Issue
Block a user