简体   繁体   English

PyCharm:为SIFT,SURF等操作安装非免费的OpenCV模块

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

I want to use functions like SIFT, SURF,etc. 我想使用SIFT,SURF等功能。 I am using Ubuntu 16.04 on a virtual machine with OpenCV 3.4.1 and using PyCharm as the IDE. 我在具有OpenCV 3.4.1的虚拟机上使用Ubuntu 16.04,并使用PyCharm作为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. 我可以打开Pycharm,创建项目,转到文件-设置-项目解释器并下载所需的模块。我已经下载了opencv-python和opencv-contrib-python。

But I still am not able to use the above mentioned fucntions. 但是我仍然无法使用上述功能。

Please help. 请帮忙。 Thanks. 谢谢。

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. 使用OpenCV 3, 非自由模块(即分别由其创建者获得专利的SIFT和SURF) 已从默认的OpenCV安装中移出,并移入了opencv_contrib软件包中。 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. 默认情况下未安装 opencv_contrib中的实现,并且在编译和安装OpenCV以获得对它们的访问权限时,需要显式启用它们。

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. 要访问OpenCV中2.4.X(版本,这些实现默认安装),发现原来SIFT和SURF的实现,需要拉下两个 OpenCV的opencv_contrib从GitHub库,然后编译并从源代码安装OpenCV3。

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. 因此,请遵循本教程,在Ubuntu上安装OpenCV 3.0和Python 3.4+ ,您应该可以使用这些实现。 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. 另外,我建议您考虑使用ORB ,它是SIFT和SURF的一种更快,免费的替代方法,但不确定是否能满足您的目的。

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. 通过搜索添加所需的模块,您应该可以使用它们。

I was having the same problem with opencv trying to use SIFT and SURF. 我在尝试使用SIFT和SURF时遇到了与opencv相同的问题。 I try so many ways including adding opencv-contrib and even compiling opencv using visual studio but none of those options worked for me. 我尝试了很多方法,包括添加opencv-contrib甚至使用Visual Studio编译opencv,但这些选项都不适合我。 I would recommend to use anaconda and install opencv using the method show in this post. 我建议使用anaconda并使用本文中显示的方法安装opencv。

How do I install Python OpenCV through Conda? 如何通过Conda安装Python OpenCV?

After installing it using 使用后安装

conda install -c menpo opencv 康达安装-c menpo opencv

I was able to use without the annoying massage of "set OPENCV_ENABLE_NONFREE" 我能够使用“ set OPENCV_ENABLE_NONFREE”的烦人消息

Edit: I needed to install in on my raspberry pi and Anaconda does not work the same on raspberry pi. 编辑:我需要在树莓派上安装,Anaconda在树莓派上无法正常工作。 I do some research and I found that if you run the command below, should fix the "NON_FREE /Patent protected" error. 我进行了一些研究,发现如果您运行以下命令,应该可以修复“ NON_FREE /受专利保护”错误。

pip install opencv-contrib-python==3.4.0.12 pip安装opencv-contrib-python == 3.4.0.12

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM