【视觉 SLAM-2】 视觉SLAM- ORB 源码详解 2

ORB-SLAM2源码详解 by 吴博

2 https://github.com/raulmur/ORB_SLAM2

ORB-SLAM2源码详解 by 吴博

发布时间:2016年11月13日 22:09:30     浏览数:5380次     来自:微信
该算法以单目为主,但同样适用于双目和RGB-D摄像头。ORB-SLAM算法和PTAM具有相同的算法框架,采用多线程构架,四个主线程:前端位姿跟踪、局部地图构建与优化、闭环检测与优化、显示与交互 ...

ORB-SLAM是基于特征点方法的完整SLAM算法,完整注释版托管于国内码云网站:http://git.oschina.net/paopaoslam/ORB-SLAM2

   该算法以单目为主,但同样适用于双目和RGB-D摄像头。ORB-SLAM算法和PTAM具有相同的算法框架,采用多线程构架,四个主线程:前端位姿跟踪、局部地图构建与优化、闭环检测与优化、显示与交互。

   1、前端位姿跟踪线程采用恒速模型,并通过优化重投影误差优化位姿。

   2、局部地图线程通过MapPoints维护关键帧之间的共视关系,通过局部BA优化共视关键帧位姿和MapPoints。

   3、闭环检测线程通过bag-of-words加速闭环匹配帧的筛选,并通过Sim3优化尺度,通过全局BA优化Essential Graph和MapPoints。

   4、使用bag-of-words加速匹配帧的筛选,并使用EPnP算法完成重定位中的位姿估计。

  本讲将介绍ORB-SLAM的算法原理以及完整的代码实现。

  [flash]https://v.qq.com/iframe/preview.html?width=500&height=375&auto=0&vid=y0344ko90m0[/flash]

  [flash]https://v.qq.com/iframe/preview.html?width=500&height=375&auto=0&vid=y0344q39zew[/flash]

  







ORB-SLAM2源代码分析

Taylor Guo, 2016年4月14日-18:33 --2016年5月18日-22:05

摘要:
尽管可以用于立体视觉,ORB-SLAM2主要是单目SLAM系统,也就是只有一个相机(摄像头)的系统,主要用于特征识别,自主导航。ORB-SLAM2的硬件传感器也就是这一种,当然也可以加入其它传感器,比如IMU,激光雷达,超声波等。它应用于机器人,无人驾驶,无人机,增强现实AR,这样的产品中。基本来说,ORB-SLAM2还是属于计算机视觉的一个类别。
然而,由相机拍出的照片进行分析用于导航,并不简单,单纯对于以单目RGB相机为传感器的系统来说,需要从平面图像中恢复3D场景,同时既然用于导航地图的构建又比不可少,最后还要评估前述工作的一系列结果。这并不是单一程序或算法能够完成的工作,SLAM更像是一系列软件系统的集成,中间涉及到各种方法和步骤。
完整地理解SLAM及相关开源代码,需要具备如下知识: 传感器(Camera, IMU,激光,等),图像特征提取和匹配(《数字图像处理》),《多视图几何》,误差矫正和优化(《概率论》,《矩阵分析》,最小二乘优化,求Jacobian等)。其中,《多视图几何》涵盖了SLAM大部分核心内容,对它的理解程度至关重要。

根据我的SLAM学习经验,如果是工科本科起点,可以先从图像处理开始,数学工具其实可以用比较简单和适用的语言来表达和理解,我并不做研究,只是希望都简单地运用这些算法。


关于《多视图几何》的学习,可以参考知乎:http://www.zhihu.com/question/35186064/answer/61864341

当然,学习本来就不是一帆风顺,长期坚持,必有所成。

一  ORB-SLAM2 软件简述:

ORB-SLAM是基于特征识别的单目slam系统,可以实时运行。主要功能:追踪,地图构建,重定位和闭环控制。采用ORB特征,应用于实时图像系统中,具有很好的旋转不变特性。地图重构的方法采用云点和关键帧技术。Essential Graph基于位置优化的实时闭环控制,通过生成树构建,由系统、闭环控制链接和视图内容关联强边缘进行维护

二  ORB-SLAM2 系统说明:

