Add debugging

This commit is contained in:
Benjamin Loison 2024-07-24 00:22:08 +02:00
parent 7386290e87
commit 19f8e010e0
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8
2 changed files with 9 additions and 6 deletions

View File

@ -60,10 +60,13 @@ for splitNXNIndex, splitNXN in enumerate(SPLIT_N_X_N_S):
m = IMAGE_SIZE_SHAPE[1]
n = IMAGE_SIZE_SHAPE[0]
imageWithoutPrnuNpArrayTiles = [imageWithoutPrnuNpArray[x : x + m, y : y + n] for x in range(0, imageWithoutPrnuNpArray.shape[0], m) for y in range(0, imageWithoutPrnuNpArray.shape[1], n)]
imageWithoutPrnuNpArrayTiles = [imageWithoutPrnuNpArray[x * m : (x + 1) * m, y * n : (y + 1) * n] for x in range(splitNXN) for y in range(splitNXN)]
#print(f'{m=} {n=} {0 * m=} {0 * (m + 1)=}')
#print([imageWithoutPrnuNpArrayTile.shape for imageWithoutPrnuNpArrayTile in imageWithoutPrnuNpArrayTiles])
for imageWithoutPrnuNpArrayTile in imageWithoutPrnuNpArrayTiles:
#print(imageWithoutPrnuNpArrayTile.shape, tuple(IMAGE_SIZE_SHAPE[::-1]))
#if imageWithoutPrnuNpArrayTile.shape != tuple(IMAGE_SIZE_SHAPE[::-1]):
# exit(1)
# continue
imageNoise = randomGaussianImage(scale = 255 * NOISE_FACTOR, size = imageWithoutPrnuNpArrayTile.shape)
imageWithPrnuNpArray = imageWithoutPrnuNpArrayTile + prnuNpArray + imageNoise
@ -80,8 +83,8 @@ for splitNXNIndex, splitNXN in enumerate(SPLIT_N_X_N_S):
axis[2].set_title('First image with Gaussian noise\nClipped between 0 and 255')
axisImShow(axis[2], np.clip(imageWithoutPrnuNpArray + imageNoise, 0, 255))
axis[3].set_title('Actual Gaussian noised PRNU\nClipped between -1 and 1')
axisImShow(axis[3], np.clip(prnuNpArray, -1, 1))
axis[3].set_title('Actual Gaussian noised PRNU')
axisImShow(axis[3], prnuNpArray)
axes[1][0].set_title('First image with Gaussian noise and PRNU\nClipped between 0 and 255')
axisImShow(axes[1][0], np.clip(imageWithoutPrnuNpArray + prnuNpArray + imageNoise, 0, 255))

View File

@ -11,7 +11,7 @@ from utils import isARawImage, Color, getColorChannel, mergeSingleColorChannelIm
FOLDERS = {
'Rafael 23/04/24': '../rafael/230424',
'RAISE flat-field': '../flat-field/nef',
'RAISE not flat-field': '../not_flat-field/nef',
'RAISE non-flat-field': '../non-flat-field/nef',
}
def getImageMergedColorChannels(filePath):
@ -41,8 +41,8 @@ estimatedPrnus = {folderName: getEstimatedPrnu(folder) for folderName, folder in
print(f'{corr(estimatedPrnus["Rafael 23/04/24"], estimatedPrnus["Rafael 23/04/24"])=}')
print(f'{corr(estimatedPrnus["Rafael 23/04/24"], estimatedPrnus["RAISE flat-field"])=}')
print(f'{corr(estimatedPrnus["RAISE flat-field"], estimatedPrnus["Rafael 23/04/24"])=}')
print(f'{corr(estimatedPrnus["Rafael 23/04/24"], estimatedPrnus["RAISE not flat-field"])=}')
print(f'{corr(estimatedPrnus["RAISE flat-field"], estimatedPrnus["RAISE not flat-field"])=}')
print(f'{corr(estimatedPrnus["Rafael 23/04/24"], estimatedPrnus["RAISE non-flat-field"])=}')
print(f'{corr(estimatedPrnus["RAISE flat-field"], estimatedPrnus["RAISE non-flat-field"])=}')
plt.imshow(estimatedPrnus['RAISE flat-field'])
plt.show()