OpenCV Contribution Modules are developed code from the community of OpenCV and are not very stable but after they got stable they will be part f OpenCV. Anyhow, there are a lot of cool modules there (fuzzy logic, sfm, cnn, …) that made me have look at them and try them.
- gflags
1 2 3 4 5 |
git clone https://github.com/gflags/gflags cd gflags cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=~/usr cmake --build build -j8 cmake --install build |
2) glog
1 2 3 4 5 |
git clone https://github.com/google/glog cd glog cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=~/usr cmake --build build -j8 cmake --install build |
3) ceres-solver
1 2 3 |
git clone https://github.com/ceres-solver/ceres-solver mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=~/usr .. && make -j8 all install |
4)OpenCV
To install them download OpenCV3 and OpenCV’s extra modules.
Add the following lines to the top of CMakeLists at root of OpenCV
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
set(gflags_DIR "$ENV{HOME}/usr/lib/cmake/gflags/") find_package(gflags REQUIRED) MESSAGE("GFLAGS_FOUND: " ${GFLAGS_FOUND}) MESSAGE("GFLAGS_INCLUDE_DIRS: " ${GFLAGS_INCLUDE_DIRS}) MESSAGE("GFLAGS_LIBRARIES: " ${GFLAGS_LIBRARIES}) MESSAGE("GFLAGS_LIBRARYRARY_DIRS: " ${GFLAGS_LIBRARYRARY_DIRS} ) add_definitions(-DCERES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE}) set(glog_DIR "$ENV{HOME}/usr/lib/cmake/glog/") find_package(glog REQUIRED) MESSAGE("GLOG_FOUND: " ${glog_FOUND}) MESSAGE("GLOG_INCLUDE_DIRS: " ${GLOG_INCLUDE_DIRS}) MESSAGE("GLOG_LIBRARY: " ${GLOG_LIBRARIES}) set(Ceres_DIR "$ENV{HOME}/usr/lib/cmake/Ceres") find_package (Ceres REQUIRED) MESSAGE("Ceres_VERSION: " ${Ceres_VERSION}) MESSAGE("CERES_INCLUDE_DIRS: " ${CERES_INCLUDE_DIRS}) MESSAGE("CERES_LIBRARIES: " ${CERES_LIBRARIES}) |
Make a build directory in OpenCV3 and changed the current directory to that, then run the following command:
1 |
cmake -DCMAKE_CXX_FLAGS=-std=c++11 -DOPENCV_EXTRA_MODULES_PATH=<path_to_opencv_contrib_directory>/opencv_contrib/modules -DOPENCV_ENABLED_NONFREE=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=~/usr .. && make -j8 all install |