ORB_SLAM采用相同的特征,构建地图、追踪、位置识别、基于图像帧的重定位和闭环回路检测。系统整合了三个并行的线程:追踪、局部地图构建和闭环回路控制。

A.   概要介绍
ORB_SLAM2是一个实时单目/立体/RGBD 相机SLAM库,可以计算相机轨迹和稀疏3D重构。它能检测回环,实时重定位相机。ORB_SLAM2可以在SLAM模式和定位模式之间切换,SLAM模式为默认模式,系统同步运行3个线程:跟踪,局部地图构建和回环检测。系统定位相机,构建新地图,然后闭合回环。定位模式用于已知构建好的地图,在这个模式下,只使用局部地图构建和回路闭合。系统在地图中定位相机,地图并不更新,如果有必要,采用重定位。

B. 系统构成

命名空间 (ORB_SLAM2)
命名空间为了避免变量或函数重命名的问题。多个工程师进行开发,有可能会出现全局变量或函数重名的现象;而如果每个人都定义了自己的命名空间,就可以解决这个问题,即使重名,只要分属不同的命名空间就不会引起问题。名字空间名称相同,成员名字不同,那么他们会自动合并为一个名字空间,可以理解为追加。
DBoW2


DBoW2是增强版DBoW库,开源C++库,用于将图像排序和转换成词袋模型表示。它采用层级结构的树,图像特征空间上相似的作为邻居,创建了一个视觉词典。DBoW2还采用图像数据库,采用逆序排列图像,文件快速检索和特征比较。
DBoW不要OpenCV(除非是demo),但它们是完全兼容的。测试实例:室外道路1755张图像用词袋表示,实时检查匹配情况。Intel四核[email protected],从1300张图像中提取95个单词构建字典,用了3分钟(不包括特征提取)。每新加一幅图像平均耗时约1.9ms,检索数据库平均7.2ms。

DBoW2 会自动安装DLib到系统里。DBoW2还需要安装OpenCV 和 Boost::dynamic_bitset class 以使用 BRIEF 。可以用以下命令安装Boost: $ sudo apt-get install libboost-dev 。

DLib
DLib是C++类集,用于提供更多功能使用OpenCV数据,处理计算机视觉问题。DLib主要有3个库各有不同的作用。
• DUtils: 几种通用C++类库。包括:
o BinaryFile: reads/writes binary files
o LineFile: reads/writes text files by lines
o ConfigFile: reads/writes text files with the format key = value
o FileFunctions: mkdir, rmdir, dir... functionality
o Math: math functions
o Random: pseudo-random number functions
o STL: functions for STL containers
o StringFunctions: functions to manipulae strings
Timestamp: operates with timestamps
o TimeManager: manages collections of timestamps
o Profiler: measures execution time of portions of code
o DebugFunctions: functions to measure memory consumption
• DUtilsCV: utility functions for OpenCV data types. Classes included:
o Drawing: functions to draw keypoints, data, axes...
o GUI: shows images in windows and allows some user input
o IO: I/O functions for storage and printing
o Mat: functions to remove rows from matrices
o Transformations: functions to deal with spatial transformations
o Types: functions to convert between OpenCV data types
• DVision: functions to solve computer vision tasks. Classes included:
o BRIEF: implementation of the BRIEF descriptor
o FSolver: implementation of the RANSAC + 8-point algorithm to compute fundamental matrices between images
o HSolver: implementation of the RANSAC + DLT algorithm to compute homographies between images
o ImageFunctions: functions to get patches from images
o SurfSet: manages SURF keypoints (keeping the laplacian sign) and descriptors
o BundleCamera: reads/writes camera files created by the Bundle software
o PMVSCamera, PatchFile, PLYFile: read/write data created by the PMVS software
o PixelPointFile, Matches: read/write multi-purpose pixel and 3D data files

C. 关键算法和策略

三  ORB-SLAM2 系统结构设计:

四   ORB-SLAM2 各模块的设计和实现:

orb2-tracking

