ORB_SLAM2使用了C++11的线程和时间控制函数。
$sudo apt-get install gcc g++
ORB_SLAM2使用 Pangolin 构建可视化用户界面. 参见https://github.com/stevenlovegrove/Pangolin.
$ sudo apt-get install libglew-dev #安装Glew $ sudo apt-get install cmake #安装CMake #安装Boost $ sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev $ sudo apt-get install libpython2.7-dev #安装Python2 / Python3 #下载、编译、安装Pangolin: $ git clone https://github.com/stevenlovegrove/Pangolin.git $ cd Pangolin $ mkdir build $ cd build $ cmake -DCPP11_NO_BOOST=1 .. $ make $ sudo make install
ORB_SLAM2使用OpenCV处理图像以及特征. 参见: http://opencv.org/downloads.htm. 至少需要 2.4.3 的版本. 本测试用 OpenCV 2.4.13. (注:OpenCV 2.4.11与cuda 8.0不兼容,若需要GPU加速(使用cuda8.0,cuda8.0以前的版本不支持GTX1080),则需要安装OpenCV 2.4.13)
$ sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev$ unzip opencv-2.4.13.zip $ cd opencv-2.4.13;mkdir build;cd build; $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -DINSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -DBUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -DCUDA_GENERATION=Kepler .. $ make$ sudo make install
#在其中写入: /usr/local/lib$ sudo gedit /etc/ld.so.conf.d/opencv.conf #在文件末尾写入: #PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig #export PKG_CONFIG_PATH$ sudo ldconfig sudo gedit/etc/bash.bashrc #source此脚本$ source /etc/bash.bashrc
g2o需要Eigen,下载和安装Eigen3的方法可以看这儿: http://eigen.tuxfamily.org. 需要3.1.0及以上。(Opencv2.4.13编译时依赖此模块,最好在OpenCV2.4.13编译前安装)
提供以下功能模块:
1) 密集矩阵和数组操作
2) 解密集线性方程组和矩阵分解
-求解线性最小二乘系统
-密集矩阵分解 (Cholesky, LU, QR, SVD, 特征值分解)
3) 解稀疏线性方程组和矩阵分解
-稀疏矩阵操作
-求解稀疏线性最小二乘系统
-稀疏矩阵分解(SpareCore, OrderingMethods, SpareCholesky, SpareLU, SparseQR,迭代线性求解)
4) 空间变换
- 2D旋转(角度)
- 3D旋转(角度+轴)
- 3D旋转(四元组: quaternion)
- N维缩放
- N维平移
- N维仿射变换
- N维线性变换(旋转、平移、缩放)
$ sudo apt-get install libeigen3-dev
g2o需要BLAS和LAPACK
(1) BLAS: Basic Linear Algebra Subprograms
提供了基本的向量和矩阵操作:
- Level-1 BLAS: 支持 标量、向量、向量-向量 操作
- Level-2 BLAS: 支持 矩阵-向量 操作
- Level-3 BLAS: 支持 矩阵-矩阵 操作
(2) LAPACK:Linear Algebra PACKage
它调用BLAS来实现更高级的功能,支持以下操作:
- 解线性方程组
- 线性方程组的最小二乘解
- 特征值问题和奇异值问题
- 矩阵分解 (LU, Cholesky, QR, SVD, Schur, generalized Schur)
- 支持密集和带状矩阵,但不支持一般的稀疏矩阵
- 支持单精度和双精度
$ sudo apt-get install libblas-dev$ sudo apt-get install liblapack-dev
$ git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2$ cd ORB_SLAM2$ chmod +x build.sh$ ./build.sh
生成的libORB_SLAM2.so位于lib目录下,可执行程序mono_tum, mono_kitti, rgbd_tum, stereo_kitti, mono_euroc and stereo_euroc位于Examples目录下。
从http://vision.in.tum.de/data/datasets/rgbd-dataset/download下载并解压一个序列,如:rgbd_dataset_freiburg1_desk2.tgz
执行下面的命令(把TUMX.yaml 修改为TUM1.yaml < freiburg1序列>,TUM2.yaml < freiburg2序列> or TUM3.yaml < freiburg3序列> )
$ ./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt ./Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER #for example$ ./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt ./Examples/Monocular/TUM1.yaml ../tum_data/rgbd_dataset_freiburg1_desk2/
2) KITTI 数据集
从 http://www.cvlibs.net/datasets/kitti/eval_odometry.php下载数据集(灰度图像), 把KITTIX.yaml 修改为 KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml,这些*xx.yaml各自对应于序列 0 to 2, 3, and 4 to 12. Change PATH_TO_DATASET_FOLDER to the uncompressed dataset folder. Change SEQUENCE_NUMBER to 00, 01, 02,.., 11.如有不明白的地方,看一下代码:
./Examples/Monocular/mono_kitti Vocabulary/ORBvoc.txt Examples/Monocular/KITTIX.yaml PATH_TO_DATASET_FOLDER/dataset/sequences/SEQUENCE_NUMBER
1)KITTI 数据集
从 http://www.cvlibs.net/datasets/kitti/eval_odometry.php下载数据集(灰度图像),把KITTIX.yaml 修改为 KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml,这些*xx.yaml各自对应于序列 0 to 2, 3, and 4 to 12. Change PATH_TO_DATASET_FOLDER to the uncompressed dataset folder. Change SEQUENCE_NUMBER to 00, 01, 02,.., 11.如有不明白的地方,看一下代码:
./Examples/Stereo/stereo_kitti Vocabulary/ORBvoc.txt Examples/Stereo/KITTIX.yaml PATH_TO_DATASET_FOLDER/dataset/sequences/SEQUENCE_NUMBER
从http://vision.in.tum.de/data/datasets/rgbd-dataset/download下载并解压一个序列,如:rgbd_dataset_freiburg1_desk2.tgz
运行RGB-D实例时需要RGBD(depth)图像和RGB图像,所以需要把每一张RGB图像与之对应的RGBD图像建立关联(在Examples/RGB-D/associations/目录下有一部分关联文件,可以直接使用),关联python文件associate.py(根据timestamp进行关联)。
$ python associate.py PATH_TO_SEQUENCE/rgb.txt PATH_TO_SEQUENCE/depth.txt > associations.txt
$./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUMX.yaml PATH_TO_SEQUENCE_FOLDER ASSOCIATIONS_FILE # for example$./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt ./Examples/RGB-D/TUM1.yaml ../tum-data/rgbd_dataset_freiburg1_desk2/ ./Examples/RGB-D/associations/fr1_desk2.txt
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow