-1

I'm using opencv-python-3.4.2.17 and opencv-contrib-python==3.4.2.16. I have tried other versions also. But I'm still getting this error:

sift = xfeatures2d.SIFT_create()

NameError: name 'xfeatures2d' is not defined

I have already referred to these links:

AttributeError: 'module' object has no attribute 'xfeatures2d' [Python/OpenCV 2.4]

Unable to find SIFT or xfeatures2d in OpenCV Python

Adding modules from opencv_contrib to OpenCV

But none of these worked for me.

1 Answers1

1

If you're using anaconda you should reinstall ocv with:

conda install -c menpo opencv

Otherwise downgrade to 3.4.1 version using either conda or pip.

pip install opencv-python==3.4.1

Also check sift = cv2.xfeatures2d.SIFT_create() sift create not working even though have contrib instal

There is also some python version debate going on on this issue.. probably fixed in near future releases of ocv.

ZF007
  • 3,708
  • 8
  • 29
  • 48
  • I tried installing opencv-contrib-python version 3.4.5.20 and opencv-contrib-python==3.4.5.20 as mentioned in one of the comments in this link:https://stackoverflow.com/questions/52305578/sift-cv2-xfeatures2d-sift-create-not-working-even-though-have-contrib-instal but I'm still getting the same error. – VenusAphrodite Mar 27 '19 at 07:33
  • The makers are aware of this issue and problably in a near future release the bugs will be fixed. For now my suggestion is "down-grading" and not upgrading as you mentioned in your comment. Ask yourself... do I "really" need beta-features from the 3.4.5.20 version for the work I'm doing? If answered "no" there is no need on wasting more time of yourself trying to get something fixed beyond your own influence. – ZF007 Mar 27 '19 at 08:47