Reputation: 4038
I want to use the sift function in open cv, when I do:
cv2.xfeatures2d
I get:
AttributeError: 'module' object has no attribute 'xfeatures2d'
even cv2.SIFT()
does not work. However this seems to work:
cv2.orb_create()
I am on open cv 3.3.0, using opencv-contrib-python. I tried using opencv-python but that also gave me same errors.
I tried uninstalling and reinstsalling as well using pip. I am on osx.
Upvotes: 4
Views: 7245
Reputation: 18331
First install
opencv-python
andopencv-contrib-python
:
For python2:
$(sudo) python2 -m pip install opencv-python opencv-contrib-python
For python3:
$(sudo) python3 -m pip install opencv-python opencv-contrib-python
Then call try again. For OpenCV 3.x, use
cv2.xfeatures2d.SIFT_create()
to create:
$ python
>>> import cv2
>>> cv2.__version__
'3.3.0-dev'
>>> sift = cv2.xfeatures2d.SIFT_create()
>>> sift
<xfeatures2d_SIFT 0x7f79ca721d10>
Upvotes: 4