#下载最新的opencv

git clone "https://github.com/opencv/opencv.git"

git clone "https://github.com/opencv/opencv_contrib.git"

#定义自己的生成目录
mkdir 20190509_cuda
mkdir -p opencv-master/build_cuda
cd opencv-master/build_cuda

#生成配置的时候选择带上opencv-contrib

#  注意 -DCUDA_CUDA_LIBRARY= 这个一定要加,这个是配置项的一个BUG,只能从这里绕过去。地址是cuda库中libcuda.so的绝对路径

cmake -DOPENCV_EXTRA_MODULES_PATH=/home/admin/opencv/opencv_contrib-master/modules -DCUDA_CUDA_LIBRARY=/usr/local/cuda-9.0/lib64/stubs/libcuda.so -DCMAKE_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/stubs/ ..

#执行ccmake,配置编译选项

ccmake ..

#按t,切换进入高级模式

#主要修改的配置项如下:

  1 //Build CUDA modules stubs when no CUDA SDK
2 BUILD_CUDA_STUBS:BOOL=OFF
3
4 //Create build rules for OpenCV Documentation
5 BUILD_DOCS:BOOL=OFF
6
7 //Build all examples
8 BUILD_EXAMPLES:BOOL=OFF
9
10 //Create Java wrapper exporting all functions of OpenCV library
11 // (requires static build of OpenCV modules)
12 BUILD_FAT_JAVA_LIB:BOOL=OFF
13
14 //Build IPP IW from source
15 BUILD_IPP_IW:BOOL=OFF
16
17 //Build Intel ITT from source
18 BUILD_ITT:BOOL=OFF
19
20 //Build libjasper from source
21 BUILD_JASPER:BOOL=OFF
22
23 //Enable Java support
24 BUILD_JAVA:BOOL=OFF
25
26 //Build libjpeg from source
27 BUILD_JPEG:BOOL=OFF
28
29 //Build openexr from source
30 BUILD_OPENEXR:BOOL=OFF
31
32 //Build performance tests
33 BUILD_PERF_TESTS:BOOL=OFF
34
35 //Build libpng from source
36 BUILD_PNG:BOOL=OFF
37
38 //Force to build libprotobuf from sources
39 BUILD_PROTOBUF:BOOL=OFF
40
41 //Build shared libraries (.dll/.so) instead of static ones (.lib/.a)
42 BUILD_SHARED_LIBS:BOOL=OFF
43
44 //Download and build TBB from source
45 BUILD_TBB:BOOL=OFF
46
47 //Build accuracy & regression tests
48 BUILD_TESTS:BOOL=OFF
49
50 //Build libtiff from source
51 BUILD_TIFF:BOOL=OFF
52
53 //Build WebP from source
54 BUILD_WEBP:BOOL=OFF
55
56 //Include debug info into release binaries ('OFF' means default
57 // settings)
58 BUILD_WITH_DEBUG_INFO:BOOL=OFF
59
60 //Enables dynamic linking of IPP (only for standalone IPP)
61 BUILD_WITH_DYNAMIC_IPP:BOOL=OFF
62
63 //Build zlib from source
64 BUILD_ZLIB:BOOL=OFF
65
66 //Include opencv_face module into the OpenCV build
67 BUILD_opencv_face:BOOL=OFF
68
69 //Include opencv_highgui module into the OpenCV build
70 BUILD_opencv_highgui:BOOL=OFF
71
72 //Include opencv_java_bindings_generator module into the OpenCV
73 // build
74 BUILD_opencv_java_bindings_generator:BOOL=OFF
75
76 //Include opencv_xfeatures2d module into the OpenCV build
77 BUILD_opencv_xfeatures2d:BOOL=OFF
78
79 //Choose the type of build, options are: None Debug Release RelWithDebInfo
80 // MinSizeRel ...
81 CMAKE_BUILD_TYPE:STRING=Debug
82
83 //Installation Directory
84 CMAKE_INSTALL_PREFIX:PATH=/home/admin/opencv/2019-05-09_cuda
85
86 //"cudart" library
87 CUDA_CUDART_LIBRARY:FILEPATH=/usr/local/cuda/lib64/libcudart.so
88
89 //Path to a program.
90 CUDA_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda/bin/nvcc
91
92 //Path to a file.
93 CUDA_TOOLKIT_INCLUDE:PATH=/usr/local/cuda/include
94
95 //Toolkit location.
96 CUDA_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda
97
98 //Use the static version of the CUDA runtime library if available
99 CUDA_USE_STATIC_CUDA_RUNTIME:BOOL=ON
100
101 //Enable ADE framework (required for Graph API module)
102 WITH_ADE:BOOL=OFF
103
104 //Include Aravis GigE support
105 WITH_ARAVIS:BOOL=OFF
106
107 //Include NVidia Cuda Runtime support
108 WITH_CUDA:BOOL=ON
109
110 //Include Intel Inference Engine support
111 WITH_INF_ENGINE:BOOL=OFF
112
113 //Include Intel IPP support
114 WITH_IPP:BOOL=OFF
115
116 //Include Intel ITT support
117 WITH_ITT:BOOL=OFF
118
119 //Include JPEG2K support
120 WITH_JASPER:BOOL=OFF
121
122 //Include JPEG support
123 WITH_JPEG:BOOL=OFF
124
125 //Include Lapack library support
126 WITH_LAPACK:BOOL=OFF
127
128 //Include NVidia Video Decoding library support
129 WITH_NVCUVID:BOOL=ON
130
131 //Include PNG support
132 WITH_PNG:BOOL=OFF
133
134 //Enable libprotobuf
135 WITH_PROTOBUF:BOOL=OFF
136
137 //Include Intel TBB support
138 WITH_TBB:BOOL=OFF
139
140 //Include TIFF support
141 WITH_TIFF:BOOL=OFF
142
143 //Include Vulkan support
144 WITH_VULKAN:BOOL=OFF
145
146 //Include WebP support
147 WITH_WEBP:BOOL=OFF

make -j 20

make install

=============================

2019-05-10补充:

//Build openexr from source
BUILD_OPENEXR:BOOL=ON

//Include ILM support via OpenEXR
WITH_OPENEXR:BOOL=ON

以上两项要打开,否则链接程序的时候出现大量如下错误:

/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:250: undefined reference to `Im
f::Slice::Slice(Imf::PixelType, char*, unsigned long, unsigned long, int, int, double, bool, bool)'
/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:252: undefined reference to `Im
f::FrameBuffer::insert(char const*, Imf::Slice const&)'
/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:257: undefined reference to `Im
f::Slice::Slice(Imf::PixelType, char*, unsigned long, unsigned long, int, int, double, bool, bool)'
/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:259: undefined reference to `Im
f::FrameBuffer::insert(char const*, Imf::Slice const&)'

opencv 4.0 + linux + cuda静态编译的更多相关文章

  1. opencv 4.0 + linux下静态编译,展示详细ccmake的参数配置

    #先安装 cmake 3.14 # cmake安装到了 /usr/local/bin #配置PATH export PATH="$PATH:/usr/local/bin" #下载最 ...

  2. ACE-6.1.0 linux 下的编译与安装步骤

    ACE-6.1.0 linux 下的编译与安装步骤  引用至http://www.cnblogs.com/liangxiaxu/archive/2013/03/07/2948417.html 1.从  ...

  3. Qt5.5.0在Linux下静态编译(加上-fontconfig编译项才能显示中文) good

    测试系统环境:Ubuntu12.04 (32bit/64bit)编译软件环境:QT5.5.0   本文章主要介绍Linux下QT静态编译环境的搭建,以及如何编译我们的程序board_driver. 1 ...

  4. Linux下静态编译Qt

    Qt采用编译的方式安装的时候,配置中默认的编译方式是动态编译的,但是有时候你编写的程序要发布出去,带很多动态库文件是很繁琐的,此时就需要静态编译你的程序,Qt要实现静态编译必须库文件也是静态编译的,所 ...

  5. Linux下静态编译Qt程序

    一般情况下,我们用Qt编译出来的程序是要依赖于系统Qt库的,也就是这个程序移到别的没有安装Qt库的系统上是不能使用的.会提示缺少……库文件之类的错误.这就是动态编译的结果. 但是如果我们想编译一个程序 ...

  6. QT全平台设置图标,全平台静态编译 good

    1.  概述 当我们用QT写好了一个软件,要把你的程序分享出去的时候,不可能把编译的目录拷贝给别人去运行.编译好的程序应该是一个主程序,加一些资源文件,再加一些动态链接库,高大上一些的还可以做一个安装 ...

  7. 用mingw静态编译Qt4.8.2和Qt5.1.1(需要修改不少源码)

    因为一些乱七八糟的原因,我需要用mingw静态编译Qt4.8.2和Qt5.1.1.经历了一天的折腾之后,自觉编译一下Qt还是件颇为麻烦的事情,故将过程略作总结,以备不时之需. 首先,在编译之前,我需要 ...

  8. VS2010 win7 QT4.8.0,实现VS2010编译调试Qt程序,QtCreator静态发布程序

    下载源代码,注意一定是源码压缩包如qt-everywhere-opensource-src-4.8.0.zip, 不是Qt发布的已编译的不同版本的标准库如qt-win-opensource-4.8.0 ...

  9. 记录下 QT Linux 静态编译遇到的坑

    Qt下静态编译Qt,根据我的经验,如果按照Windows下那种直接拿官方sdk安装之后的文件来编译是行不通的,需要直接下载Qt的source包,目前诺基亚的源码叫做qt-everywhere-open ...

