在CUDA8.0下指定位置编译安装OpenCV3.1.0

一、本人电脑配置:ubuntu 14.04, NVIDIA GTX1060。

二、编译OpenCV3.1.0前,读者需要成功安装CUDA8.0(网上有相关教程)。

三、在CUDA8.0下编译安装OpenCV3.1.0。

1. 安装依赖库

. sudo apt-get update
. sudo apt-get install libopencv-dev build-essential checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394--dev libxine-dev libgstreamer0.-dev libgstreamer-plugins-base0.-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils
. sudo add-apt-repository ppa:jon-severinsson/ffmpeg
. sudo apt-get update
. sudo apt-get install ffmpeg
. sudo apt-get install frei0r-plugins

2. 下载OpenCV资源

在OpenCV官网:https://opencv.org/releases.html,选择3.1.0,点击Source,下载opencv-3.1.0源码文件夹。

本人将opencv-3.1.0文件夹放置到 /home/yuanlibin目录下。

3. 编译安装

. cd opencv-3.1.
. mkdir build
. cd build
. cmake \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local/opencv_3.1.0 \
-D WITH_CUDA=ON \
-D WITH_CUBLAS=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_CUFFT=ON \
-D WITH_NVCUVID=ON \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
-D WITH_OPENGL=ON \
-D WITH_FFMPEG=ON \
-D INSTALL_C_EXAMPLES=ON \
-D BUILD_EXAMPLES=ON \
..

编译出现错误(1)如下:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nvcuvid_LIBRARY (ADVANCED)
linked by target "opencv_cudacodec" in directory /home/yuanlibin/opencv-3.1./modules/cudacodec -- Configuring incomplete, errors occurred!
See also "/home/yuanlibin/opencv-3.1.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/yuanlibin/opencv-3.1.0/build/CMakeFiles/CMakeError.log".

解决方法:https://askubuntu.com/questions/691889/opencv-with-cuda-on-ubuntu-14-04-installation-error/691931#691931?newreg=470a4d740d374683be7b530f5df59393

The problem was the missing libnvcuvid library which could be solved with the two following commands:

. sudo ln -s /usr/lib/nvidia-/libnvcuvid.so /usr/lib/libnvcuvid.so
. sudo ln -s /usr/lib/nvidia-/libnvcuvid.so. /usr/lib/libnvcuvid.so.

This solves the cmake error and afterwards allows to use the cuda video codec with opencv.
(说明:ln是linux中一个非常重要命令。它的功能是为某一个文件在另外一个位置建立一个同步的软链接,这个命令最常用的参数是-s,具体用法是:ln -s 源文件路径 目标文件路径。)

再次编译之后,终端显示如下:

……
Parallel framework: pthreads
--
-- Other third-party libraries:
-- Use IPP: 9.0. [9.0.]
-- at: /home/yuanlibin/opencv-3.1./3rdparty/ippicv/unpack/ippicv_lnx
-- Use IPP Async: NO
-- Use VA: NO
-- Use Intel VA-API/OpenCL: NO
-- Use Eigen: YES (ver 3.2.)
-- Use Cuda: YES (ver 8.0)
-- Use OpenCL: YES
-- Use custom HAL: NO
--
-- NVIDIA CUDA
-- Use CUFFT: YES
-- Use CUBLAS: YES
-- USE NVCUVID: YES
-- NVIDIA GPU arch:
-- NVIDIA PTX archs:
-- Use fast math: YES
……

然后执行以下命令:

. make -j4

编译出现错误(2)如下:

[ %] Building CXX object modules/cudacodec/CMakeFiles/opencv_cudacodec.dir/src/video_reader.cpp.o
make[]: *** No rule to make target `/usr/lib/libnvcuvid.so', needed by `lib/libopencv_cudacodec.so.3.1.0'. Stop.
make[]: *** Waiting for unfinished jobs....
[ %] Building CXX object modules/cudacodec/CMakeFiles/opencv_cudacodec.dir/src/cuvid_video_source.cpp.o
make[]: *** [modules/cudacodec/CMakeFiles/opencv_cudacodec.dir/all] Error
make[]: *** Waiting for unfinished jobs....
Scanning dependencies of target opencv_cudafilters
[ %] Building CXX object modules/cudafilters/CMakeFiles/opencv_cudafilters.dir/src/filtering.cpp.o
Linking CXX shared library ../../lib/libopencv_cudafilters.so
[ %] Built target opencv_cudafilters
make: *** [all] Error
yuanlibin@yuanlibin:~/opencv-3.1./build$

解决方法:http://answers.opencv.org/question/41575/no-rule-to-make-target-usrliblibnvcuvidso-needed-by-liblibopencv_gpuso2/

Find out where libnvcuvid.so is located and create a softlink to it:

. locate libnvcuvid.so
. sudo ln -s /path/to/found/libnvcuvid.so /usr/lib/libnvcuvid.so

locate命令找到相应的路径。

yuanlibin@yuanlibin:~/opencv-3.1./build$ locate libnvcuvid.so
/usr/lib/nvidia-/libnvcuvid.so
/usr/lib/nvidia-/libnvcuvid.so.
/usr/lib/nvidia-/libnvcuvid.so.367.57
/usr/lib32/nvidia-/libnvcuvid.so
/usr/lib32/nvidia-/libnvcuvid.so.
/usr/lib32/nvidia-/libnvcuvid.so.367.57
yuanlibin@yuanlibin:~/opencv-3.1./build$

本文软链接命令如下:

. sudo ln -s /usr/lib/nvidia-/libnvcuvid.so /usr/lib/libnvcuvid.so

如果显示已经存在,把相应的/usr/lib/libnvcuvid.so删除,重新编译。

编译出现错误(3)如下:

……
[ %] Building CXX object modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o
/home/yuanlibin/opencv-3.1./modules/cudalegacy/src/graphcuts.cpp::: error: ‘NppiGraphcutState’ has not been declared
typedef NppStatus (*init_func_t)(NppiSize oSize, NppiGraphcutState** ppState, Npp8u* pDeviceMem);
^
/home/yuanlibin/opencv-3.1./modules/cudalegacy/src/graphcuts.cpp::: error: expected type-specifier before ‘NppiGraphcutState’
operator NppiGraphcutState*()
^
/home/yuanlibin/opencv-3.1./modules/cudalegacy/src/graphcuts.cpp::: error: ‘NppiGraphcutState’ does not name a type
NppiGraphcutState* pState;
^
In file included from /home/yuanlibin/opencv-3.1./build/modules/cudalegacy/precomp.hpp:::
/home/yuanlibin/opencv-3.1./modules/cudalegacy/src/graphcuts.cpp: In constructor ‘{anonymous}::NppiGraphcutStateHandler::NppiGraphcutStateHandler(NppiSize, Npp8u*, {anonymous}::init_func_t)’:
/home/yuanlibin/opencv-3.1./modules/cudalegacy/src/graphcuts.cpp::: error: ‘pState’ was not declared in this scope
nppSafeCall( func(sznpp, &pState, pDeviceMem) );
^
/home/yuanlibin/opencv-3.1./modules/core/include/opencv2/core/private.cuda.hpp::: note: in definition of macro ‘nppSafeCall’
#define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
^
/home/yuanlibin/opencv-3.1./modules/cudalegacy/src/graphcuts.cpp: In destructor ‘{anonymous}::NppiGraphcutStateHandler::~NppiGraphcutStateHandler()’:
/home/yuanlibin/opencv-3.1./modules/cudalegacy/src/graphcuts.cpp::: error: ‘pState’ was not declared in this scope
nppSafeCall( nppiGraphcutFree(pState) );
^
……

解决方法:http://blog.csdn.net/xuzhongxiong/article/details/52717285

这是因为opecv3.0与cuda8.0不兼容导致的。修改 /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp文件内容,如下:

//#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)//ziji zhushi
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION>=8000)//ziji tianjia

重新编译出现错误(4)如下:

