# Unsupported Error When Using ORB and "cv.FlannBasedMatcher"

**URL:** <https://forum.opencv.org/t/unsupported-error-when-using-orb-and-cv-flannbasedmatcher/5142>\
**Category:** Python\
**Tags:** features2d\
**Created:** [September 11, 2021, 7:28am UTC](https://forum.opencv.org/t/unsupported-error-when-using-orb-and-cv-flannbasedmatcher/5142 "2021-09-11T07:28:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![songyuc](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@songyuc](https://forum.opencv.org/u/songyuc)\
**Post date:** [September 11, 2021, 7:28am UTC](https://forum.opencv.org/t/unsupported-error-when-using-orb-and-cv-flannbasedmatcher/5142/1 "2021-09-11T07:28:13Z")

</div>

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\_’  
> type=0

And here is a snippet as,

```python
# -- 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

  FLANN_INDEX_KDTREE = 1

  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!

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [September 11, 2021, 7:48am UTC](https://forum.opencv.org/t/unsupported-error-when-using-orb-and-cv-flannbasedmatcher/5142/2 "2021-09-11T07:48:33Z")

</div>

[tutorial here](https://docs.opencv.org/master/dc/dc3/tutorial_py_matcher.html) …  
[and here](https://docs.opencv.org/master/dc/dc3/tutorial_py_matcher.html)

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

either use

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

```

or:

```
FLANN_INDEX_LSH = 6
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)
```

---

<div class="post-metadata">

**Author:** ![songyuc](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@songyuc](https://forum.opencv.org/u/songyuc)\
**Post date:** [September 11, 2021, 8:02am UTC](https://forum.opencv.org/t/unsupported-error-when-using-orb-and-cv-flannbasedmatcher/5142/3 "2021-09-11T08:02:43Z")

</div>

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