您的位置:首页 > 运维架构

compile opencv2.4.11 with gpu support

2015-12-24 15:45 417 查看

注意:

我按照下面的方法配置之后出现了一些问题,之后更换了配置。主要是
(1)在Cmake编译时,不使用默认的编译器(之前默认的是qt的编译器),而采用手动更换到VS2012的cl.exe编译器
(2)在Cmake编译时,取消with tbb和withopengl选项
最后有我的详细配置,大家可以参考



preparation:

Win7 64-bit + CUDA7.5 + OpenCV2.4.11 + CMake + tbb

Step 1:

Build OpenCV by CMake

(1) browse src dir and build dir. click "Advance". press Configure. Choose "Visual Studio 11 2012 Win64"



(2) cancel "BUILD_DOCS" and "BUILD_SAMPLES". cancel "CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE"



"CUDA_GENERATION" = Kepler.



click ""WITH_CUBLAS" "WITH_CUDA" "WITH_OPENGL" "WITH_TBB" (tbb is optinal)

press Configure





(3) check opengl dirs and tbb dirs. opengl and glu lib are in C:/Windows/System32/. Just choose the dll file.

tbb dirs are in the pic below:



(4) press Configure. If everything is right, there will be no RED. Then press Generate. "Generate done" implies that opencv is built successfully.

Step 2:

Build OpenCV in VS2012

(1) open OpenCV.sln in the build dir above as administrator.

(2) Make sure the cudabin include lib
path is in the project

(3)browse down to opencv_gpu –> Properties –> C/C++ and
make sure that Code Generation is either Multithreaded Debug or Multithreaded depending
upon your configuration (Debug or Release). Also move down to Linker –> Input and add libcmtd and libcmt in
theIgnore Specific Libraryfield.

(4)I suggust build opencv_gpu and opencv_core fisrt. Then build the whole project and finally the install project.

(5)After build successfully, you can find the new binary files in the install file

详细配置:

Checking for Windows (Phone) Platform SDK 8.0/8.1
Checking for Visual Studio 2012/2013
CUDA detected: 7.5
CUDA NVCC target flags:-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35
Could NOT find JNI (missing: JAVA_AWT_LIBRARYJAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)

Assume that non-module dependency is available: cudart(for module opencv_core)
Assume that non-module dependency is available: nppc (formodule opencv_core)
Assume that non-module dependency is available: nppi (formodule opencv_core)
Assume that non-module dependency is available: npps (formodule opencv_core)
General configuration for OpenCV 2.4.11=====================================
Version control: unknown
Platform:
Host: Windows 6.1.7601 AMD64
CMake: 3.4.1
CMake generator: Visual Studio 11 2012 Win64
CMake build tool:C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe
MSVC: 1700
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/Program Files (x86)/Microsoft VisualStudio 11.0/VC/bin/x86_amd64/cl.exe (ver 17.0.61030.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /MD /O2 /Ob2 /D NDEBUG /Zi
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /D_DEBUG /MDd /Zi /Ob0 /Od/RTC1

C Compiler: C:/Program Files (x86)/Microsoft VisualStudio 11.0/VC/bin/x86_amd64/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MD /O2 /Ob2 /D NDEBUG /Zi
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1

Linker flags (Release): /machine:x64 /INCREMENTAL:NO/debug
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
Precompiled headers: YES
OpenCV modules:
To be built: core flann imgproc highgui features2dcalib3d ml video legacy objdetect photo gpu ocl nonfree contrib pythonstitching superres ts videostab
Disabled: world
Disabled by dependency: -
Unavailable: androidcamera dynamicuda java viz
Windows RT support: NO
GUI:
QT: NO
Win32 UI: YES
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.7)
JPEG: build (ver 62)
PNG: build (ver 1.5.12)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
codec: YES (ver 55.18.102)
format: YES (ver 55.12.100)
util: YES (ver 52.38.100)
swscale: YES (ver 2.3.100)
gentoo-style: YES
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Other third-party libraries:
Use IPP: NO
Use Eigen: NO
Use TBB: NO
Use OpenMP: NO
Use GCD NO
Use Concurrency YES
Use C=: NO
Use Cuda: YES (ver 7.5)
Use OpenCL: YES
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: NO
USE NVCUVID: NO
NVIDIA GPU arch: 30 35
NVIDIA PTX archs:
Use fast math: NO
OpenCL:
Version: dynamic
Include path:D:/src/opencv/sources/3rdparty/include/opencl/1.2
Use AMD FFT: NO
Use AMD BLAS: NO
Python:
Interpreter: C:/Python27/python.exe (ver 2.7.10)
Libraries: C:/Python27/libs/python27.lib (ver 2.7.10+)
numpy: C:/Python27/lib/site-packages/numpy/core/include(ver 1.8.1)
packages path: C:/Python27/Lib/site-packages
Java:
ant: NO
JNI: NO
Java tests: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: D:/build/opencv/install
cvconfig.h is in: D:/build/opencv
-----------------------------------------------------------------
Configuring done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: