I am using OpenCV 3.1.0 , Python 2.7.11 and Windows 10. I want to build the extra modules (opencv_contrib) into OpenCV.
I follow the step in this GitHub.
$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5
When I type cmake _DOPENCV_EXTRA_MODULES_PATH=C:\opencv_contrib\opencv_contrib/modules C:\opencv\sources
, there is an error.
I am looking for help how can I solve it. Thank you.
I have made a tutorial on how to compile and build your own OpenCV 3.1.0-dev from scratch. It is simple and organized and works with me very well. If you have time to recompile OpenCV check out the tutorial.
The steps to follow are:
opencv-3.1.0-dev
and in this directory create other two directories one calledbuild
and the other calledsources
. Thepaths
will beopencv-3.1.0-dev\build
andopencv-3.1.0-dev\sources
.opencv-master.zip
andopencv_contrib-master.zip
opencv
andopencv_contrib
directoriesgenerating is done
before continuing.OpenCV.sln
. Right click on this .sln file and open it with the visual studio 2013 used in CMake.Be patient as this step and the next will take a lot of time.
Release
. These step take about 10 to 15 minutes..dll
files [present atopencv-3.1.0-dev\build\bin\Release
] and thecv2.pyd
and paste them in thesite-packages
directory inPyhton27\Lib\site-packages
.import cv2
. If no errors, executecv2.__version__
, and you should get3.1.0-dev
.If anything is not clear please watch the tutorial provided at the beginning of this answer.
It seems that you have no compiler installed or it is not found.
I have successfully worked with this guide:
http://docs.opencv.org/3.0-rc1/d5/de5/tutorial_py_setup_in_windows.html
However, it was necessary to use Visual Studio 12 2013, other versions did not work.
If you follow the instruction to install the pre-build libraries from here, then you will not need any compiler.
The same page has instructions for Installation by Making Your Own Libraries from the Source Files with sample instructions that use Visual Studio.
I have successfully compiled OpenCV 2.4 and 3.0 using those instructions as is.
The answer of foo bar is the best simple way to add opencv_contrib to python. But opencv_python-3.2.0.7-cp27-cp27m-win_amd64.whl is just for AMD chips. If you run it on Intel chip you will receive error message like this: "XXX is not a supported wheel on this platform". In this case, you must use opencv_python-3.2.0.7-cp27-cp27m-win32.whl.
For Python 3.6/3.5 you could use *.whl (Python on Wheels) module from here:
For Python 2.7 there is no opencv+contrib in one module, but you could separately install opencv module without contrib from here at the end of the page and then add
opencv-contrib-python
module:Do not mix opencv+contrib
opencv-python (3.2.0+contrib)
andopencv-contrib-python (3.2.0.7)
modules, otherwise your "import cv2
" stop to work till you deleteopencv-contrib-python
module.no need for complex stuff, just uninstall the version of opencv you have and do:
Good luck, Amber