当前位置:网站首页>Opencv3.2 and opencv2.4 installation
Opencv3.2 and opencv2.4 installation
2022-07-04 14:22:00 【wu_ zhiyuan】
OpenCV2 and 3 coexistence :
If 2 The default compilation installs , that 2 The location of the library should be /usr/local/lib , Again CMakeLists.txt in find_package, By default, the system will find /usr/local/share/OpenCVConfig.cmake
Download again 3 Source code , After decompressing
mkdir build
cd build
Change the installation directory ( First in /usr/local I'm gonna go ahead and create a new folder opencv3)
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/opencv3 ..
compile :
make -j
sudo make install
This way 3 Installed in the opencv3 The folder (bin lib share include)
In use , stay CMakelists.txt in , For use 3, stay find_package Front indicated path :
set(OpenCV_DIR /usr/local/opencv3/share/OpenCV)
find_package(OpenCV 3 REQUIRED)
use 2 When :
find_package(OpenCV 2 REQUIRED)
If you want to use gdb debugging , Need to be in txt in :
SET(CMAKE_BUILD_TYPE "Debug")
However, this will slow down compilation
If you want to use C++11:
add_definitions(-std=c++11)
The simplest process :
cmake_minimum_required(VERSION 2.8)
project(XXX)
# Specify compiler :
SET(CMAKE_C_COMPILER g++)
# Find the bag you want to use :
find_package(OpenCV 3 REQUIRED)
include_directories(
${
PROJECT_SOURCE_DIR}
# Other header file paths
)
# Create a library :
add_library(${
PROJECT_NAME} SHARED
XXXXX.cpp
)
\# Link the library to the open source library
target_link_libraries(${
PROJECT_NAME}
${
OpenCV_LIBS}
)
# Generate executable files , Link to the created library
add_executable(main main.cpp)
target_link_libraries(main ${
PROJECT_NAME})
eigen Use
First of all, it needs to be in the root directory
mkdir cmake_modules
And in cmake_modules Put it in FindEigen3.cmake file
then :
set(CMAKE_MODULE_PATH ${
PROJECT_SOURCE_DIR}/cmake_modules)
# perhaps LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
find_package(Eigen3 REQUIRED)
include_directories( ${
EIGEN3_INCLUDE_DIR} )
Add :
opencv solve ippicv Download question , offline :ippicv_2019_lnx_intel64_general_20180723.tgz
https://blog.csdn.net/orDream/article/details/84311697
OpenCV must make install Install elsewhere , Otherwise, the relevant header file cannot be found , Also, you must specify the header file path , Otherwise I can't find it .
set(OpenCV_DIR /usr/local/opencv3/share/OpenCV)
# This kind of annotation is not good , Not recommended
#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)
边栏推荐
猜你喜欢
nowcoder重排链表
Leetcode T48:旋转图像
Incremental ternary subsequence [greedy training]
Mask wearing detection based on yolov1
RK1126平台OSD的实现支持颜色半透明度多通道支持中文
[antd step pit] antd form cooperates with input Form The height occupied by item is incorrect
商業智能BI財務分析,狹義的財務分析和廣義的財務分析有何不同?
Understand chisel language thoroughly 10. Chisel project construction, operation and testing (II) -- Verilog code generation in chisel & chisel development process
数据仓库面试问题准备
Remove duplicate letters [greedy + monotonic stack (maintain monotonic sequence with array +len)]
随机推荐
How to package QT and share exe
一种架构来完成所有任务—Transformer架构正在以一己之力统一AI江湖
[antd] how to set antd in form There is input in item Get input when gourp Value of each input of gourp
测试流程整理(3)
【信息检索】分类和聚类的实验
ARouter的使用
AI与生命科学
MySQL的存储过程练习题
MySQL的触发器
Learning projects are self-made, and growth opportunities are self created
Introducing testfixture into unittest framework
Leetcode T47: 全排列II
Gorm data insertion (transfer)
Data warehouse interview question preparation
递增的三元子序列[贪心训练]
redis 日常笔记
基于51单片机的超声波测距仪
[R language data science]: cross validation and looking back
PHP log debugging
Innovation and development of independent industrial software