tuoheng_algN/test/水印/互信息.py

8 lines
313 B
Python
Raw Normal View History

2025-01-21 09:26:34 +08:00
from PIL import Image
from pixelmatch.contrib.PIL import pixelmatch
img_a = Image.open("../image/AI.jpg")
img_b = Image.open("../image/AI3.jpg")
img_diff = Image.new("RGBA", img_a.size)
# note how there is no need to specify dimensions
mismatch = pixelmatch(img_a, img_b, img_diff, includeAA=True)
print(mismatch)