Compile OpenCV3 with CUDA on Windows for python | nibuiroフラグメント β

Compile OpenCV3 with CUDA on Windows for python

Compile OpenCV3 with CUDA on Windows for python

Spec

  • i5-4210U
  • 8GB RAM

Waht’s Need? / env

Commands

 スタートメニューから「VS____ 用 MSBuild のコマンド プロンプト」を開き、Pythonのインタプリンタへのパスが通っていなければ通し、以下もSETしておく。
 適宜変更して~。


SET PYTHON_LIBRARIES=%PYTHONHOME%\Libs;
SET PYTHON_INCLUDE_DIRS=%PYTHONHOME%\Include;
SET INCLUDE=%PYTHONHOME%\Include;%INCLUDE%
SET LIB=%PYTHONHOME%\Libs;%LIB%
SET PATH=%PYTHONHOME%;%PYTHONHOME%\Scripts\;%PATH%

@rem e.g. “CUDA_HOST_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe”
SET CUDA_HOST_COMPILER=

@rem -G”Visual Studio 14 2015 Win64″
cmake -B”.” -H”../” -G -DBUILD_opencv_world=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_CUDA=ON -DENABLE_FAST_MATH=ON -DWITH_MKL=ON -DMKL_USE_MULTITHREAD=ON -DMKL_WITH_TBB=ON -DWITH_TBB=ON -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DBUILD_opencv_python3=ON -DBUILD_opencv_python_bindings_generator=ON -DEIGEN_INCLUDE_PATH=”D:\compile_ocv\eigen” -DWITH_EIGEN=ON -DOPENCV_EXTRA_MODULES_PATH=”D:\compile_ocv\opencv_contrib\modules” -DOPENCV_ENABLE_NONFREE=ON -DCMAKE_INSTALL_PREFIX=”D:\compile_ocv\opencv\build”

MSBuild OpenCV.sln /t:build /p:Configuration=Release;Platform=”x64″
MSBuild INSTALL.vcxproj /t:build /p:Configuration=Release;Platform=”x64″

SET cvDLL=.\x64\\bin\
xcopy /f %cvDLL%\opencv_ffmpeg343_64.dll %cvDLL%\opencv_img_hash343.dll %cvDLL%\opencv_world343.dll %PYTHONHOME%\Lib\site-packages\

Result

経過時間 01:37:23.58
* Size
About 6GB.


Reference: