from PIL import Image
import imagehash
hash = imagehash.phash(Image.open('13.png'))
print(hash)
otherhash = imagehash.phash(Image.open('13-70.jpg'))
print(otherhash)
print(hash == otherhash)
print(hash - otherhash) # hamming distance
输出结果:
e59634a5a2a5e6a6
e59634a5a2a5e6a6
True
0
哈希原理后边再补