【图像哈希】imagehash库-python

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

哈希原理后边再补

你可能感兴趣的:(学习笔记,哈希算法,python,算法)