Search code examples
python-3.xopencvpycharmubuntu-16.04opencv-contrib

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


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 project, go to file - settings - Project interpreter and download the modules I need.I have downloaded opencv-python and opencv-contrib-python.

But I still am not able to use the above mentioned fucntions.

Please help. Thanks.


Solution

  • 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.