我想用直方图匹配的方法来比较两幅图像。在
显然,这两幅图像很相似。然后,我试图找出与以下代码的相关性。在
import cv2
import numpy as np
#reading the images and convert them to HSV
base = cv2.imread('base.jpg')
test1 = cv2.imread('test1.jpg')
basehsv = cv2.cvtColor(base,cv2.COLOR_BGR2HSV)
test1hsv = cv2.cvtColor(test1,cv2.COLOR_BGR2HSV)
# Calculate the Hist for each images
histbase = cv2.calcHist(basehsv,[0,1],None,[180,256],ranges)
cv2.normalize(histbase,histbase,0,255,cv2.NORM_MINMAX)
histtest1 = cv2.calcHist(test1hsv,[0,1],None,[180,256],ranges)
cv2.normalize(histtest1,histtest1,0,255,cv2.NORM_MINMAX)
# Compare two Hist. and find out the correlation value
base_test1 = cv2.compareHist(histbase,histtest1,0)
print base_test1
然而,输出的结果只是0.05xxx
。在
为什么相关性这么小?在
我怎样才能提高成绩?谢谢您。在
目前没有回答
相关问题 更多 >
编程相关推荐