免责声明 本站所提供的部分内容,为作者提供、网友推荐、互联网整理而来,仅供学习参考,如有侵犯您的版权,请联系我们,本站将在三个工作日内删除。
import cv2.cv as cv
import cv2
import numpy as np
def compareHist(stdimg, ocimg):
stdimg = cv2.imread(str(stdimg), 0)
ocimg = cv2.imread(str(ocimg), 0)
stdimg = np.float32(stdimg)
ocimg = np.float32(ocimg)
stdimg = np.ndarray.flatten(stdimg)
ocimg = np.ndarray.flatten(ocimg)
imgocr = np.corrcoef(stdimg, ocimg)
print imgocr[0, 1]
return imgocr[0, 1] > 0.96
if __name__ =='__main__':
stding = 'C:/Test/Img1.png'
ocimg ='C:/Test/Img2.png'
compareHist(stding,ocimg)
在线留言