⑯Tracking::更新局部云点;
⑰Tracking::更新局部关键帧;
地图云点构成关键帧
含有地图云点关键帧构成局部地图
将部分没有准备好的、与已经准备好的关键帧邻近的关键帧也包含进去,限制关键帧数量
⑱Tracking::重定位;
计算词袋向量
跟踪丢失时,查找关键帧数据库搜索候选关键帧用于重定位
执行ORB匹配,如果有足够多的匹配,执行PnP
或者执行P4P迭代,知道有足够的有效数据计算相机位姿。
⑲Tracking::重置;
⑳Tracking::更改标定参数;
⑳Tracking::传递“只跟踪“信息;

orb2-sc-loopclosing

参考资料

1.        C++命名空间 namespace的作用和使用解析

2.        详解C++中命名空间的意义和用法

3.        头文件、库文件、命名空间三者之间是什么关系?

2016年4月25日-2016年5月12日



ORB-SLAM-

欢迎访问人工智能研究网 课程中心

http://i.youku.com/studyai

这里写图片描述

ORB-SLAM算法


ORB-SLAM简介

Authors: Raul Mur-Artal, Juan D. Tardos, J. M. M. Montiel and Dorian Galvez-Lopez (DBoW2)

ORB-SLAM是15年出的比较完备的visual-based SLAM算法, 支持 Monocular, Stereo 和 RGB-D cameras。ORB指的是一种旋转不变性特征,整个算法均是基于ORB特征实现的,不同于基于稠密或半稠密地图的SLAM,ORB-SLAM是一个基于特征点地图的SLAM。最新的ORB-SLAM的进展是基于ORB-SLAM的关键帧做了半稠密场景重建,新的研究成果可持续关注下面的项目主页:http://webdiis.unizar.es/~raulmur/orbslam/  
以下为英文介绍: 
  ORB-SLAM2 is a real-time SLAM library for Monocular, Stereo and RGB-D cameras that computes the camera trajectory and a sparse 3D reconstruction (in the stereo and RGB-D case with true scale). It is able to detect loops and relocalize the camera in real time. We provide examples to run the SLAM system in the KITTI dataset as stereo or monocular, and in the TUM dataset as RGB-D or monocular. We also provide a ROS node to process live monocular or RGB-D streams. The library can be compiled without ROS. ORB-SLAM2 provides a GUI to change between a SLAM Mode and Localization Mode, see section 9 of this document.

这里写图片描述 
使用单目Monocular ORB-SLAM 的小伙伴请注意: 单目ORB-SLAM2 与 单目 ORB-SLAM 是相似的. 但是,在ORB-SLAM2 中 we apply a full bundle adjustment after a loop closure, ORB特征的抽取也稍有不同 (trying to improve the dispersion on the image) 而且跟踪也更加快一点. ORB-SLAM2 的GUI 界面也为你提供了上面所提到的新特色和一个reset按钮。我们推荐你使用新的软件,即ORB-SLAM2)

发表的相关文章: 
[1] Raúl Mur-Artal, J. M. M. Montiel and Juan D. Tardós. ORB-SLAM: A Versatile and Accurate Monocular SLAM System. IEEE Transactions on Robotics, vol. 31, no. 5, pp. 1147-1163, 2015. (2015 IEEE Transactions on Robotics Best Paper Award). 获取PDF
[2] Dorian Gálvez-López and Juan D. Tardós. Bags of Binary Words for Fast Place Recognition in Image Sequences. IEEE Transactions on Robotics, vol. 28, no. 5, pp. 1188-1197, 2012. 获取 PDF

安装ORB-SLAM的准备工作

我们在Ubuntu 12.04 and 14.04上成功测试了ORB-SLAM, 但是在其他的操作系统平台上应该也能够很轻易的成功编译。一台强大的电脑 (e.g. i7) 将能够保证实时运行和更加稳定与精确的结果。

C++11 or C++0x Compiler

我们使用了C++11的线程和时间控制函数,所以必须要用支持C++ 11.0的编译器才可以。

Pangolin

我们使用 Pangolin 构建可视化用户界面. 下载和安装Pangolin 的方法可以看这儿: https://github.com/stevenlovegrove/Pangolin.

OpenCV

我们使用OpenCVC处理图像以及特征. 下载和安装Pangolin 的方法可以看这儿: http://opencv.org. 至少需要 2.4.3 的版本. 测试用 OpenCV 2.4.11.

