Restore clipping

6f961a46cf
This commit is contained in:
Benjamin Loison 2024-07-04 04:08:36 +02:00
parent 5bc0337dc8
commit d24c883a92
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -34,9 +34,8 @@ SPLIT_N_X_N_S = [1, 2, 4]
fig, axes = plt.subplots(2, 4)
fig.suptitle('PRNU estimation with different number of images having Gaussian noise and Gaussian noised PRNU')
def axisImShow(axis, im, cMap = (None, None)):
vMin, vMax = cMap
imShow = axis.imshow(im, vmin = vMin, vmax = vMax)
def axisImShow(axis, im):
imShow = axis.imshow(im)
plt.colorbar(imShow, label = 'Intensity', ax = axis, orientation = 'horizontal')
for splitNXNIndex, splitNXN in enumerate(SPLIT_N_X_N_S):
@ -72,26 +71,20 @@ for splitNXNIndex, splitNXN in enumerate(SPLIT_N_X_N_S):
if splitNXNIndex == 0 and isFirstImage:
axis = axes[0]
images = [imageWithoutPrnuNpArrayTile, imageWithoutPrnuNpArray + imageNoise, imageWithoutPrnuNpArray + prnuNpArray + imageNoise]
vMin = np.min(images)#min([np.min(image) for image in [imageWithoutPrnuNpArrayTile, imageWithoutPrnuNpArray + imageNoise, imageWithoutPrnuNpArray + prnuNpArray + imageNoise]])
vMax = np.max(images)
cMap = (vMin, vMax)
#print(f'{vMin=}')
axis[0].set_title('First image without noise')
axisImShow(axis[0], imageWithoutPrnuNpArrayTile, cMap = cMap)
axisImShow(axis[0], imageWithoutPrnuNpArrayTile)
axis[1].set_title('First image Gaussian noise')
axisImShow(axis[1], imageNoise)
axis[2].set_title('First image with Gaussian noise')
axisImShow(axis[2], imageWithoutPrnuNpArray + imageNoise, cMap = cMap)
axisImShow(axis[2], np.clip(imageWithoutPrnuNpArray + imageNoise, 0, 255))
axis[3].set_title('Actual Gaussian noised PRNU')
axisImShow(axis[3], prnuNpArray)
axes[1][0].set_title('First image with Gaussian noise and PRNU')
axisImShow(axes[1][0], imageWithoutPrnuNpArray + prnuNpArray + imageNoise, cMap = cMap)
axisImShow(axes[1][0], np.clip(imageWithoutPrnuNpArray + prnuNpArray + imageNoise, 0, 255))
isFirstImage = False
#assert all([isIn256Range(extreme) for extreme in [imageWithPrnuNpArray.max(), imageWithPrnuNpArray.min()]]), 'Adding the PRNU resulted in out of 256 bounds image'