①更新apt
sudo apt-get update
②安装git
sudo apt-get install git
③安装cmake
sudo apt-get install cmake
④安装gcc、g++
sudo apt-get install g++
sudo apt-get install gcc
①安装依赖项
sudo apt-get install libglew-dev libpython2.7-dev
②下载Pangolin
git clone https://github.com/stevenlovegrove/Pangolin.git
③编译安装
cd Pangolin
mkdir build
cd build
cmake ..
make -j
sudo make install
①安装依赖项
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
②下载opencv
wget -O opencv-3.4.1.zip https://github.com/Itseez/opencv/archive/3.4.1.zip
③解压opencv包
unzip opencv-3.4.1.zip
④编译并安装
cd ~/opencv-3.4.1
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release –D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j8
⑥将编译后的文件安装到系统
sudo make install
⑦配置编译环境,将OpenCV的库添加到路径
sudo gedit /etc/ld.so.conf.d/opencv.conf
⑧使配置路径生效
sudo ldconfig
⑨配置bash,在末尾添加如下代码
sudo gedit /etc/bash.bashrc
⑩使配置生效
source /etc/bash.bashrc
sudo apt-get install libeigen3-dev
①下载ORB-SLAM2
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
②编译ORB-SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh
③配置环境
sudo gedit ~/.bashrc
source ./catkin_ws/devel/setup.sh
添加以下代码,注意修改为自己设置的路径
④使修改的文件生效
source ~/.bashrc
⑤修改Examples/ROS/ORB_SLAM2/文件夹下的CMakeLists.txt文件,添加如下代码
cd catkin_ws/src/ORB_SLAM2
chmod +x build_ros.sh
./build_ros.sh
1、运行rgbd_dataset_freiburg1_xyz数据集
①从http://vision.in.tum.de/data/datasets/rgbd-dataset/download下载数据集并解压
②编译,注意修改为自己的路径
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txtExamples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
①从 http://www.cvlibs.net/datasets/kitti/eval_odometry.php下载数据集并解压
②编译
运行的命令格式为./mono_kitti path_to_vocabulary path_to_settings path_to_sequence
该命令共有4个参数:
a、mono_kitti为ORB-SLAM2编译生成的针对MONO_KITTI数据集的可执行文件,一般路径为ORB-SLAM2工程目录下Examples/Monocular/mono_kitti;
b、path_to_vocabulary为所选词典的路径,路径为ORB-SLAM2/Vocabulary/ORBvoc.txt;
c、path_to_settings为配置文件,存放在ORB-SLAM2/Examples/Monocular下,我运行时选择了KITTI00-02.yaml,该配置文件中存放的相机的内参和外参,提取特征时候图像金字塔相关参数,可视化过程中用到的参数;
d、path_to_sequence为数据集路径,这个根据自己下载的kitti数据集路径
③运行结果
在编译ORB-SLAM2时出现错误,出错提示是:无法分配内存
解决办法:手动增加swap空间,代码如下
sudo -s
dd if=/dev/zero of=/tmp/newdisk bs=1M count=8000 //分配8G
du -sh /tmp/newdisk
mkswap -f /tmp/newdisk
free -m
chmod 0600 /tmp/newdisk
①https://my.oschina.net/u/3707314/blog/1560180
②https://blog.csdn.net/qq_42585108/article/details/105519029
③https://blog.csdn.net/moyu123456789/article/details/90180635