opecv opencv-contrib编译
Posted ACaptain
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了opecv opencv-contrib编译相关的知识,希望对你有一定的参考价值。
系统环境:
win7 64、mingw、cmake3.9.2、opencv3.3
安装配置mingw和cmake后,查看结果
D:\\opencv3.3\\sources>cmake -version cmake version 3.9.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). D:\\opencv3.3\\sources>make -v GNU Make 3.82.90 Built for i686-pc-mingw32 Copyright (C) 1988-2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
步骤:
1.下载https://github.com/opencv/opencv
2.下载https://github.com/opencv/opencv_contrib
3.输入命令cmake-gui,分别选择源码目录和编译文件存放目录,如图:
4.点击下方configure按钮,看到configuring done说明配置成功
5.找到BUILD,选择opencv_contrib/modules存放目录,如图,
6.重复步骤4
7.点击Generate按钮,看到Generate Done,至此cmake完成。
8.cd进入mybuild目录,执行make -j4
9.坐等build 100%
10.执行make install
大功告成。
遇到问题:
C:\\MinGW\\bin\\windres.exe: unknown option -- W
...
v:\\MinGW-Builds\\mingw64\\bin\\windres.exe: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 elf32-iamcu elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex modules/core/CMakeFiles/opencv_core.dir/build.make:1642: recipe for target `modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj\' failed make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1 CMakeFiles/Makefile2:1512: recipe for target `modules/core/CMakeFiles/opencv_core.dir/all\' failed make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 Makefile:162: recipe for target `all\' failed make: *** [all] Error 2
经查明是cmake-3.9+版本的bug
解决方法:去掉ENABLE_PRECOMPILED_HEADERS再make如图:
补充:cmake-gui Configure、Generate均是为真正编译make做准备工作。也可以通过cmake -G "MinGW Makefiles".进行配置。
以上是关于opecv opencv-contrib编译的主要内容,如果未能解决你的问题,请参考以下文章
ubuntu20.04 arm-linux-gnueabihf交叉编译opencv4.7.0 与opencv-contrib-4.7.0
ubuntu20.04 arm-linux-gnueabihf交叉编译opencv4.7.0 与opencv-contrib-4.7.0
c++,opecv:HoughLines() 不接收轨迹栏传递的值
Android Studio编译OsmAnd出现警告:GeoPointParserUtil.java使用或覆盖了已过时的 API。有关详细信息请使用-Xlint:deprecation重新编译(代码片