def Canny_edge(self):
self.threshold = .999999999999999
gray_i = cv2.cvtColor(self.image_i, cv2.COLOR_BGR2GRAY)
edges_i = cv2.Canny(gray_i,100,200)
gray_j = cv2.cvtColor(self.image_j, cv2.COLOR_BGR2GRAY)
edges_j = cv2.Canny(gray_j,100,200)
hist_i = cv2.calcHist([edges_i], [0], None, [256], [0, 256])
hist_j = cv2.calcHist([edges_j], [0], None, [256], [0, 256])
self.measure = cv2.compareHist(hist_i, hist_j, cv.CV_COMP_CORREL)
self.assertGreater(self.measure, self.threshold)
print self.measure
# cv2.imshow(self.image_i)
# cv2.imshow(self.image_j)
评论列表
文章目录