【发布时间】:2020-05-28 13:27:41
【问题描述】:
我需要比较文件夹中的第一张图片,删除重复的图片,直到找到不匹配的图片。然后它将新图像与图片的其余部分进行比较,重复第一个过程。我不知道我是否忘记了一些明显的事情,但是如何将新图像设置为比较。下面是我的第一次尝试,im1 的 first_image 将在循环后更新。任何意见,将不胜感激。
def add():
for image in files:
im1 = Image.open(path+ "/"+first_image).histogram() #the image to be compared too
im = Image.open(path+ "/" +image).histogram() #the image to be compared
if im == im1:
os.rename(path + "/" + file, path + "/delete")
else:
os.rename(path + "/" + file, path + "/save") ```
【问题讨论】:
标签: python-3.x image-comparison