Eigen3

Required by g2o (see below). 下载和安装Eigen3的方法可以看这儿: http://eigen.tuxfamily.org. Required at least 3.1.0.

BLAS and LAPACK

BLAS 和LAPACK 库被 g2o 所使用 . 在Ubuntu 上如下安装:

sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
  • 1
  • 2
  • 1
  • 2

DBoW2 and g2o (Included in Thirdparty folder)

我们使用修改版的 DBoW2 库进行位置识别 ,使用 g2o 库进行非线性优化. 这两个修改版的库被放在第三方文件夹内.

ROS (可选的)

我们提供了一些例子去处理单目的camera,双目的camera或者RGB-D camera来使用ROS。 编译这些例子是可选的. 如果你要使用 ROS, a version Hydro or newer is needed.

编译 ORB-SLAM2 库以及 TUM/KITTI 例子

从Github上拷贝ORB_SLAM2:

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
  • 1
  • 1

我们提供了一个脚本 build.sh 来编译 第三方库 和 ORB-SLAM2. 请确认你已经按照上面的介绍安装了所有必需的依赖项 . 在命令行执行以下代码:

cd ORB_SLAM2
chmod +x build.sh
./build.sh
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

这一步将会创建 libORB_SLAM2.so 在lib 文件夹 和可执行文件 mono_tum, mono_kitti, rgbd_tum, stereo_kitti 在 Examples 文件夹.

Monocular 实例

TUM 数据集

  1. Download a sequence from http://vision.in.tum.de/data/datasets/rgbd-dataset/download and uncompress it.
  2. Execute the following command. Change TUMX.yaml to TUM1.yaml,TUM2.yaml or TUM3.yaml for freiburg1, freiburg2 and freiburg3 sequences respectively. Change PATH_TO_SEQUENCE_FOLDERto the uncompressed sequence folder.
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
  • 1
  • 1

KITTI 数据集

  1. Download the dataset (grayscale images) from http://www.cvlibs.net/datasets/kitti/eval_odometry.php
  2. Execute the following command. Change KITTIX.yamlby KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml for sequence 0 to 2, 3, and 4 to 12 respectively. 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
  • 1

Stereo 实例

KITTI 数据集

  1. Download the dataset (grayscale images) from http://www.cvlibs.net/datasets/kitti/eval_odometry.php
  2. Execute the following command. Change KITTIX.yamlto KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml for sequence 0 to 2, 3, and 4 to 12 respectively. 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
  • 1
  • 1

RGB-D 实例

TUM 数据集

  1. Download a sequence from http://vision.in.tum.de/data/datasets/rgbd-dataset/download and uncompress it.
  2. Associate RGB images and depth images using the python script associate.py. We already provide associations for some of the sequences in Examples/RGB-D/associations/. You can generate your own associations file executing:
  3. python associate.py PATH_TO_SEQUENCE/rgb.txt PATH_TO_SEQUENCE/depth.txt > associations.txt
  4. Execute the following command. Change TUMX.yaml to TUM1.yaml,TUM2.yaml or TUM3.yaml for freiburg1, freiburg2 and freiburg3 sequences respectively. Change PATH_TO_SEQUENCE_FOLDERto the uncompressed sequence folder. Change ASSOCIATIONS_FILE to the path to the corresponding associations file.
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUMX.yaml PATH_TO_SEQUENCE_FOLDER ASSOCIATIONS_FILE
  • 1
  • 1

ROS 实例

处理你自己的实例

你需要创建一个配置文件来校正你的摄像机。可以参照我们为TUM 和 KITTI 数据集提供的例子在monocular, stereo and RGB-D cameras情况下. 我们使用OpenCV的摄像机校正模型。 See the examples to learn how to create a program that makes use of the ORB-SLAM2 library and how to pass images to the SLAM system. Stereo input must be synchronized and rectified. RGB-D input must be synchronized and depth registered.

SLAM 和 Localization 模式

你可以使用GUI在SLAM 和 Localization 模式下自由切换

SLAM 模式

