当前位置:网站首页>opencv3.2 和opencv2.4安装
opencv3.2 和opencv2.4安装
2022-07-04 12:51:00 【wu_zhiyuan】
OpenCV2和3共存:
如果2默认编译安装了,那么2的库位置应该在/usr/local/lib ,再CMakeLists.txt中 find_package,系统默认会找/usr/local/share/OpenCVConfig.cmake
再下载3源码,解压后
mkdir build
cd build
更改安装目录(先在/usr/local下新建文件夹opencv3)
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/opencv3 ..
编译:
make -j
sudo make install
这样就把3安装在opencv3文件夹了(bin lib share include)
在使用的时候,在CMakelists.txt中,如要用3,在find_package前指明路径:
set(OpenCV_DIR /usr/local/opencv3/share/OpenCV)
find_package(OpenCV 3 REQUIRED)
用2的时候:
find_package(OpenCV 2 REQUIRED)
如果要用gdb调试,需要在txt中:
SET(CMAKE_BUILD_TYPE "Debug")
不过这样会减慢编译速度
如果要用C++11:
add_definitions(-std=c++11)
最简单的流程:
cmake_minimum_required(VERSION 2.8)
project(XXX)
#指定编译器:
SET(CMAKE_C_COMPILER g++)
#找到要用的包:
find_package(OpenCV 3 REQUIRED)
include_directories(
${
PROJECT_SOURCE_DIR}
#其他头文件路径
)
#创建库:
add_library(${
PROJECT_NAME} SHARED
XXXXX.cpp
)
\#给库链接到开源库
target_link_libraries(${
PROJECT_NAME}
${
OpenCV_LIBS}
)
#生成可执行文件,链接到创建的库
add_executable(main main.cpp)
target_link_libraries(main ${
PROJECT_NAME})
eigen的使用
首先需要在根目录
mkdir cmake_modules
并在cmake_modules里放进 FindEigen3.cmake文件
然后:
set(CMAKE_MODULE_PATH ${
PROJECT_SOURCE_DIR}/cmake_modules)
#或者 LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
find_package(Eigen3 REQUIRED)
include_directories( ${
EIGEN3_INCLUDE_DIR} )
补充:
opencv 解决ippicv下载问题,离线:ippicv_2019_lnx_intel64_general_20180723.tgz
https://blog.csdn.net/orDream/article/details/84311697
OpenCV必须make install 安装到其他地方,不然相关头文件找不到,还有必须指定头文件路径,否则找不到。
set(OpenCV_DIR /usr/local/opencv3/share/OpenCV)
#注释的这种不好,不推荐
#set(OpenCV_DIR /home/guoxianzheng/opencv-3.4/build)
find_package(OpenCV 3 REQUIRED)
message(STATUS "This is opencvdir ${OpenCV_DIR}")
include_directories(
${
OpenCV_DIR}
)
include_directories(/usr/local/opencv3/include)
边栏推荐
- C # WPF realizes the real-time screen capture function of screen capture box
- LiveData
- Data warehouse interview question preparation
- 基于YOLOv1的口罩佩戴检测
- R语言使用epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用by参数指定分组参数可视化不同分组的点图分布
- golang fmt. Printf() (turn)
- Product identification of intelligent retail cabinet based on paddlex
- 瑞吉外卖笔记
- R语言ggplot2可视化:gganimate包创建动画图(gif)、使用anim_save函数保存gif可视化动图
- 测试流程整理(3)
猜你喜欢
![Remove duplicate letters [greedy + monotonic stack (maintain monotonic sequence with array +len)]](/img/af/a1dcba6f45eb4ccc668cd04a662e9c.png)
Remove duplicate letters [greedy + monotonic stack (maintain monotonic sequence with array +len)]

Applet live + e-commerce, if you want to be a new retail e-commerce, use it!

吃透Chisel语言.05.Chisel基础(二)——组合电路与运算符

sql优化之explain

基于YOLOv1的口罩佩戴检测

Understand chisel language thoroughly 09. Chisel project construction, operation and testing (I) -- build and run chisel project with SBT

Learn kernel 3: use GDB to track the kernel call chain

gin集成支付宝支付

Understand chisel language thoroughly 05. Chisel Foundation (II) -- combinational circuits and operators

Understand chisel language thoroughly 11. Chisel project construction, operation and test (III) -- scalatest of chisel test
随机推荐
MySQL 5 installation and modification free
BLOB,TEXT GEOMETRY or JSON column 'xxx' can't have a default value query 问题
File creation, writing, reading, deletion (transfer) in go language
迅为IMX6Q开发板QT系统移植tinyplay
【FAQ】華為帳號服務報錯 907135701的常見原因總結和解决方法
xshell/bash/zsh 等终端鼠标滚轮乱码问题(转)
Huahao Zhongtian rushes to the scientific and Technological Innovation Board: the annual loss is 280million, and it is proposed to raise 1.5 billion. Beida pharmaceutical is a shareholder
吃透Chisel语言.05.Chisel基础(二)——组合电路与运算符
Ws2818m is packaged in cpc8. It is a special circuit for three channel LED drive control. External IC full-color double signal 5v32 lamp programmable LED lamp with outdoor engineering
Matters needing attention in overseas game Investment Agency
The mouse wheel of xshell/bash/zsh and other terminals is garbled (turn)
吃透Chisel语言.07.Chisel基础(四)——Bundle和Vec
R language uses follow up of epidisplay package The plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses stress The col parameter specifies the
卷积神经网络经典论文集合(深度学习分类篇)
GCC【6】- 编译的4个阶段
MATLAB中tiledlayout函数使用
Basic mode of service mesh
Unity shader learning (3) try to draw a circle
sharding key type not supported
docker-compose公网部署redis哨兵模式