I'm currently trying to get a hash from an image in python, i have successfully done this and it works somewhat.
However, I have this issue: Image1 and image2 end up having the same hash, even though they are different. I need a form of hashing which is more accurate and precise.
Image1 = Image1
Image2 = Image2
The hash for the images is: faf0761493939381
I am currently using from PIL import Image
import imagehash
And imagehash.average_hash
Code here
import os
from PIL import Image
import imagehash
def checkImage():
for filename in os.listdir('images//'):
hashedImage = imagehash.average_hash(Image.open('images//' + filename))
print(filename, hashedImage)
for filename in os.listdir('checkimage//'):
check_image = imagehash.average_hash(Image.open('checkimage//' + filename))
print(filename, check_image)
if check_image == hashedImage:
print("Same image")
else:
print("Not the same image")
print(hashedImage, check_image)
checkImage()