这是默认模式. 此模式下,系统有三个线程并行工作: Tracking, Local Mapping and Loop Closing. 系统不断定位相机,构建新的地图然后试图闭合环形路径。

Localization 模式

当你有一个比较好的地图的时候,你可以使用此模式。在这种模式下,局部地图构建以及环路闭合将不起作用。 系统在你提供的地图上定位相机 (which is no longer updated), using relocalization if needed.




欢迎访问人工智能研究网 课程中心

http://i.youku.com/studyai

这里写图片描述

ORB-SLAM算法


ORB-SLAM简介

Authors: Raul Mur-Artal, Juan D. Tardos, J. M. M. Montiel and Dorian Galvez-Lopez (DBoW2)

ORB-SLAM是15年出的比较完备的visual-based SLAM算法, 支持 Monocular, Stereo 和 RGB-D cameras。ORB指的是一种旋转不变性特征,整个算法均是基于ORB特征实现的,不同于基于稠密或半稠密地图的SLAM,ORB-SLAM是一个基于特征点地图的SLAM。最新的ORB-SLAM的进展是基于ORB-SLAM的关键帧做了半稠密场景重建,新的研究成果可持续关注下面的项目主页:http://webdiis.unizar.es/~raulmur/orbslam/  
以下为英文介绍: 
  ORB-SLAM2 is a real-time SLAM library for Monocular, Stereo and RGB-D cameras that computes the camera trajectory and a sparse 3D reconstruction (in the stereo and RGB-D case with true scale). It is able to detect loops and relocalize the camera in real time. We provide examples to run the SLAM system in the KITTI dataset as stereo or monocular, and in the TUM dataset as RGB-D or monocular. We also provide a ROS node to process live monocular or RGB-D streams. The library can be compiled without ROS. ORB-SLAM2 provides a GUI to change between a SLAM Mode and Localization Mode, see section 9 of this document.

这里写图片描述 
使用单目Monocular ORB-SLAM 的小伙伴请注意: 单目ORB-SLAM2 与 单目 ORB-SLAM 是相似的. 但是,在ORB-SLAM2 中 we apply a full bundle adjustment after a loop closure, ORB特征的抽取也稍有不同 (trying to improve the dispersion on the image) 而且跟踪也更加快一点. ORB-SLAM2 的GUI 界面也为你提供了上面所提到的新特色和一个reset按钮。我们推荐你使用新的软件,即ORB-SLAM2)

发表的相关文章: 
[1] Raúl Mur-Artal, J. M. M. Montiel and Juan D. Tardós. ORB-SLAM: A Versatile and Accurate Monocular SLAM System. IEEE Transactions on Robotics, vol. 31, no. 5, pp. 1147-1163, 2015. (2015 IEEE Transactions on Robotics Best Paper Award). 获取PDF
[2] Dorian Gálvez-López and Juan D. Tardós. Bags of Binary Words for Fast Place Recognition in Image Sequences. IEEE Transactions on Robotics, vol. 28, no. 5, pp. 1188-1197, 2012. 获取 PDF

安装ORB-SLAM的准备工作

我们在Ubuntu 12.04 and 14.04上成功测试了ORB-SLAM, 但是在其他的操作系统平台上应该也能够很轻易的成功编译。一台强大的电脑 (e.g. i7) 将能够保证实时运行和更加稳定与精确的结果。

C++11 or C++0x Compiler

我们使用了C++11的线程和时间控制函数,所以必须要用支持C++ 11.0的编译器才可以。

Pangolin

我们使用 Pangolin 构建可视化用户界面. 下载和安装Pangolin 的方法可以看这儿: https://github.com/stevenlovegrove/Pangolin.

OpenCV

我们使用OpenCVC处理图像以及特征. 下载和安装Pangolin 的方法可以看这儿: http://opencv.org. 至少需要 2.4.3 的版本. 测试用 OpenCV 2.4.11.

Eigen3

Required by g2o (see below). 下载和安装Eigen3的方法可以看这儿: http://eigen.tuxfamily.org. Required at least 3.1.0.

BLAS and LAPACK

BLAS 和LAPACK 库被 g2o 所使用 . 在Ubuntu 上如下安装:

sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
  • 1
  • 2
  • 1
  • 2

