博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
opencv 4.0 + linux下静态编译,展示详细ccmake的参数配置
阅读量:6207 次
发布时间:2019-06-21

本文共 2819 字,大约阅读时间需要 9 分钟。

#先安装 cmake 3.14

# cmake安装到了 /usr/local/bin

#配置PATH

export PATH="$PATH:/usr/local/bin"

#下载最新的opencv

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

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

#定义自己的生成目录

mkdir 20190508
mkdir -p opencv-master/build
cd opencv-master/build

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

cmake -DOPENCV_EXTRA_MODULES_PATH=/home/admin/opencv/opencv_contrib-master/modules ..

#执行ccmake,配置编译选项

ccmake ..

#我配置的主要选项如下:

1 BUILD_DOCS:BOOL=OFF 2 BUILD_EXAMPLES:BOOL=OFF 3 BUILD_IPP_IW:BOOL=OFF 4 BUILD_ITT:BOOL=OFF 5 BUILD_JASPER:BOOL=OFF 6 BUILD_JAVA:BOOL=OFF 7 BUILD_JPEG:BOOL=OFF 8 BUILD_OPENEXR:BOOL=OFF 9 //Build performance tests10 BUILD_PERF_TESTS:BOOL=OFF11 //Build libpng from source12 BUILD_PNG:BOOL=OFF13 //Force to build libprotobuf from sources14 BUILD_PROTOBUF:BOOL=OFF15 //Build shared libraries (.dll/.so) instead of static ones (.lib/.a)16 BUILD_SHARED_LIBS:BOOL=OFF17 //Download and build TBB from source18 BUILD_TBB:BOOL=OFF19 //Build accuracy & regression tests20 BUILD_TESTS:BOOL=OFF21 //Build libtiff from source22 BUILD_TIFF:BOOL=OFF23 //Build WebP from source24 BUILD_WEBP:BOOL=OFF25 //Build utility applications (used for example to train classifiers)26 BUILD_opencv_apps:BOOL=OFF27 //Include opencv_face module into the OpenCV build28 BUILD_opencv_face:BOOL=OFF29 //Include opencv_highgui module into the OpenCV build30 BUILD_opencv_highgui:BOOL=OFF31 //Include opencv_java_bindings_generator module into the OpenCV32 // build33 BUILD_opencv_java_bindings_generator:BOOL=OFF34 //Build JavaScript bindings by Emscripten35 BUILD_opencv_js:BOOL=OFF36 //Include opencv_xfeatures2d module into the OpenCV build37 BUILD_opencv_xfeatures2d:BOOL=OFF38 //Installation Directory39 CMAKE_INSTALL_PREFIX:PATH=/home/admin/opencv/2019050840 41 //Include NVidia Cuda Runtime support42 WITH_CUDA:BOOL=OFF43 44 //Include Intel IPP support45 WITH_IPP:BOOL=OFF46 47 //Include Intel ITT support48 WITH_ITT:BOOL=OFF49 50 //Include JPEG2K support51 WITH_JASPER:BOOL=OFF52 53 //Include JPEG support54 WITH_JPEG:BOOL=OFF55 56 //Include Lapack library support57 WITH_LAPACK:BOOL=OFF58 59 //Include ILM support via OpenEXR60 WITH_OPENEXR:BOOL=OFF61 62 //Include PNG support63 WITH_PNG:BOOL=OFF64 65 //Build with Qt Backend support66 WITH_QT:BOOL=OFF67 68 //Include Intel TBB support69 WITH_TBB:BOOL=OFF70 71 //Include TIFF support72 WITH_TIFF:BOOL=OFF73 74 //Include Vulkan support75 WITH_VULKAN:BOOL=OFF76 77 //Include WebP support78 WITH_WEBP:BOOL=OFF

配置有这样一些考虑:

1.仅满足linux下的基本的图形处理的使用;

2.不要CUDA,不要各种图形格式的支持;
3.生成静态库,避免多人使用的情况下大家相互覆盖;
4.生成在自己的目录下,不放在系统目录。

 配置完成后按g,生成配置,退出。

make -j 20

make install

 

等到链接具体的程序的时候,还需要额外的一些库:

gcc -o xxx_elf xxx.o -L"/home/admin/opencv/20190508/lib64" -lopencv_core -lopencv_imgproc -lopencv_imgcodecs \

    -ldl -lz -pthread

 

转载于:https://www.cnblogs.com/ahfuzhang/p/10837315.html

你可能感兴趣的文章
区块链101:区块链的应用和用例是什么?
查看>>
马约拉纳费米子:推动量子计算的“天使粒子”
查看>>
瑞立视:厚积薄发且具有“工匠精神”的中国品牌
查看>>
git与svn的区别 ?Git 与 SVN那个更好?
查看>>
使用ActionTrail Python SDK
查看>>
数据显示,中国近一半的独角兽企业由“BATJ”四巨头投资
查看>>
log日志轮转--logrotate
查看>>
安装输入发
查看>>
用户配置相关文件
查看>>
老王学linux-ftp
查看>>
kvm vnc的使用,鼠标漂移等
查看>>
linux中fcntl()、lockf、flock的区别
查看>>
gitlab 2.7版本升级到2.8
查看>>
linux用户空间和内核exit的语义--linux没有线程
查看>>
获取Extjs文本域中的内容
查看>>
RHEL 5基础篇—常见系统启动类故障
查看>>
对‘初学者应该选择哪种编程语言’的回答——计算机达人成长之路(38)
查看>>
Redis-3.2主从复制与集群搭建 推荐
查看>>
随便说说:在ASP.NET应用程序中上传文件
查看>>
【jQuery Demo】图片由下至上逐渐显示
查看>>