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 cv2
img = cv2.imread('box.png',0) # queryImage
orb = cv2.ORB_create() # Initiate SIFT detector
# find the keypoints and descriptors with SIFT
kp1, des1 = orb.detectAndCompute(img, None)
cv2.ORB_create()
will do the job I think
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. :)