opencv如何用ORB特征提取并过滤?

import sys
import cv2 as cv
import numpy as np


def main_func():

    imgCat = cv.imread("cat.png")
    imgSmallCat = cv.imread("smallCat.png")

    orb = cv.ORB_create()

    kpCat, desCat = orb.detectAndCompute(imgCat,None)
    kpSmallCat, desSmallCat = orb.detectAndCompute(imgSmallCat, None)

    bf = cv.BFMatcher_create(cv.NORM_HAMMING, crossCheck=True)

    matches = bf.match(desCat, desSmallCat)
    matchImg = cv.drawMatches(imgCat, kpCat, imgSmallCat, kpSmallCat, matches, None)


    cv.imshow("Cat", imgCat)
    cv.imshow("SmallCat", imgSmallCat)
    cv.imshow('match', matchImg)

    cv.waitKey(0)


if __name__ == '__main__':
    main_func()

cv2.xfeatures2d.SIFT 要老版本opencv
所以不想用SIFT
直接用ORB

比如我只要 横着的线
不要竖着的线

应该怎么过滤

回复
阅读 494
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