zoukankan      html  css  js  c++  java
  • 在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(网上有相关教程)。

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

    1. 安装依赖库

    1. sudo apt-get update  
    2. 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-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils  
    3. sudo add-apt-repository ppa:jon-severinsson/ffmpeg    
    4. sudo apt-get update    
    5. sudo apt-get install ffmpeg    
    6. 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. 编译安装

    1. cd opencv-3.1.0
    2. mkdir build
    3. cd build
    4. 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.0/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:

    1. sudo ln -s /usr/lib/nvidia-346/libnvcuvid.so /usr/lib/libnvcuvid.so
    2. sudo ln -s /usr/lib/nvidia-346/libnvcuvid.so.1 /usr/lib/libnvcuvid.so.1

    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.1 [9.0.1]
    --          at:                     /home/yuanlibin/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx
    --     Use IPP Async:               NO
    --     Use VA:                      NO
    --     Use Intel VA-API/OpenCL:     NO
    --     Use Eigen:                   YES (ver 3.2.0)
    --     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:             20 21 30 35
    --     NVIDIA PTX archs:            30
    --     Use fast math:               YES
    ……

    然后执行以下命令:

    1. make -j4

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

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

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

    locate命令找到相应的路径。

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

    本文软链接命令如下:

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

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

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

    ……
    [ 70%] Building CXX object modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o
    /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
         typedef NppStatus (*init_func_t)(NppiSize oSize, NppiGraphcutState** ppState, Npp8u* pDeviceMem);
                                                          ^
    /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:135:18: error: expected type-specifier before ‘NppiGraphcutState’
             operator NppiGraphcutState*()
                      ^
    /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:141:9: error: ‘NppiGraphcutState’ does not name a type
             NppiGraphcutState* pState;
             ^
    In file included from /home/yuanlibin/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0:
    /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In constructor ‘{anonymous}::NppiGraphcutStateHandler::NppiGraphcutStateHandler(NppiSize, Npp8u*, {anonymous}::init_func_t)’:
    /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:127:39: error: ‘pState’ was not declared in this scope
                 nppSafeCall( func(sznpp, &pState, pDeviceMem) );
                                           ^
    /home/yuanlibin/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
     #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
                                                        ^
    /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In destructor ‘{anonymous}::NppiGraphcutStateHandler::~NppiGraphcutStateHandler()’:
    /home/yuanlibin/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:132:43: 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)如下:

    [ 87%] 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 1 exit status
    Linking CXX executable ../../bin/gpu-example-optical_flow
    make[2]: *** [bin/gpu-example-opengl] Error 1
    make[1]: *** [samples/gpu/CMakeFiles/example_gpu_opengl.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    [ 87%] 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

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

    [ 93%] Build Java tests
    Linking CXX executable ../../bin/cpp-tutorial-video-write
    Buildfile: /home/yuanlibin/opencv-3.1.0/build/modules/java/pure_test/.build/build.xml
    [ 93%] 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 2 source files to /home/yuanlibin/opencv-3.1.0/build/modules/java/pure_test/.build/build/classes
    [ 93%] Built target tutorial_planar_tracking
    [ 93%] Built target tutorial_video-input-psnr-ssim
    
    jar:
          [jar] Building jar: /home/yuanlibin/opencv-3.1.0/build/modules/java/pure_test/.build/build/jar/opencv-test.jar
    
    BUILD SUCCESSFUL
    Total time: 0 seconds
    [100%] Built target opencv_test_java
    yuanlibin@yuanlibin:~/opencv-3.1.0/build$

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

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

    最后执行安装命令:

    1. sudo make install

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

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

     

  • 相关阅读:
    让用户打开你app的位置功能
    函数递归与栈的关系
    公务员考试
    毕达哥拉斯的故事
    OC5_NSMutableString操作
    OC4_NSString操作
    OC_NSString
    OC3_MyRect
    OC6_类方法
    OC5_构造方法与self指针
  • 原文地址:https://www.cnblogs.com/yuanlibin/p/7735274.html
Copyright © 2011-2022 走看看