Unsupported Error When Using ORB and "cv.FlannBasedMatcher"

Hi, guys!
These days I am struggling using ORB to do image matching.
But I met an error as,

cv2.error: OpenCV(4.5.3) …\opencv\modules\flann\src\miniflann.cpp:336: error: (-210:Unsupported format or combination of formats) in function ‘cv::flann::buildIndex_’

And here is a snippet as,

# -- Step 1: Detect the key points using the specified Detector, compute the descriptors

  detector = cv.ORB_create()

  kps_obj, dps_obj = detector.detectAndCompute(img_object, None)

  kps_scene, dps_scene = detector.detectAndCompute(img_scene, None)

  # -- Step 2: Matching descriptor vectors with a FLANN based matcher


  index_params = dict(algorithm=1, trees=5)

  search_params = dict(checks=50)

  flann = cv.FlannBasedMatcher(index_params, search_params)

  knn_matches = flann.knnMatch(dps_obj, dps_scene, k=2)

So how can I resolve this?

Your answer and guide will be appreciated!

tutorial here
and here

you need a matcher for binary features now !
(please do not copypaste code blindly !!!)

either use

 cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)


index_params= dict(algorithm = FLANN_INDEX_LSH,
               table_number = 6, # 12
               key_size = 12,     # 20
               multi_probe_level = 1) #2

search_params = dict(checks=50)
flann = cv.FlannBasedMatcher(index_params, search_params)
1 Like

I am sorry to admit I missed the tutor you mentioned. I just read 《Feature Matching + Homography to find Objects》

1 Like