calculate a hamming distance

import cv2

import sys

hasher = cv2.img_hash.AverageHash_create()

a1 = cv2.imread(sys.argv[1])

a2 = cv2.imread(sys.argv[2])

a1h = hasher.compute(a1)

a2h = hasher.compute(a2)

diff = hasher.compare(a1h,a2h)

print(f"image1 hash is: {a1h}")

print(f"image2 hash is: {a2h}")

print(f"image hamming distance is: {diff}")

你可能感兴趣的:(calculate a hamming distance)