Add and use showImageWithMatplotlib

This commit is contained in:
Benjamin Loison 2024-03-25 18:37:09 +01:00
parent 8575da5b1d
commit 044d25cbaa
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -32,16 +32,20 @@ allImages = np.max([np.max(prnus) + np.max(images)])
def toPilImage(npArray):
return Image.fromarray(npArray)
def showImage(npArray):
def showImageWithPil(npArray):
npArray -= npArray.min()
npArray = (npArray / npArray.max()) * 255
Image.fromarray(npArray).show()
def showImageWithMatplotlib(npArray):
plt.imshow(npArray)
plt.show()
prnusPil = [toPilImage(prnu) for prnu in prnus]
#showImage(prnus[0])
#showImageWithMatplotlib(prnus[0])
imagesPil = [[toPilImage(image) for image in images[phoneIndex]] for phoneIndex in range(NUMBER_OF_PHONES)]
#showImage(images[0][0])
#showImageWithMatplotlib(images[0][0])
# Compute CAI of phone images.
caiImages = [[contextAdaptiveInterpolator(image.load(), image) for image in imagesPil[phoneIndex]] for phoneIndex in tqdm(range(NUMBER_OF_PHONES))]