0

Trace

I am getting some opencv errors with when using an open-source software library that uses for which it is a dependency. I have tried some of the suggestions listed here: AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' [Opencv 3.4.3]

What has been done so far:

  • sudo pip uninstall opencv-python

  • sudo pip uninstall opencv-python

  • pip install opencv-python==3.4.2.16 pip install opencv-contrib-python==3.4.2.16

  • pip3 install opencv-contrib-python==4.2.0.32

The latest error after calling "pip3 install opencv-contrib-python==4.2.0.32" is "OpenCV(3.4.4) ../opencv_contrib/modules/xfeatures2d/src/sift.cpp:1205: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create'"

F.Dunbar
  • 37
  • 6

2 Answers2

0

pip3 install opencv-contrib-python==4.2.0

For Anaconda User just this instead of pip

conda install -c menpo opencv

Wahib Mzali
  • 120
  • 5
  • used "pip3 install opencv-contrib-python==4.2.0.32", which seemed to work but am now getting ** OpenCV(3.4.4) ../opencv_contrib/modules/xfeatures2d/src/sift.cpp:1205: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create' ** – F.Dunbar May 12 '20 at 03:07
0

First the bad news: you won't be able to get SIFT or SURF from pre-built binaries > 3.4.2. This is because those algorithms are patented.

The good news is that the patent expired on March 7, 2020. The developers of OpenCV are aware of this issue and new binaries will eventually be built.

Until then you have 3 options:

  1. wait
  2. install an older version for now while you wait
  3. use one of the free algos developed by OpenCV
  4. compile OpenCV yourself with SIFT and SURF enabled

Good luck

UPDATE

Starting with

  • 3.4.11 and up (in the 3.X series)
  • 4.4.0 and up (in the 4.X series)

SIFT is now included. This is noted in the Release Notes

bfris
  • 5,272
  • 1
  • 20
  • 37