OpenCV ORB descriptor: TypeError: Incorrect type of self (must be 'Feature2D' or its derivative) OpenCV ORB descriptor: TypeError: Incorrect type of self (must be 'Feature2D' or its derivative) python python

OpenCV ORB descriptor: TypeError: Incorrect type of self (must be 'Feature2D' or its derivative)


This is a OpenCV version compatibility issue. Just use cv2.ORB_create() instead of cv2.ORB().

The code should look like:

import cv2img = cv2.imread('box.png',0) # queryImageorb = cv2.ORB_create()        # Initiate SIFT detector# find the keypoints and descriptors with SIFTkp1, des1 = orb.detectAndCompute(img, None)


Note the python structures change "frequently" (in internet history years anyway). It's a good idea to pay attention to version.

Go here to find the right link: https://docs.opencv.org/

3.1.1 --> 3.1.0 --> https://docs.opencv.org/3.1.0/ ( OpenCV-Python Tutorials --> https://docs.opencv.org/3.1.0/d6/d00/tutorial_py_root.html ) ... not as pretty as that (old) readthedocs site, but more accurate. :)