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

8 lines
313 B
Python

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)