python - OpenCV can't find ORB -
in previous question learned had install opencv-contrib
in order use opencv python external modules such sift. in project, however, want use orb or similar. cv2.orb()
not work, nor cv2.xfeatures2d.orb_create()
or other agglutination of commands.
as knows, opencv has rather poor documentation python api.
how use orb match features in opencv python?
mwe:
#!/usr/bin/python2.7 import numpy np import cv2 matplotlib import pyplot plt img = cv2.imread('smallburger.jpg',0) # initiate star detector orb = cv2.orb() # find keypoints orb kp = orb.detect(img,none) # compute descriptors orb kp, des = orb.compute(img, kp) # draw keypoints location,not size , orientation img2 = cv2.drawkeypoints(img,kp,color=(0,255,0), flags=0) plt.imshow(img2),plt.show()
cli output:
traceback (most recent call last): file "./mwe.py", line 9, in <module> orb = cv2.orb() attributeerror: 'module' object has no attribute 'orb'
silly opencv. it's cv2.orb_create()
.
Comments
Post a Comment