Revert to some extent previous commit
This commit is contained in:
parent
4382b3d649
commit
d59a251b1f
@ -19,7 +19,7 @@ from skimage.restoration import denoise_tv_chambolle
|
||||
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_FACTORS = [0.1, 0.01]
|
||||
PRNU_FACTOR = 0.1
|
||||
IMAGE_SIZE_SHAPE = (469, 704)
|
||||
|
||||
np.random.seed(0)
|
||||
@ -39,31 +39,11 @@ for imageName in os.listdir(datasetPath):
|
||||
imageWithoutPrnuPil = Image.open(imagePath).convert('F')
|
||||
imageWithoutPrnuNpArray = np.array(imageWithoutPrnuPil)
|
||||
|
||||
fig, axes = plt.subplots(3, 2)
|
||||
fig.suptitle('Single PRNU estimation from an image with PRNU')
|
||||
|
||||
axes[0][0].set_title('Actual PRNU')
|
||||
axes[0][0].imshow(prnuNpArray)
|
||||
|
||||
axes[0][1].axis('off')
|
||||
|
||||
for prnuIndex, prnuNpArray in enumerate(prnusNpArray):
|
||||
imageWithPrnuNpArray = imageWithoutPrnuNpArray + prnuNpArray
|
||||
#assert all([isIn256Range(extreme) for extreme in [imageWithPrnuNpArray.max(), imageWithPrnuNpArray.min()]]), 'Adding the PRNU resulted in out of 256 bounds image'
|
||||
imageWithPrnuPil = toPilImage(imageWithPrnuNpArray)
|
||||
#imagePrnuEstimatePil = contextAdaptiveInterpolator(imageWithPrnuPil.load(), imageWithPrnuPil)
|
||||
#imagePrnuEstimateNpArray = np.array(imagePrnuEstimatePil)
|
||||
imagePrnuEstimateNpArray = imageWithPrnuNpArray - denoise_tv_chambolle(imageWithPrnuNpArray, weight=0.2, channel_axis=-1)
|
||||
axis = axes[prnuIndex + 1]
|
||||
|
||||
axis[0].set_title(f'Image with PRNU\nPRNU_FACTOR = {PRNU_FACTORS[prnuIndex]}')
|
||||
axis[0].imshow(imageWithPrnuNpArray)
|
||||
|
||||
axis[1].set_title('PRNU estimate')
|
||||
axis[1].imshow(imagePrnuEstimateNpArray)
|
||||
break
|
||||
imageWithPrnuNpArray = imageWithoutPrnuNpArray + prnuNpArray
|
||||
#assert all([isIn256Range(extreme) for extreme in [imageWithPrnuNpArray.max(), imageWithPrnuNpArray.min()]]), 'Adding the PRNU resulted in out of 256 bounds image'
|
||||
imageWithPrnuPil = toPilImage(imageWithPrnuNpArray)
|
||||
#imagePrnuEstimatePil = contextAdaptiveInterpolator(imageWithPrnuPil.load(), imageWithPrnuPil)
|
||||
#imagePrnuEstimateNpArray = np.array(imagePrnuEstimatePil)
|
||||
imagePrnuEstimateNpArray = imageWithPrnuNpArray - denoise_tv_chambolle(imageWithPrnuNpArray, weight=0.2, channel_axis=-1)
|
||||
|
||||
imagesPrnuEstimateNpArray += [imagePrnuEstimateNpArray]
|
||||
|
||||
plt.tight_layout(pad = 0)
|
||||
plt.show()
|
||||
|
Loading…
Reference in New Issue
Block a user