OpenCV 3.2.0 build with CUDA 8.0, TBB, extraModule
Introduction
- 현재 openCV3.2.0(최신버전, 2017.05.xx) 및 extraModule를 이용하여 cmake에서 빌드를 하는 방법은 많이 포스팅 되어있으나, 빌드가 제대로 되지 않아 포스팅 함
- openCV 2.4.10, openCV 2.4.13, openCV 3.2.0 등 x86, x64 버전에에 대해 visual studio (2010, 2013, 2015, 2017) 제각각 돌려보았으나, 각 버전별로 차이가 있음. 그러나 중요한 것은 build tools의 호환성 문제도 있지만, 초보자들에 있어 path 문제 및 버전을 제대로 맞추지 못하여 생기는 문제로 생각됨
- 아래는 다 정리하지는 못하였으나, 몇가지 유의사항을 살펴본다면 별다른 문제가 없을 것으로 생각됨(?)
environments
- Visual studio 2015 Community edition
- openCV 3.2.0 / http://opencv.org/releases.html
- openCV extra Module / https://github.com/opencv/opencv_contrib
- cmake 3.8.1 / https://cmake.org/download/
- CUDA 6.519 (x64) / https://developer.nvidia.com/cuda-toolkit-65
- additional) cuda archive link / https://developer.nvidia.com/cuda-toolkit-archive
- CUDA 8.0 (x64)
- Intel MKL(math kernel library) / https://registrationcenter.intel.com/en/forms/?productid=2558&licensetype=2
주의사항
- opencv extra module 버전 및 opencv source 버전이 맞지 않으면 build 되지 않음(* opencv source 파일로 download 할 것)
-
setting on cmake 3.8.1
check List - with_tbb
- with_cublas
- MKL_WITH_TBB
- CUDA_FAST_MATH
uncheck list - build_docs
- build_examples
- build_package
- build_perf_tests
- build_tbb (automatic uncheck from system)
- build_tests
- build_with_static_crt
-
setting the CUDA path
- cuda_toolkit_root_dir : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.5
or - cuda_toolkit_root_dir : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
- cuda_toolkit_root_dir : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.5
-
setting the tbb path
TBB_ENV_INCLUDE :- D:/SDK/_opencv_build/opencv_extra_tbb/tbb2017_20170412oss_win/tbb2017_20170412oss/include
TBB_ENV_LIB :- D:/SDK/_opencv_build/opencv_extra_tbb/tbb2017_20170412oss_win/tbb2017_20170412oss/lib/intel64/vc14/tbb.lib
TBB_ENV_LIB_DEBUG :- D:/SDK/_opencv_build/opencv_extra_tbb/tbb2017_20170412oss_win/tbb2017_20170412oss/lib/intel64/vc14/tbb_debug.lib
TBB_VER_FILE :- D:/SDK/_opencv_build/opencv_extra_tbb/tbb2017_20170412oss_win/tbb2017_20170412oss/include/tbb/tbb_stddef.h
- Note!
- visual studio 2013 : vc12
- visual studio 2015 : vc14
- x86, x64를 구분하여 tbb dll library를 선택 할 것
-
setting extra modules path
extra_modules :- D:\SDK_opencv_build\opencv_extra_modules\opencv_contrib-3.2.0_20170529\opencv_contrib-3.2.0\modules
-
setting the MKL(math kernel library), IPP(integrated performance primitives)
- OS version에 맞춰서 download 할 것
- 이후, cmake 3.8.1 버전에서 자동으로 MKL library의 path를 설정함
-
자세한건, 아래의 path (C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows)로 들어가면 각각의 library path들을 확인 가능함
Error of extra modules
OpenCVModule.cmake:260 CMake Error at cmake/OpenCVModule.cmake:260 (foreach): Syntax error in cmake code at E:/opencv/sources/cmake/OpenCVModule.cmake:260 when parsing string E:/opencv/sources/modules;EXTRA;E:\opencv\sources\modules\opencv_contrib-master\modules Invalid escape sequence \o Call Stack (most recent call first): modules/CMakeLists.txt:7 (ocv_glob_modules) Configuring incomplete, errors occurred! See also "E:/opencv/new_build/CMakeFiles/CMakeOutput.log". See also "E:/opencv/new_build/CMakeFiles/CMakeError.log". |
solve
- change the special character from "\" to "/"
Reference
[1] 다크프로그래머 blog, http://darkpgmr.tistory.com/160
[2] cvlecture, http://cvlecture.marearts.com/2017/04/opencv-opencv-32-cuda-tbb.html
* 그외 많은 블로그 혹은 구글링으로 나오는 자료들을 많이 참조하였습니다. 포스팅 전 따로 저장해두지 못하여 Reference를 남기지 못합니다.
'Library > opencv' 카테고리의 다른 글
How to set up opencv using various versions of the openCV library in Visual Studio (2) | 2021.01.26 |
---|---|
[opencv] Mat Depth (0) | 2021.01.26 |
[OpenCV] Blending (2) | 2014.04.22 |
openCV ROI 영역에 관해 (0) | 2013.11.13 |
opencv2.4.6 버전 Problem (0) | 2013.10.24 |