我正在尝试计算这些图像之间的相似性百分比,并准确识别这两个图像之间的差异。
import cv2
import numpy as np import scipy.misc
img1 = cv2.imread("images/yelp_popover.png") img2 =
cv2.imread("images/yelp_home.png")
print img1.shape
img1 = scipy.misc.imresize(img1, 0.50) img2 =
scipy.misc.imresize(img2, 0.50)
diff = cv2.subtract(img1, img2)
result = not np.any(diff)
if result is False:
cv2.imshow("Diff ", diff)
cv2.waitKey(0)
但是这会将整个第二个图像识别为差异,因为弹出窗口会应用蒙版。有没有办法优化识别对话框作为图像之间的差异?