随机推荐

  1. LuoguP7534 [COCI2016-2017#4] Kartomat 题解

    Content 火车站里头有一个售票机,其键盘可以看作是一个 \(4\times 8\) 的矩阵,其中第一行的前面三个键和最后一行的最后三个键都是 *,剩余的键按照从上到下,从左到右的顺序依次按照 A ...

  2. java 8 启动脚本优化

    1 #!/bin/bash 2 3 JAVA_HOME=/usr/java/default 4 5 #java虚拟机启动参数 6 JAVA_OPTS="-server -Xms1366m - ...

  3. mysql绿色版添加服务

  4. VS2017激活key

    密钥 KBJFW-NXHK6-W4WJM-CRMQB-G3CDH

  5. sigslot之简化版

    1.关于 1.1 基于原版sigslot做了部分修改.原版的信号支持最多支持8个参数,改进后,最多支持1个参数,这样肯定不能满足日常需求,但是,我们可以将信号的一个参数改为类型指针,比如信号定义时的模 ...

  6. 【LeetCode】990. Satisfiability of Equality Equations 解题报告(C++ & python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 DFS 并查集 日期 题目地址:https://le ...

  7. 【剑指Offer】包含min函数的栈 解题报告

    [剑指Offer]包含min函数的栈 解题报告 标签(空格分隔): 牛客网 题目地址:https://www.nowcoder.com/questionTerminal/beb5aa231adc45b ...

  8. 线程 IO流 网络编程 基础总结

    线程 进程---->进行中的程序 线程---->由进程创建 一个进程可以创建多个线程 并发:同一个时刻 多个任务交替执行 造成一种貌似同时进行的错觉 简单来说 单个cpu的多任务就是并发 ...

  9. mysql多条件过滤查询之mysq高级查询

    一.什么是高级查询: ① 多条件的过滤查询 简单说,即拼接sql语句,在sql查询语句之后使用: where 条件1 and/or 条件2 and/or 条件3 - ② 分页查询 二.多条件过滤查询: ...

  10. 新手入门typeScript

    强类型与弱类型(类型安全) 强类型不允许随意的隐士类型转换,而弱类型是允许的 变量类型允许随时改变的特点,不是强弱类型的差异 静态类型与动态类型(类型检查) 静态类型:一个变量声明时它的类型就是明确的 ...