Ubuntu 17.04 opencv源码编译安装

安装方法参见《Ubuntu 17.04 opencv源码编译安装--复选框,opencv,打勾,安装,目录》一文(http://www.bijishequ.com/detail/513736?p=),此外还需注意以下几点:


1.勾选“WITH_QT”选项,以便使用QtCreator构建Opencv工程;


2.编译附加模块时,需将变量“OPENCV_EXTRA_MODULES_PATH”设置到“opencv_contrib-master/modules”子目录(很多情况下会只设置到“opencv_contrib-master”目录),否则会报错。另外,使用CMAKE-GUI工具时,要保持网络畅通,因为CMAKE可能会从网上下载相关文件。


3.不能勾选贡献模块中的“BUILD_opencv_text”、“BUILD_opencv_xfeatures2d”、“BUILD_opencv_ximgproc”,因为上述选项依赖Tesseract等第三方库,会导致编译错误。


4.不能勾选“with cuda”,因为在opencv官网上下载的3.3.0版本是没有相关cuda库提供的,cmake当然就无法找到,所以就报错,错误内容如下:


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_nppi_LIBRARY (ADVANCED)
    linked by target "opencv_cudev" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudev
    linked by target "opencv_cudev" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudev
    linked by target "opencv_test_cudev" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudev/test
    linked by target "opencv_core" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/core
    linked by target "opencv_core" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/core
    linked by target "opencv_test_core" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/core
    linked by target "opencv_perf_core" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/core
    linked by target "opencv_test_cudaarithm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaarithm
    linked by target "opencv_perf_cudaarithm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaarithm
    linked by target "opencv_cudaarithm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaarithm
    linked by target "opencv_cudaarithm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaarithm
    linked by target "opencv_test_flann" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/flann
    linked by target "opencv_flann" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/flann
    linked by target "opencv_flann" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/flann
    linked by target "opencv_imgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgproc
    linked by target "opencv_imgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgproc
    linked by target "opencv_test_imgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgproc
    linked by target "opencv_perf_imgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgproc
    linked by target "opencv_test_ml" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/ml
    linked by target "opencv_ml" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/ml
    linked by target "opencv_ml" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/ml
    linked by target "opencv_test_objdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/objdetect
    linked by target "opencv_objdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/objdetect
    linked by target "opencv_objdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/objdetect
    linked by target "opencv_perf_objdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/objdetect
    linked by target "opencv_video" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/video
    linked by target "opencv_video" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/video
    linked by target "opencv_test_video" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/video
    linked by target "opencv_perf_video" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/video
    linked by target "opencv_test_viz" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/viz
    linked by target "opencv_viz" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/viz
    linked by target "opencv_viz" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/viz
    linked by target "opencv_test_cudabgsegm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudabgsegm
    linked by target "opencv_cudabgsegm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudabgsegm
    linked by target "opencv_cudabgsegm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudabgsegm
    linked by target "opencv_perf_cudabgsegm" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudabgsegm
    linked by target "opencv_test_cudafilters" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafilters
    linked by target "opencv_cudafilters" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafilters
    linked by target "opencv_cudafilters" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafilters
    linked by target "opencv_perf_cudafilters" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafilters
    linked by target "opencv_test_cudaimgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaimgproc
    linked by target "opencv_perf_cudaimgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaimgproc
    linked by target "opencv_cudaimgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaimgproc
    linked by target "opencv_cudaimgproc" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaimgproc
    linked by target "opencv_test_cudawarping" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudawarping
    linked by target "opencv_cudawarping" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudawarping
    linked by target "opencv_cudawarping" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudawarping
    linked by target "opencv_perf_cudawarping" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudawarping
    linked by target "opencv_test_dnn" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/dnn
    linked by target "opencv_dnn" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/dnn
    linked by target "opencv_dnn" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/dnn
    linked by target "opencv_perf_dnn" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/dnn
    linked by target "opencv_test_imgcodecs" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgcodecs
    linked by target "opencv_imgcodecs" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgcodecs
    linked by target "opencv_imgcodecs" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgcodecs
    linked by target "opencv_perf_imgcodecs" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/imgcodecs
    linked by target "opencv_test_photo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/photo
    linked by target "opencv_photo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/photo
    linked by target "opencv_photo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/photo
    linked by target "opencv_perf_photo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/photo
    linked by target "opencv_test_shape" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/shape
    linked by target "opencv_shape" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/shape
    linked by target "opencv_shape" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/shape
    linked by target "opencv_test_videoio" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/videoio
    linked by target "opencv_videoio" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/videoio
    linked by target "opencv_videoio" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/videoio
    linked by target "opencv_perf_videoio" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/videoio
    linked by target "opencv_test_cudacodec" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudacodec
    linked by target "opencv_cudacodec" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudacodec
    linked by target "opencv_cudacodec" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudacodec
    linked by target "opencv_perf_cudacodec" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudacodec
    linked by target "opencv_test_highgui" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/highgui
    linked by target "opencv_highgui" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/highgui
    linked by target "opencv_highgui" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/highgui
    linked by target "opencv_ts" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/ts
    linked by target "opencv_ts" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/ts
    linked by target "opencv_test_features2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/features2d
    linked by target "opencv_features2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/features2d
    linked by target "opencv_features2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/features2d
    linked by target "opencv_perf_features2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/features2d
    linked by target "opencv_test_calib3d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/calib3d
    linked by target "opencv_calib3d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/calib3d
    linked by target "opencv_calib3d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/calib3d
    linked by target "opencv_perf_calib3d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/calib3d
    linked by target "opencv_test_cudafeatures2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafeatures2d
    linked by target "opencv_perf_cudafeatures2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafeatures2d
    linked by target "opencv_cudafeatures2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafeatures2d
    linked by target "opencv_cudafeatures2d" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudafeatures2d
    linked by target "opencv_test_cudalegacy" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudalegacy
    linked by target "opencv_cudalegacy" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudalegacy
    linked by target "opencv_cudalegacy" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudalegacy
    linked by target "opencv_perf_cudalegacy" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudalegacy
    linked by target "opencv_test_cudaobjdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaobjdetect
    linked by target "opencv_cudaobjdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaobjdetect
    linked by target "opencv_cudaobjdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaobjdetect
    linked by target "opencv_perf_cudaobjdetect" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaobjdetect
    linked by target "opencv_test_cudaoptflow" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaoptflow
    linked by target "opencv_cudaoptflow" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaoptflow
    linked by target "opencv_cudaoptflow" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaoptflow
    linked by target "opencv_perf_cudaoptflow" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudaoptflow
    linked by target "opencv_test_cudastereo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudastereo
    linked by target "opencv_perf_cudastereo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudastereo
    linked by target "opencv_cudastereo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudastereo
    linked by target "opencv_cudastereo" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/cudastereo
    linked by target "opencv_test_stitching" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/stitching
    linked by target "opencv_perf_stitching" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/stitching
    linked by target "opencv_stitching" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/stitching
    linked by target "opencv_stitching" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/stitching
    linked by target "opencv_superres" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/superres
    linked by target "opencv_superres" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/superres
    linked by target "opencv_test_superres" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/superres
    linked by target "opencv_perf_superres" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/superres
    linked by target "opencv_test_videostab" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/videostab
    linked by target "opencv_videostab" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/videostab
    linked by target "opencv_videostab" in directory /home/davidhopper/opencv/opencv-3.3.0/modules/videostab
    linked by target "opencv_traincascade" in directory /home/davidhopper/opencv/opencv-3.3.0/apps/traincascade
    linked by target "opencv_createsamples" in directory /home/davidhopper/opencv/opencv-3.3.0/apps/createsamples
    linked by target "opencv_annotation" in directory /home/davidhopper/opencv/opencv-3.3.0/apps/annotation
    linked by target "opencv_visualisation" in directory /home/davidhopper/opencv/opencv-3.3.0/apps/visualisation
    linked by target "opencv_interactive-calibration" in directory /home/davidhopper/opencv/opencv-3.3.0/apps/interactive-calibration
    linked by target "opencv_version" in directory /home/davidhopper/opencv/opencv-3.3.0/apps/version


Configuring incomplete, errors occurred!
See also "/home/davidhopper/opencv/opencv-3.3.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/davidhopper/opencv/opencv-3.3.0/build/CMakeFiles/CMakeError.log".

你可能感兴趣的:(Ubuntu 17.04 opencv源码编译安装)