1

Recently I wanted to use SIFT runing the next line: sift = cv2.xfeatures2d.SIFT_create(). And the result was: AttributeError: 'module' object has no attribute 'xfeatures2d'

The I used: conda install -c conda-forge opencv and conda install -c menpo opencv. It doestn work because I got:
cv2.error: OpenCV(4.2.0) ../opencv_contrib/modules/xfeatures2d/src/sift.cpp:1210: 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'

Later I was read some about it, and I use commands like: pip install opencv-contrib-python. Finally I tried with this but some -D arguments not be found.

I have been trying to install opencv-contrib in anaconda without success. I'm not have advanced knowledge with this.

Chacho Fuva
  • 353
  • 1
  • 4
  • 17
  • You need to build OpenCV yourself if you want the nonfree algorithms; the distributions on pip and conda do not contain them because OpenCV put them behind a build flag as of OpenCV 3.4.3. You can search up for how to build OpenCV yourself. Alternatively, you can install an older version of the PyPI package where OpenCV did not hide these algorithms behind a build flag: `pip install opencv-contrib-python==3.4.2` is the newest version before the flag IIRC. If you need a newer version, you will likely need to build OpenCV yourself. – alkasm Jan 29 '20 at 20:58
  • I try to do some days ago from [Gihub] (https://github.com/opencv/opencv_contrib) but this was the [result] (https://stackoverflow.com/questions/59901383/configuring-incomplete-installing-opencv-contrib?noredirect=1#comment105936417_59901383) – Chacho Fuva Jan 29 '20 at 21:10
  • Then this question seems more or less like a dupe of your prior Q, as the workaround of trying to install from pip or conda is not actually a solution for you. I know that building from source can be confusing, especially if you're not used to the CMake workflow. However, OpenCV's build process is a pretty standard CMake build, so I'd suggest looking up how to build C++ projects from source with CMake in general. Try it on a small example, and then build OpenCV from source. The steps will feel less arbitrary then. I linked a tutorial on your other SO question that should help, too. – alkasm Jan 29 '20 at 23:08

0 Answers0