CAI over images mean does not seem better

This commit is contained in:
Benjamin Loison 2024-03-22 12:57:24 +01:00
parent 464e43861b
commit d818714344
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -54,21 +54,27 @@ def getPhoneIndexByNearestPrnu(estimatedPrnu):
# What about CAI on `phoneImagesMean`? See https://gitea.lemnoslife.com/Benjamin_Loison/Robust_image_source_identification_on_modern_smartphones/issues/9#issuecomment-1369.
correctGuessesByMeanImages = 0
correctGuessesByMeanCAIImages = 0
correctGuessesByCAIImagesMean = 0
for phoneIndex in range(NUMBER_OF_PHONES):
phoneImages = images[phoneIndex]
phoneCaiImages = caiImages[phoneIndex]
phoneImagesMean = toPilImage(np.array(phoneImages).mean(axis = 0))
caiImagesMean = toPilImage(np.array(phoneCaiImages).mean(axis = 0))
caiOverPhoneImagesMean = contextAdaptiveInterpolator(phoneImagesMean.load(), phoneImagesMean)
phonePrnu = prnus[phoneIndex]
print('RMS diff with mean image =', rmsdiff(phoneImagesMean, phonePrnu))
print('RMS diff with mean CAI images =', rmsdiff(caiImagesMean, phonePrnu))
print('RMS diff with CAI images mean =', rmsdiff(caiOverPhoneImagesMean, phonePrnu))
guessedPhoneIndexByMeanImages = getPhoneIndexByNearestPrnu(phoneImagesMean)
guessedPhoneIndexByMeanCAIImages = getPhoneIndexByNearestPrnu(caiImagesMean)
print(f'Actual phone index {phoneIndex}, guessed phone index {guessedPhoneIndexByMeanImages} by mean images and {guessedPhoneIndexByMeanCAIImages} by mean CAI images')
guessedPhoneIndexByCAIImagesMean = getPhoneIndexByNearestPrnu(caiOverPhoneImagesMean)
print(f'Actual phone index {phoneIndex}, guessed phone index {guessedPhoneIndexByMeanImages} by mean images, {guessedPhoneIndexByMeanCAIImages} by mean CAI images and {guessedPhoneIndexByCAIImagesMean} by CAI images mean')
correctGuessesByMeanImages += 1 if phoneIndex == guessedPhoneIndexByMeanImages else 0
correctGuessesByMeanCAIImages += 1 if phoneIndex == guessedPhoneIndexByMeanCAIImages else 0
correctGuessesByCAIImagesMean += 1 if phoneIndex == guessedPhoneIndexByCAIImagesMean else 0
print(f'{correctGuessesByMeanImages / NUMBER_OF_PHONES=}')
print(f'{correctGuessesByMeanCAIImages / NUMBER_OF_PHONES=}')
print(f'{correctGuessesByCAIImagesMean / NUMBER_OF_PHONES=}')