test_gms_matcher.py 文件源码

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

项目:prototype 作者: chutsu 项目源码 文件源码
def test_compute_matches(self):
        orb = cv2.ORB_create(10000)
        orb.setFastThreshold(0)
        matcher = cv2.BFMatcher(cv2.NORM_HAMMING)
        gms = GmsMatcher(orb, matcher)

        kp0, des0 = orb.detectAndCompute(self.img0, np.array([]))
        kp1, des1 = orb.detectAndCompute(self.img1, np.array([]))
        matches = matcher.match(des0, des1)

        matches = gms.compute_matches(kp0, kp1, des0, des1, matches, self.img0)

        self.assertTrue(len(matches) > 0)

    # def test_compute_matches2(self):
    #     orb = cv2.ORB_create(1000)
    #     orb.setFastThreshold(0)
    #     matcher = cv2.BFMatcher(cv2.NORM_HAMMING)
    #     gms = GmsMatcher(orb, matcher)
    #
    #     camera = Camera()
    #     img0 = camera.update()
    #
    #     while True:
    #         img1 = camera.update()
    #         matches = gms.compute_matches(img0, img1)
    #         gms.draw_matches(img0, img1)
    #
    #         img0 = img1
    #
    #         # matches_img = draw_matches(img0, img1, kp0, kp1, matches)
    #         # cv2.imshow("Mathces", matches_img)
    #         # if cv2.waitKey(1) == 113:
    #         #     exit(0)
    #
    #     self.assertTrue(len(matches) > 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号