当前位置:网站首页>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)
边栏推荐
猜你喜欢

ML之shap:基于boston波士顿房价回归预测数据集利用shap值对XGBoost模型实现可解释性案例

Innovation and development of independent industrial software

Map of mL: Based on Boston house price regression prediction data set, an interpretable case of xgboost model using map value

How to package QT and share exe

Data warehouse interview question preparation

Use of tiledlayout function in MATLAB

Haobo medical sprint technology innovation board: annual revenue of 260million Yonggang and Shen Zhiqun are the actual controllers

【信息检索】分类和聚类的实验
![[R language data science]: cross validation and looking back](/img/a8/84a5685ebcb12d3cf8e32e1fbac053.png)
[R language data science]: cross validation and looking back

C # WPF realizes the real-time screen capture function of screen capture box
随机推荐
如何游戏出海代运营、游戏出海代投
LifeCycle
瑞吉外卖笔记
Leetcode T49: 字母异位词分组
Mask wearing detection based on yolov1
Haobo medical sprint technology innovation board: annual revenue of 260million Yonggang and Shen Zhiqun are the actual controllers
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
Detailed index of MySQL
ML:SHAP值的简介、原理、使用方法、经典案例之详细攻略
Use of tiledlayout function in MATLAB
Leetcode T48:旋转图像
Incremental ternary subsequence [greedy training]
nowcoder重排链表
递增的三元子序列[贪心训练]
【信息检索】链接分析
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
[matlab] summary of conv, filter, conv2, Filter2 and imfilter convolution functions
[FAQ] Huawei Account Service Error Report 907135701 Common reasons Summary and Solutions
尊重他人的行为
R language dplyr package summary_ If function calculates the mean and median of all numerical data columns in dataframe data, and summarizes all numerical variables based on conditions