赞
踩
sudo apt install build-essential
cmake 用来管理c++项目源代码
cmake .. 根据CMakeLists.txt文件,生成makefile
make -j4 根据makefile文件内容编译工程,即生成可执行文件
make install 将可执行文件、第三方依赖包和文档安装到正确的路径
cd cmake-3.**
./bootstrap
make -j4
sudo make install
cmake --version
sudo apt install libssl-dev
sudo apt install libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
# 处理图像所需的包
sudo apt install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394-22-dev
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
# 处理视频所需的包
sudo apt install libxvidcore-dev libx264-dev
sudo apt install ffmpeg
#可能需要安装的依赖
sudo apt install libjasper1 libjasper-dev
#创建build 目录,并进入
sudo mkdir build
cd build
sudo cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=YES -D CMAKE_INSTALL_PREFIX=/usr/local/opencv -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.3.0/modules -D OPENCV_ENABLE_NONFREE=True -D WITH_GTK=ON -D WITH_OPENMP=ON ..
参数解释
cmake -D CMAKE_BUILD_TYPE=Release # 选择Release模式
OPENCV_GENERATE_PKGCONFIG=YES # 创建 PKGCONFIG文件
CMAKE_INSTALL_PREFIX=/usr/local/opencv # 安装路径
WITH_GTK=ON # ubuntu 上显示窗口必须加上这个
#make的-j参数:多线程编译,参数可以是2,4,8,16
sudo make -j4
#安装
sudo make install
安装路径为:
/usr/local/opencv/include/opencv4
/usr/local/opencv/include
可自行查看是否安装成功
问题1: ~/opencv_contrib/modules/xfeatures2d/src/boostdesc.cpp:673:20: fatal error: boostdesc_bgm.i: No such file or directory
解决方法:链接: https://pan.baidu.com/s/1YzqO9PJUpflV8ivKuCRNuQ?pwd=slam 提取码: slam 将文件解压复制到opencv_contrib4.3.0/modules/xfeatures2d/src/
问题2:出现opencv-3.4.0/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:12: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory
解决方法:在报错的那个module中,这里是stitching文件夹下的CMakeLists中添加:INCLUDE_DIRECTORIES(“/opencv-3.4.0/opencv_contrib-3.4.0/modules/xfeatures2d/include”)
注意路径
sudo apt install libeigen3-dev
终端进入slambook2/3rdpart/Sophus文件目录
创建 build 目录并进入
sudo mkdir build
cd build
sudo cmake ..
sudo make -j4
sudo make install
# OpenGL库
sudo apt install libglew-dev
sudo apt install pkg-config
sudo apt install doxygen
sudo mkdir build
cd build
sudo cmake ..
sudo make -j4
sudo make install
若CMake报错
错误信息
CMake Error at
external/pybind11/tools/FindPythonLibsNew.cmake:95 (message):
Python config failure: Traceback (most recent call last):
File “”, line 1, in ImportError: cannot import name ‘sysconfig’
sudo apt install python3-pip
# 日志和测试工具
sudo apt install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev
sudo mkdir build
cd build
sudo cmake ..
sudo make -j4
sudo make install
sudo apt install qt5-qmake qt5-default libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod3
sudo mkdir build
cd build
sudo cmake ..
sudo make -j4
sudo make install
需要优先安装OpenCV
终端进入slambook2/3rdparty/g2o文件目录
创建 build 目录并进入
sudo mkdir build
cd build
sudo cmake ..
sudo make -j4
sudo make install
sudo apt install libpcl-dev pcl-tools
安装路径
/usr/include/vtk-6.3;/usr/include/boost
可自行查看
若报错
错误信息:
The following packages have unmet dependencies:libpcl-dev : Depends: libvtk6-dev but it is not going to be installed Depends: libvtk6-qt-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages.
#使用aptitude 安装,先选择n,后选择y
sudo aptitude install libpcl-dev
sudo apt install liboctomap-dev octovis
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。