example.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:test-automation 作者: openstax 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号