[ %] Building CXX object samples/gpu/CMakeFiles/example_gpu_opticalflow_nvidia_api.dir/opticalflow_nvidia_api.cpp.o
Linking CXX executable ../../bin/gpu-example-opengl
CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o: In function `draw(void*)':
opengl.cpp:(.text._Z4drawPv+0x21): undefined reference to `glRotated'
CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o: In function `main':
opengl.cpp:(.text.startup.main+0x4ae): undefined reference to `glMatrixMode'
opengl.cpp:(.text.startup.main+0x4b3): undefined reference to `glLoadIdentity'
opengl.cpp:(.text.startup.main+0x4d8): undefined reference to `gluPerspective'
opengl.cpp:(.text.startup.main+0x4e2): undefined reference to `glMatrixMode'
opengl.cpp:(.text.startup.main+0x4e7): undefined reference to `glLoadIdentity'
opengl.cpp:(.text.startup.main+0x519): undefined reference to `gluLookAt'
opengl.cpp:(.text.startup.main+0x523): undefined reference to `glEnable'
opengl.cpp:(.text.startup.main+0x54b): undefined reference to `glTexParameteri'
opengl.cpp:(.text.startup.main+0x55f): undefined reference to `glTexEnvi'
opengl.cpp:(.text.startup.main+0x569): undefined reference to `glDisable'
collect2: error: ld returned exit status
Linking CXX executable ../../bin/gpu-example-optical_flow
make[]: *** [bin/gpu-example-opengl] Error
make[]: *** [samples/gpu/CMakeFiles/example_gpu_opengl.dir/all] Error
make[]: *** Waiting for unfinished jobs....
[ %] Built target example_gpu_optical_flow

解决方法:https://github.com/opencv/opencv/issues/5859

For fixing the problem, one more permanent solution is to add in /home/yuanlibin/opencv-3.1.0/samples/gpu/CMakeLists.txt the following lines:

find_package(OpenGL REQUIRED)#ziji tianjia
find_package(GLUT REQUIRED)#ziji tianjia #ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})#yuanlaide
ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS} ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})#ziji tianjia

最终编译成功,终端显示如下:

[ %] Build Java tests
Linking CXX executable ../../bin/cpp-tutorial-video-write
Buildfile: /home/yuanlibin/opencv-3.1./build/modules/java/pure_test/.build/build.xml
[ %] Built target tutorial_video-write
Linking CXX executable ../../bin/cpp-tutorial-video-input-psnr-ssim
Linking CXX executable ../../bin/cpp-tutorial-planar_tracking build: compile:
[javac] Compiling source files to /home/yuanlibin/opencv-3.1./build/modules/java/pure_test/.build/build/classes
[ %] Built target tutorial_planar_tracking
[ %] Built target tutorial_video-input-psnr-ssim jar:
[jar] Building jar: /home/yuanlibin/opencv-3.1./build/modules/java/pure_test/.build/build/jar/opencv-test.jar BUILD SUCCESSFUL
Total time: seconds
[%] Built target opencv_test_java
yuanlibin@yuanlibin:~/opencv-3.1./build$

再执行一次,终端显示如下:

yuanlibin@yuanlibin:~/opencv-3.1./build$ make -j4
[ %] [ %] [ %] Built target opencv_ts_pch_dephelp
Built target opencv_cudev
Built target opencv_core_pch_dephelp
[ %] Built target libwebp
[ %] [ %] Built target opencv_imgproc_pch_dephelp
Built target opencv_imgcodecs_pch_dephelp
[ %] Built target opencv_highgui_pch_dephelp
[ %] [ %] Built target opencv_perf_core_pch_dephelp
Built target opencv_videoio_pch_dephelp
[ %] Built target opencv_cudaarithm_pch_dephelp
[ %] Built target opencv_perf_cudaarithm_pch_dephelp
[ %] [ %] Built target opencv_test_core_pch_dephelp
Built target opencv_test_cudaarithm_pch_dephelp
[ %] Built target opencv_flann_pch_dephelp
[ %] Built target opencv_test_flann_pch_dephelp
[ %] Built target opencv_perf_imgproc_pch_dephelp
[ %] Built target opencv_test_imgproc_pch_dephelp
[ %] Built target opencv_test_ml_pch_dephelp
[ %] [ %] Built target opencv_ml_pch_dephelp
Built target opencv_video_pch_dephelp
[ %] [ %] Built target opencv_test_video_pch_dephelp
Built target opencv_perf_video_pch_dephelp
[ %] [ %] Built target opencv_test_viz_pch_dephelp
Built target opencv_viz_pch_dephelp
[ %] Built target opencv_perf_cudabgsegm_pch_dephelp
[ %] Built target opencv_cudabgsegm_pch_dephelp
[ %] [ %] Built target opencv_test_cudabgsegm_pch_dephelp
Built target opencv_cudafilters_pch_dephelp
[ %] Built target opencv_perf_cudafilters_pch_dephelp
[ %] Built target opencv_test_cudafilters_pch_dephelp
[ %] [ %] Built target opencv_perf_cudaimgproc_pch_dephelp
Built target opencv_cudaimgproc_pch_dephelp
[ %] Built target opencv_test_cudaimgproc_pch_dephelp
[ %] Built target opencv_cudawarping_pch_dephelp
[ %] Built target opencv_perf_cudawarping_pch_dephelp
[ %] Built target opencv_test_cudawarping_pch_dephelp
[ %] Built target opencv_perf_imgcodecs_pch_dephelp
[ %] Built target opencv_perf_photo_pch_dephelp
[ %] Built target opencv_photo_pch_dephelp
[ %] Built target opencv_test_imgcodecs_pch_dephelp
[ %] Built target opencv_test_photo_pch_dephelp
[ %] [ %] [ %] Built target opencv_test_shape_pch_dephelp
Built target opencv_shape_pch_dephelp
Built target opencv_perf_videoio_pch_dephelp
[ %] [ %] [ %] [ %] Built target opencv_test_cudacodec_pch_dephelp
Built target opencv_perf_cudacodec_pch_dephelp
Built target opencv_cudacodec_pch_dephelp
Built target opencv_test_videoio_pch_dephelp
[ %] [ %] [ %] Built target opencv_perf_objdetect_pch_dephelp
Built target opencv_test_highgui_pch_dephelp
Built target opencv_test_objdetect_pch_dephelp
[ %] Built target opencv_objdetect_pch_dephelp
[ %] [ %] Built target opencv_perf_features2d_pch_dephelp
Built target opencv_test_features2d_pch_dephelp
[ %] Built target opencv_features2d_pch_dephelp
[ %] Built target opencv_calib3d_pch_dephelp
[ %] [ %] Built target opencv_perf_calib3d_pch_dephelp
Built target opencv_test_calib3d_pch_dephelp
[ %] [ %] Built target opencv_perf_cudafeatures2d_pch_dephelp
Built target opencv_cudafeatures2d_pch_dephelp
[ %] Built target opencv_test_cudafeatures2d_pch_dephelp
[ %] Built target opencv_cudalegacy_pch_dephelp
[ %] Built target opencv_perf_cudalegacy_pch_dephelp
[ %] [ %] Built target opencv_test_cudalegacy_pch_dephelp
Built target opencv_cudaobjdetect_pch_dephelp
[ %] Built target opencv_perf_cudaobjdetect_pch_dephelp
[ %] Built target opencv_test_cudaobjdetect_pch_dephelp
[ %] [ %] Built target opencv_perf_cudaoptflow_pch_dephelp
Built target opencv_test_cudaoptflow_pch_dephelp
[ %] Built target opencv_cudaoptflow_pch_dephelp
[ %] Built target opencv_cudastereo_pch_dephelp
[ %] Built target opencv_test_cudastereo_pch_dephelp
[ %] Built target opencv_perf_cudastereo_pch_dephelp
[ %] Built target opencv_perf_stitching_pch_dephelp
[ %] [ %] [ %] Built target opencv_stitching_pch_dephelp
Built target opencv_test_stitching_pch_dephelp
Built target opencv_perf_superres_pch_dephelp
[ %] [ %] [ %] Built target opencv_superres_pch_dephelp
Built target opencv_test_superres_pch_dephelp
Built target pch_Generate_opencv_ts
[ %] Built target opencv_videostab_pch_dephelp
[ %] [ %] [ %] Built target pch_Generate_opencv_imgcodecs
Built target pch_Generate_opencv_core
Built target pch_Generate_opencv_imgproc
[ %] Built target pch_Generate_opencv_videoio
[ %] [ %] Built target pch_Generate_opencv_highgui
Built target pch_Generate_opencv_test_core
[ %] [ %] Built target pch_Generate_opencv_perf_core
Built target pch_Generate_opencv_cudaarithm
[ %] Built target pch_Generate_opencv_perf_cudaarithm
[ %] Built target pch_Generate_opencv_test_cudaarithm
[ %] [ %] Built target pch_Generate_opencv_flann
Built target pch_Generate_opencv_test_flann
[ %] [ %] Built target pch_Generate_opencv_perf_imgproc
Built target pch_Generate_opencv_test_imgproc
[ %] [ %] Built target pch_Generate_opencv_ml
Built target pch_Generate_opencv_test_ml
[ %] [ %] Built target pch_Generate_opencv_video
Built target pch_Generate_opencv_perf_video
[ %] Built target pch_Generate_opencv_viz
[ %] [ %] Built target pch_Generate_opencv_test_video
Built target pch_Generate_opencv_test_viz
[ %] Built target pch_Generate_opencv_cudabgsegm
[ %] Built target pch_Generate_opencv_perf_cudabgsegm
[ %] [ %] Built target pch_Generate_opencv_test_cudabgsegm
Built target pch_Generate_opencv_cudafilters
[ %] Built target pch_Generate_opencv_perf_cudafilters
[ %] Built target pch_Generate_opencv_test_cudafilters
[ %] Built target pch_Generate_opencv_cudaimgproc
[ %] Built target pch_Generate_opencv_perf_cudaimgproc
[ %] Built target pch_Generate_opencv_test_cudaimgproc
[ %] Built target pch_Generate_opencv_cudawarping
[ %] [ %] [ %] Built target pch_Generate_opencv_perf_cudawarping
Built target pch_Generate_opencv_perf_imgcodecs
Built target pch_Generate_opencv_test_cudawarping
[ %] Built target pch_Generate_opencv_test_imgcodecs
[ %] [ %] [ %] Built target pch_Generate_opencv_perf_photo
Built target pch_Generate_opencv_photo
Built target pch_Generate_opencv_test_photo
[ %] [ %] [ %] Built target pch_Generate_opencv_shape
Built target pch_Generate_opencv_test_videoio
Built target pch_Generate_opencv_test_shape
[ %] Built target pch_Generate_opencv_perf_videoio
[ %] [ %] Built target pch_Generate_opencv_cudacodec
Built target pch_Generate_opencv_perf_cudacodec
[ %] Built target pch_Generate_opencv_test_cudacodec
[ %] Built target pch_Generate_opencv_test_highgui
[ %] [ %] [ %] Built target pch_Generate_opencv_objdetect
Built target pch_Generate_opencv_perf_objdetect
Built target pch_Generate_opencv_test_objdetect
[ %] Built target pch_Generate_opencv_features2d
[ %] [ %] [ %] Built target pch_Generate_opencv_test_features2d
Built target pch_Generate_opencv_perf_features2d
Built target pch_Generate_opencv_calib3d
[ %] Built target pch_Generate_opencv_perf_calib3d
[ %] [ %] Built target pch_Generate_opencv_test_calib3d
Built target pch_Generate_opencv_cudafeatures2d
[ %] [ %] Built target pch_Generate_opencv_test_cudafeatures2d
Built target pch_Generate_opencv_perf_cudafeatures2d
[ %] [ %] Built target pch_Generate_opencv_perf_cudalegacy
Built target pch_Generate_opencv_cudalegacy
[ %] Built target pch_Generate_opencv_cudaobjdetect
[ %] [ %] Built target pch_Generate_opencv_test_cudaobjdetect
Built target pch_Generate_opencv_perf_cudaobjdetect
[ %] Built target pch_Generate_opencv_test_cudalegacy
[ %] Built target pch_Generate_opencv_cudaoptflow
[ %] [ %] Built target pch_Generate_opencv_test_cudaoptflow
Built target pch_Generate_opencv_perf_cudaoptflow
[ %] [ %] Built target pch_Generate_opencv_cudastereo
Built target pch_Generate_opencv_perf_cudastereo
[ %] Built target pch_Generate_opencv_perf_stitching
[ %] Built target pch_Generate_opencv_test_cudastereo
[ %] Built target pch_Generate_opencv_stitching
[ %] Built target pch_Generate_opencv_test_stitching
[ %] [ %] Built target pch_Generate_opencv_perf_superres
Built target pch_Generate_opencv_superres
[ %] Built target pch_Generate_opencv_test_superres
[ %] Built target pch_Generate_opencv_videostab
[ %] Built target opencv_core
[ %] Built target opencv_flann
[ %] Built target opencv_ml
[ %] Built target opencv_viz
[ %] Built target opencv_imgproc
[ %] Built target opencv_cudaarithm
[ %] [ %] Built target opencv_cudawarping
Built target opencv_video
[ %] Built target opencv_imgcodecs
[ %] Built target opencv_shape
[ %] Built target opencv_cudabgsegm
[ %] Built target opencv_videoio
[ %] Built target opencv_cudafilters
[ %] Built target opencv_highgui
[ %] Built target opencv_cudacodec
[ %] Built target opencv_objdetect
[ %] Built target opencv_annotation
[ %] Built target opencv_ts
[ %] Built target opencv_perf_core
[ %] Built target opencv_features2d
[ %] Built target opencv_perf_cudaarithm
[ %] Built target opencv_cudaimgproc
[ %] Built target opencv_test_cudev
[ %] Built target opencv_test_cudaarithm
[ %] Built target opencv_test_flann
[ %] Built target opencv_test_core
[ %] Built target opencv_test_ml
[ %] [ %] Built target opencv_perf_video
Built target opencv_perf_imgproc
[ %] Built target opencv_test_video
[ %] [ %] Built target opencv_perf_cudabgsegm
Built target opencv_test_viz
[ %] Built target opencv_test_cudabgsegm
[ %] [ %] Built target opencv_perf_cudafilters
Built target opencv_test_cudafilters
[ %] [ %] Built target opencv_test_cudaimgproc
Built target opencv_perf_cudaimgproc
[ %] Built target opencv_perf_cudawarping
[ %] Built target opencv_perf_imgcodecs
[ %] Built target opencv_test_cudawarping
[ %] [ %] [ %] Built target opencv_test_imgcodecs
Built target opencv_test_imgproc
Built target opencv_test_shape
[ %] Built target opencv_perf_videoio
[ %] Built target opencv_perf_cudacodec
[ %] [ %] Built target opencv_test_cudacodec
Built target opencv_test_videoio
[ %] Built target opencv_photo
[ %] Built target opencv_test_highgui
[ %] Built target opencv_perf_objdetect
[ %] Built target opencv_perf_features2d
[ %] Built target opencv_test_objdetect
[ %] Built target opencv_test_features2d
[ %] Built target opencv_perf_photo
[ %] Built target opencv_test_photo
[ %] Built target opencv_calib3d
[ %] Built target opencv_cudafeatures2d
[ %] Built target opencv_perf_calib3d
[ %] Built target opencv_test_calib3d
[ %] Built target opencv_cudastereo
[ %] Built target opencv_createsamples
[ %] Built target opencv_cudalegacy
[ %] Built target opencv_traincascade
[ %] Built target example_tapi_bgfg_segm
[ %] Built target example_tapi_camshift
[ %] [ %] Built target example_tapi_hog
Built target example_tapi_clahe
[ %] Built target example_tapi_pyrlk_optical_flow
[ %] Built target example_tapi_squares
[ %] Built target example_tapi_tvl1_optical_flow
[ %] Built target example_tapi_ufacedetect
[ %] Built target opencv_perf_cudafeatures2d
[ %] Built target opencv_test_cudafeatures2d
[ %] Built target opencv_java
[ %] Built target opencv_perf_cudalegacy
[ %] Built target opencv_perf_cudastereo
[ %] Built target opencv_cudaobjdetect
[ %] [ %] Built target opencv_test_cudastereo
Built target opencv_test_cudalegacy
[ %] Built target opencv_cudaoptflow
[ %] Built target opencv_test_java_properties
[ %] Built target opencv_test_cudaobjdetect
[ %] Built target opencv_perf_cudaobjdetect
[ %] Built target opencv_perf_cudaoptflow
[ %] Built target opencv_test_cudaoptflow
[ %] Built target opencv_test_java
[ %] Built target opencv_stitching
[ %] Built target opencv_superres
[ %] Built target opencv_test_stitching
[ %] Built target opencv_perf_stitching
[ %] Built target opencv_perf_superres
[ %] Built target opencv_test_superres
[ %] [ %] [ %] Built target example_gpu_bgfg_segm
Built target opencv_videostab
Built target example_gpu_alpha_comp
[ %] Built target example_gpu_cascadeclassifier
[ %] Built target example_gpu_driver_api_multi
[ %] [ %] Built target example_gpu_cascadeclassifier_nvidia_api
Built target example_gpu_driver_api_stereo_multi
[ %] [ %] Built target example_gpu_farneback_optical_flow
Built target example_gpu_generalized_hough
[ %] [ %] Built target example_gpu_houghlines
Built target example_gpu_hog
[ %] [ %] Built target example_gpu_multi
Built target example_gpu_morphology
[ %] [ %] Built target example_gpu_optical_flow
Built target example_gpu_opengl
[ %] Built target example_gpu_performance
[ %] Built target example_gpu_opticalflow_nvidia_api
[ %] Built target example_gpu_stereo_match
[ %] Built target example_gpu_pyrlk_optical_flow
[ %] Built target example_gpu_stereo_multi
[ %] Built target example_gpu_super_resolution
[ %] Built target example_gpu_video_reader
[ %] Built target example_gpu_surf_keypoint_matcher
[ %] Built target example_gpu_video_writer
[ %] Built target opencv_python2
[ %] Built target opencv_python3
[ %] Built target cpp-tutorial-pnp_detection
[ %] Built target example_3calibration
[ %] [ %] Built target example_autofocus
Built target cpp-tutorial-pnp_registration
[ %] Built target example_bgfg_segm
[ %] [ %] Built target example_calibration
Built target example_cloning_demo
[ %] Built target example_camshiftdemo
[ %] Built target example_cloning_gui
[ %] [ %] Built target example_contours2
Built target example_connected_components
[ %] Built target example_convexhull
[ %] Built target example_cout_mat
[ %] [ %] Built target example_create_mask
Built target example_dbt_face_detection
[ %] Built target example_delaunay2
[ %] Built target example_demhist
[ %] Built target example_detect_mser
[ %] Built target example_detect_blob
[ %] Built target example_dft
[ %] Built target example_distrans
[ %] [ %] Built target example_drawing
Built target example_edge
[ %] Built target example_em
[ %] [ %] Built target example_example
Built target example_facedetect
[ %] Built target example_facial_features
[ %] Built target example_fback
[ %] [ %] Built target example_filestorage
Built target example_ffilldemo
[ %] Built target example_fitellipse
[ %] [ %] [ %] Built target example_houghcircles
Built target example_grabcut
Built target example_houghlines
[ %] Built target example_image
[ %] Built target example_image_sequence
[ %] [ %] Built target example_image_alignment
Built target example_imagelist_creator
[ %] [ %] Built target example_intelperc_capture
Built target example_inpaint
[ %] Built target example_kalman
[ %] [ %] Built target example_laplace
[ %] Built target example_kmeans
Built target example_letter_recog
[ %] Built target example_lkdemo
[ %] Built target example_logistic_regression
[ %] Built target example_lsd_lines
[ %] Built target example_mask_tmpl
[ %] Built target example_matchmethod_orb_akaze_brisk
[ %] [ %] Built target example_minarea
Built target example_morphology2
[ %] Built target example_npr_demo
[ %] Built target example_opencv_version
[ %] Built target example_phase_corr
[ %] [ %] Built target example_pca
Built target example_openni_capture
[ %] Built target example_points_classifier
[ %] Built target example_polar_transforms
[ %] [ %] Built target example_select3dobj
Built target example_segment_objects
[ %] Built target example_shape_example
[ %] [ %] [ %] Built target example_starter_imagelist
Built target example_smiledetect
Built target example_squares
[ %] Built target example_starter_video
[ %] Built target example_stereo_calib
[ %] Built target example_stitching
[ %] Built target example_stereo_match
[ %] [ %] Built target example_train_HOG
Built target example_stitching_detailed
[ %] Built target example_tree_engine
[ %] Built target example_tvl1_optical_flow
[ %] Built target example_watershed
[ %] Built target example_videostab
[ %] Built target tutorial_AKAZE_match
[ %] Built target tutorial_AddingImages
[ %] [ %] Built target tutorial_AddingImagesTrackbar
Built target tutorial_BasicLinearTransforms
[ %] Built target tutorial_BasicLinearTransformsTrackbar
[ %] Built target tutorial_CannyDetector_Demo
[ %] [ %] [ %] Built target tutorial_Drawing_2
Built target tutorial_Drawing_1
Built target tutorial_EqualizeHist_Demo
[ %] Built target tutorial_Geometric_Transforms_Demo
[ %] [ %] [ %] Built target tutorial_LATCH_match
Built target tutorial_HoughCircle_Demo
Built target tutorial_HoughLines_Demo
[ %] Built target tutorial_Laplace_Demo
[ %] [ %] Built target tutorial_MatchTemplate_Demo
[ %] Built target tutorial_Morphology_2
Built target tutorial_Morphology_1
[ %] Built target tutorial_Morphology_3
[ %] Built target tutorial_Pyramids
[ %] Built target tutorial_SBM_Sample
[ %] Built target tutorial_Remap_Demo
[ %] Built target tutorial_Smoothing
[ %] Built target tutorial_Sobel_Demo
[ %] Built target tutorial_Threshold
[ %] Built target tutorial_bg_sub
[ %] [ %] Built target tutorial_calcBackProject_Demo1
Built target tutorial_calcBackProject_Demo2
[ %] Built target tutorial_calcHist_Demo
[ %] Built target tutorial_camera_calibration
[ %] [ %] Built target tutorial_cloning_gui
Built target tutorial_cloning_demo
[ %] Built target tutorial_compareHist_Demo
[ %] Built target tutorial_copyMakeBorder_demo
[ %] Built target tutorial_cornerDetector_Demo
[ %] Built target tutorial_cornerHarris_Demo
[ %] [ %] [ %] Built target tutorial_cornerSubPix_Demo
Built target tutorial_decolor
Built target tutorial_discrete_fourier_transform
[ %] Built target tutorial_display_image
[ %] [ %] [ %] Built target tutorial_findContours_demo
Built target tutorial_file_input_output
Built target tutorial_filter2D_demo
[ %] [ %] [ %] [ %] Built target tutorial_gdal-image
Built target tutorial_generalContours_demo1
Built target tutorial_goodFeaturesToTrack_Demo
Built target tutorial_generalContours_demo2
[ %] [ %] [ %] Built target tutorial_gpu-basics-similarity
Built target tutorial_hdr_imaging
Built target tutorial_how_to_scan_images
[ %] Built target tutorial_hull_demo
[ %] [ %] [ %] Built target tutorial_imageSegmentation
Built target tutorial_interoperability_with_OpenCV_1
Built target tutorial_introduction_to_pca
[ %] Built target tutorial_introduction_to_svm
[ %] [ %] Built target tutorial_mat_the_basic_image_container
Built target tutorial_mat_mask_operations
[ %] [ %] Built target tutorial_introduction_windows_vs
Built target tutorial_moments_demo
[ %] [ %] Built target tutorial_npr_demo
Built target tutorial_non_linear_svms
[ %] [ %] Built target tutorial_objectDetection2
Built target tutorial_objectDetection
[ %] [ %] Built target tutorial_pointPolygonTest_demo
Built target tutorial_planar_tracking
[%] Built target tutorial_video-write
[%] Built target tutorial_video-input-psnr-ssim
yuanlibin@yuanlibin:~/opencv-3.1./build$

最后执行安装命令:

. sudo make install

至此OpenCV3.1.0编译安装全部完成,指定安装到路径/usr/local/opencv_3.1.0。

这样GPU版本的opencv就编译安装完成了,可以调用opencv中GPU相关的函数。

 

在CUDA8.0下指定位置编译安装OpenCV3.1.0来实现GPU加速(Compiling OpenCV3.1.0 with CUDA8.0 support)的更多相关文章

  1. 在CUDA8.0下编译安装OpenCV3.1.0来实现GPU加速(Compiling OpenCV3.1.0 with CUDA8.0 support)

    在CUDA8.0下编译安装OpenCV3.1.0 一.本人电脑配置:ubuntu 14.04, NVIDIA GTX1060. 二.编译OpenCV3.1.0前,读者需要成功安装CUDA8.0(网上有 ...

  2. Linux下指定版本编译安装LAMP

    说明: 操作系统:CentOS 6.5 64位 需求: 编译安装LAMP运行环境 各软件版本如下: MySQL:mysql-5.1.73 Apache:httpd-2.2.31 PHP:php-5.2 ...

  3. CentOS 6.6 下源码编译安装MySQL 5.7.5

    版权声明:转自:http://www.linuxidc.com/Linux/2015-08/121667.htm 说明:CentOS 6.6 下源码编译安装MySQL 5.7.5 1. 安装相关工具# ...

  4. Centos6下Python3的编译安装

    本文转载自 Centos6下Python3的编译安装 系统环境:CentOS 6.8-Minimal 安装Python依赖包: 1 [root@Python src]# yum install zli ...

  5. Centos7下源码编译安装与配置redis5.0

    1.下载redis5.0源码包 wget http://download.redis.io/releases/redis-5.0.5.tar.gz 2.检查是否安装过之前的历史版本 rpm -qa|g ...

  6. Spark入门实战系列--2.Spark编译与部署(下)--Spark编译安装

    [注]该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取 .编译Spark .时间不一样,SBT是白天编译,Maven是深夜进行的,获取依赖包速度不同 ...

  7. CentOS 6.3下源码编译安装LAMP

    一.简介 什么是LAMP    LAMP是一种Web网络应用和开发环境,是Linux, Apache, MySQL, Php/Perl的缩写,每一个字母代表了一个组件,每个组件就其本身而言都是在它所代 ...

  8. CentOS下PHP7的编译安装,MySQL的支持和一些问题的解决

    最近试了一下PHP7,在编译和支持MySQL上都遇到一些问题,相信不少同学也同样遇到,所以在这里聊一下这个过程.简单来讲编译PHP7只需要3步: 1../buildconf --force 2../c ...

  9. Linux下源码编译安装rpy2

    R(又称R语言)是一款开源的跨平台的数值统计和数值图形化展现工具.rpy2是Python直接调用R的第三方库,它可以实现使用python读取R的对象.调用R的方法以及Python与R数据结构转换等.这 ...

随机推荐

  1. js 怎样判断用户是否在浏览当前页面

    有些时候我们需要在项目中判断用户是否在浏览当前页面,或者当前页面是否处于激活状态.然后再进行相关的操作.浏览器中可通过window对象的onblur.onfocus判断,或者document的hidd ...

  2. javaIO——StringReader & StringWriter

    上一篇概述篇说过,一个IO对象是指一个可以被关闭的数据源或者目标,那么StringReader和StringWriter就是一个字符串源和字符串目标. 1. StringtReader: 文档说:St ...

  3. ELECTRON 打包

    安装electron-packager cnpm install electron-packager -g 配置package.json "scripts": { "st ...

  4. vue模板字符串写法

    1.模板字符串拼接id <div class="thumbnail" :id="`ctrol_${item.id}`"> <i :class= ...

  5. MySQL时间类型及获取、展示处理

    MySQL时间格式 mysql所支持的日期时间类型有:DATETIME. TIMESTAMP.DATE.TIME.YEAR. 几种类型比较如下: 日期时间类型 占用空间 日期格式 最小值 最大值 零值 ...

  6. 【Mac】 开启原生的 NTFS 硬盘格式支持

    一.MacOS 10.13 之前 二.MacOS 10.13 及之后 一.MacOS 10.13 之前 直接跳到引用地址查看,下面的草记只是为了防止链接丢失 引用地址 打开终端 切换至root身份,输 ...

  7. Delphi 类成员的可见性

  8. ASP.config配置

    使用ASP.NET搭建三层时候, 有Model (模型)DAL(数据访问层)    BLL(业务逻辑层)  连接数据库的DBhelper 放在DAL层 假如 你数据库密码改了,你要打开VS 找到DBh ...

  9. 七:mvc使用CodeFirst(代码优先)创建数据库

    1. 理解EF CodeFirst模式特点 2. 使用CodeFirst模式生成数据库 1. CodeFirst模式(代码优先) Code First是Entity Framework提供的一种新的编 ...

  10. P3157 [CQOI2011]动态逆序对 (CDQ解决三维偏序问题)

    P3157 [CQOI2011]动态逆序对 题目描述 对于序列A,它的逆序对数定义为满足i<j,且Ai>Aj的数对(i,j)的个数.给1到n的一个排列,按照某种顺序依次删除m个元素,你的任 ...