I have seen this question pop up several places, but the only time I have seen it answered is through Visual Studio using cpp or on a Linux OS.
I am trying to add contribution modules to OpenCV and for use with Python-Anaconda in Spyder. Specifically, I am looking to add the bgsegm module. I have tried several different ways but with no success.
I have downloaded the current master branches of OpenCV and Opencv_contrib. I put them in a new folder I named opencv-3.0. In opencv I create a new folder named build. I ran command prompt in that folder and used the command:
cmake -D OPENCV_EXTRA_MODULES_PATH= ..\..\opencv_contrib\modules
which returns
the source directory "C:/opencv-3.0/opencv_contrib/modules" does not appear to contain CMakeLists.txt
What am I missing on the command line? make -j5? I dont even get the option to run it because of the error.
Alternatively when running from the cmake GUI, I'm not sure what to use as my generator. I do not have Visual Studio and that is what everyone seems to use. Even if I had VS I want to be able to use this in python and Sypder. Suggestions?
Even though you want to use Python, you will have to compile the OpenCV Contrib Modules yourself before you will be able to use it with Python.
CMake
generates Makefiles for your compiler (so get one if you don't have one), after that you can compile the Makefile/Visual Studio solution.
The error you're receiving from CMake
is because you did not specify the OpenCV source directory as the last argument. Follow the instructions here precisely.
So something like:
cd "C:/opencv-3.0/build"
cmake -DOPENCV_EXTRA_MODULES_PATH="C:/opencv-3.0/opencv_contrib/modules" "C:/opencv-3.0"