比较图像并每行删除相似的图像



我需要比较400000个图像并删除类似的图像。我将在一个文件中拥有大约100000个id,其中包含多个不同大小的图像。我想创建两列id和图像,并为每个id删除相似的图像。若一个id有10个图像,但只有两个不同,我希望该id只有两个图像。我正在python中搜索同样简单的方法。


import PIL
from PIL import Image
import imagehash
hash1 = imagehash.phash(Image.open('image_a.jpg'))
print(hash1)
hash2 = imagehash.phash(Image.open('image_b.jpg'))
print(hash2)

hash1 == hash2

输出

e5969a1b256e8cc9

ebd49312f02e862f

错误

最新更新