PyCharm: Installation of non-free OpenCV modules for operations like SIFT, SURF

后端 未结 2 677
眼角桃花
眼角桃花 2021-01-21 05:23

I want to use functions like SIFT, SURF,etc. I am using Ubuntu 16.04 on a virtual machine with OpenCV 3.4.1 and using PyCharm as the IDE.

I can open Pycharm, create a p

相关标签:
2条回答
  • 2021-01-21 06:12

    With OpenCV 3, the non-free modules, namely SIFT and SURF, which are patented by their respective creators, were moved out of the default OpenCV install and into the opencv_contrib package. The implementations in opencv_contrib are not installed by default and you need to explicitly enable them when compiling and installing OpenCV to obtain access to them.

    To get access to the original SIFT and SURF implementations found in OpenCV 2.4.X (versions with these implementations installed by default), you will need to pull down both the opencv and the opencv_contrib repositories from GitHub and then compile and install OpenCV3 from source.

    As much as I would like to provide you with the steps to do this, I want to give credit to one tutorial available online to do this instead. So, follow this sweet tutorial - Install OpenCV 3.0 and Python 3.4+ on Ubuntu and you should be able to work with these implementations. Additionally, I would suggest looking at ORB which is a faster, free alternative to SIFT and SURF, but not sure if it will serve your purpose.

    If you really don't want to work with the terminal, open a new project, Go to ->

    Settings -> Project -> Project Interpreter -> +

    Add the modules that you want by searching for them and you should be able to use them.

    0 讨论(0)
  • 2021-01-21 06:18

    I was having the same problem with opencv trying to use SIFT and SURF. I try so many ways including adding opencv-contrib and even compiling opencv using visual studio but none of those options worked for me. I would recommend to use anaconda and install opencv using the method show in this post.

    How do I install Python OpenCV through Conda?

    After installing it using

    conda install -c menpo opencv

    I was able to use without the annoying massage of "set OPENCV_ENABLE_NONFREE"

    Edit: I needed to install in on my raspberry pi and Anaconda does not work the same on raspberry pi. I do some research and I found that if you run the command below, should fix the "NON_FREE /Patent protected" error.

    pip install opencv-contrib-python==3.4.0.12

    0 讨论(0)
提交回复
热议问题