The README file of the OpenCV contrib Github page has the complete explanation on how to do so. It involves adding a CMAKE command to the list pointing out the contribution modules.
You can build OpenCV, so it will include the modules from this repository. Here is the CMake command for you:
$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5
As the result, OpenCV will be built in the <opencv_build_directory> with all modules from opencv_contrib repository. If you don't want all of the modules, use CMake's BUILD_opencv_* options. Like in this example:
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -DBUILD_opencv_legacy=OFF <opencv_source_directory>
If you prefer using the gui version of cmake (cmake-gui), then, you can add opencv_contrib modules within opencv core by doing the following:
- start cmake-gui
- select the opencv source code folder and the folder where binaries will be built (the 2 upper forms of the interface)
- press the configure button. you will see all the opencv build parameters in the central interface
- browse the parameters and look for the form called OPENCV_EXTRA_MODULES_PATH (use the search form to focus rapidly on it)
- complete this OPENCV_EXTRA_MODULES_PATH by the proper pathname to the <opencv_contrib>/modules value using its browse button.
- press the configure button followed by the generate button (the first time, you will be asked which makefile style to use)
- build the opencv core with the method you chose (make and make install if you chose Unix makfile at step 6)
Hi, i am having same problem, i need to build opencv_contrib as iOS framework but when i build it doesn't show me 'opencv/platforms/ios/build_framework.py' which i could run to create the framework. could you help, how you created the opencv2.framework file by including opencv_contrib. Any help is highly appreciated thanks.