DBoW2 and g2o (Included in Thirdparty folder)

我们使用修改版的 DBoW2 库进行位置识别 ,使用 g2o 库进行非线性优化. 这两个修改版的库被放在第三方文件夹内.

ROS (可选的)

我们提供了一些例子去处理单目的camera,双目的camera或者RGB-D camera来使用ROS。 编译这些例子是可选的. 如果你要使用 ROS, a version Hydro or newer is needed.

编译 ORB-SLAM2 库以及 TUM/KITTI 例子

从Github上拷贝ORB_SLAM2:

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
  • 1
  • 1

我们提供了一个脚本 build.sh 来编译 第三方库 和 ORB-SLAM2. 请确认你已经按照上面的介绍安装了所有必需的依赖项 . 在命令行执行以下代码:

cd ORB_SLAM2
chmod +x build.sh
./build.sh
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

这一步将会创建 libORB_SLAM2.so 在lib 文件夹 和可执行文件 mono_tum, mono_kitti, rgbd_tum, stereo_kitti 在 Examples 文件夹.

Monocular 实例

TUM 数据集

  1. Download a sequence from http://vision.in.tum.de/data/datasets/rgbd-dataset/download and uncompress it.
  2. Execute the following command. Change TUMX.yaml to TUM1.yaml,TUM2.yaml or TUM3.yaml for freiburg1, freiburg2 and freiburg3 sequences respectively. Change PATH_TO_SEQUENCE_FOLDERto the uncompressed sequence folder.
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
  • 1
  • 1

KITTI 数据集

  1. Download the dataset (grayscale images) from http://www.cvlibs.net/datasets/kitti/eval_odometry.php
  2. Execute the following command. Change KITTIX.yamlby KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml for sequence 0 to 2, 3, and 4 to 12 respectively. 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
  • 1

Stereo 实例

KITTI 数据集

  1. Download the dataset (grayscale images) from http://www.cvlibs.net/datasets/kitti/eval_odometry.php
  2. Execute the following command. Change KITTIX.yamlto KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml for sequence 0 to 2, 3, and 4 to 12 respectively. 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
  • 1
  • 1

RGB-D 实例

TUM 数据集

  1. Download a sequence from http://vision.in.tum.de/data/datasets/rgbd-dataset/download and uncompress it.
  2. Associate RGB images and depth images using the python script associate.py. We already provide associations for some of the sequences in Examples/RGB-D/associations/. You can generate your own associations file executing:
  3. python associate.py PATH_TO_SEQUENCE/rgb.txt PATH_TO_SEQUENCE/depth.txt > associations.txt
  4. Execute the following command. Change TUMX.yaml to TUM1.yaml,TUM2.yaml or TUM3.yaml for freiburg1, freiburg2 and freiburg3 sequences respectively. Change PATH_TO_SEQUENCE_FOLDERto the uncompressed sequence folder. Change ASSOCIATIONS_FILE to the path to the corresponding associations file.
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUMX.yaml PATH_TO_SEQUENCE_FOLDER ASSOCIATIONS_FILE
  • 1
  • 1

ROS 实例

处理你自己的实例

你需要创建一个配置文件来校正你的摄像机。可以参照我们为TUM 和 KITTI 数据集提供的例子在monocular, stereo and RGB-D cameras情况下. 我们使用OpenCV的摄像机校正模型。 See the examples to learn how to create a program that makes use of the ORB-SLAM2 library and how to pass images to the SLAM system. Stereo input must be synchronized and rectified. RGB-D input must be synchronized and depth registered.

SLAM 和 Localization 模式

你可以使用GUI在SLAM 和 Localization 模式下自由切换

SLAM 模式

这是默认模式. 此模式下,系统有三个线程并行工作: Tracking, Local Mapping and Loop Closing. 系统不断定位相机,构建新的地图然后试图闭合环形路径。

Localization 模式

当你有一个比较好的地图的时候,你可以使用此模式。在这种模式下,局部地图构建以及环路闭合将不起作用。 系统在你提供的地图上定位相机 (which is no longer updated), using relocalization if needed.

猜你喜欢

转载自blog.csdn.net/kyjl888/article/details/72942209