Visual SLAM算法笔记

本文详述了Visual SLAM的发展历程,从Monocular SLAM的经典算法如Nister VO、MonoSLAM、PTAM到现代的ORB-SLAM、DSO等,分析了各自的优缺点。文章还探讨了Visual-Inertial Odometry算法,如MSCKF和OKVIS,强调了IMU数据在SLAM中的重要性。通过对各个算法的比较,展示了SLAM在实时性、精度和鲁棒性上的挑战以及解决方案。
摘要由CSDN通过智能技术生成

MulinB按:最近在学习SLAM算法,这里作为阅读笔记记录和总结一下。这里关注的主要是基于视觉的Visual SLAM或Visual Odometry,也包括一部分图像和IMU融合的Visual-Inertial Odometry相关算法。

注:下文中部分链接指向Google ScholarYoutube,有些用户可能无法访问。

一、概述

Simultaneous Localization and Mapping (SLAM)原本是Robotics领域用来做机器人定位的,最早的SLAM算法其实是没有用视觉camera的(Robotics领域一般用Laser Range Finder来做SLAM)。本文主要关注基于camera图像做SLAM的算法,即Visual SLAM算法。本文对SLAM和Visual SLAM不做区分。

其实SLAM是一个研究了30年的topic了,然而到目前仍然没有广泛走进人们的生活。个人认为,其中一个原因是SLAM对实时性要求比较高,而要做到比较精确、稳定、可靠、适合多种场景的方案一般计算量相对较大,目前移动式设备的计算能力还不足够支撑这么大的计算量,为了达到实时性能,往往需要在精确度和稳定性上做些牺牲。因此在具体的应用中,往往需要根据移动设备所具有的传感器组合、计算能力、用户场景等,选择和深度定制合适的SLAM算法。比如,无人驾驶汽车和手机端AR类应用的SLAM算法就非常不同。无人驾驶汽车中,传感器的使用可以更多样化,其中在建地图时和实时定位时的算法又很不一样,需要根据具体情况下使用的传感器类型和可以获得的地图辅助数据类型等信息进行综合性的方案设计,以达到精度和稳定性最大化。而在手机端的AR类应用中,如何利用标配的单目+MEMS IMU在旗舰类手机上得到更精确、更稳定的算法是关键任务。本文主要focus在后者。

关于SLAM的基础入门,这里不多啰嗦,列一些不错的学习资源如下:

  • Tomasz Malisiewicz的博客有一篇不错关于SLAM的文章,其中很多link的资源都很好

  • 国内有个不错的SLAM组织,叫“泡泡机器人”,其中有很多不错的SLAM课程,可以关注其微信公众号查看往期课程。另外该组织的不少成员都有博客,有很多不错的算法详细介绍的文章

另外再列一些比较强的研究SLAM的组织和牛人:


二、Monocular SLAM算法笔记

Visual SLAM的两篇开山之作应该是Davison ICCV 2003Nister CVPR 2004 Visual Odometry的两篇paper了。Andrew Davison是从Robotics领域的视角出发,将经典的non-camera的SLAM算法应用到使用single camera做SLAM的方案中,使用了经典的EKF框架,经过后续改进就是TPAMI 2007的MonoSLAM[2]算法。David Nister是Computer Vision领域3D Vision的大牛(著名的五点法就是他的作品),他的CVPR 2004 Visual Odometry paper是从3D Vision的视角出发设计的一个SLAM方案,整个方案设计的比较简单,只是着重连续较少帧的相对camera pose的估计,并没有完整的地图维护机制,因此容易造成drift。不过其3D Vision的算法和思想是后续很多的SLAM算法中都使用到的,这里先从Nister的这篇VO paper开始介绍。

Nister VO (2004) [1]

下面是Nister这篇VO paper的算法流程:

Created with Raphaël 2.1.0 TrackFeatures [使用Harris提取角点,用patch correlation做match] EstimateInitCameraPose [使用五点法从2D点匹配估计相机相对pose, 然后使用三帧图像做BA] TriangulateMapPoints [用点的track轨迹来三角化出点的3D位置, 并估计相机pose相对之前轨迹的scale] TrackFromMapPoints [根据已经三角化的3D点, 使用三点法P3P求后面帧的pose, 并用Local BA迭代refine] RefineMapPoints [根据新的track结果,进一步refine 3D points的位置] End of InnerLoop? [重复TrackFromMap和RefinePoints数次] End of OuterLoop? [重复从EstimateInitPose到RefinePoints数次] InsertFirewallAndReset [插入Firewall阻止误差累积,重新从第一步开始VO] yes no yes no

Nister的这篇paper重点介绍了vision相关的算法及实现细节(包括如何高效实现角点提取和match等),但在系统流程上有些介绍的并不详细,比如上面InnerLoop和OuterLoop的次数和条件等。算法中的很多思想在后续的Visual SLAM算法中都有沿用,比如2D to 2D用五点法计算初始pose、3D to 2D用P3P计算pose、2D correspondence -> essential matrix -> pose -> triangulation -> 3D to 2D correspondence -> P3P -> optimization的流程及子模块的迭代方式等(并不是说所有这些3D Vision算法都是Nister首创,重要的是整个流程在Visual SLAM中的应用)。

  • 算法优点:没有对motion model的假设,主要靠三点法P3P来计算相机pose;在计算过程中引入多次bundle adjustment提高精度
  • 算法缺点:算法流程具体细节描述的不太清晰;没有比较fancy的map points维护机制;插入firewall阻止误差累积的方式比较原始,无法消除drift;方法比较简单,没有跟踪丢失后重定位、回环检测等现代SLAM方法中比较常见的机制

MonoSLAM (2003-2007) [2] (code available)

Andrew Davison的MonoSLAM是将传统机器人领域中基于laser range-finder的EKF-SLAM应用到了single camera的SLAM中,算法相对于Nister VO更加完整,其中关键的提高在于通过guided feature matching取代invariant feature matching提高了计算速度。这里有个介绍MonoSLAM的不错的slides,在Github上有MonoSLAM的代码。另外,更入门的材料,关于Kalman Filter和Particle Filter的介绍,最容易intuitively理解的是udacity上Sebastian Thrun的视频课程。另外,这里有一篇非常不错的对Kalman Filter介绍的blog。

具体点讲,在MonoSLAM中,每一个state由一个当前状态的最佳估计state vector x^ ,以及一个表示该状态uncertainty的协方差矩阵 P 表示。其state vector包括相机的pose、velocity、angular velocity、以及场景中所有3D map points的坐标。该模型是一个对于state vector中参数的single modal multivariate Gaussian modeling,借用一个上述slides的图表示:
Single modal multivariate Gaussian modeling

假设场景中有 N 个3D map points,那么每次更新上述协方差矩阵的计算复杂度就是 O(N2) ,为了维持在realtime的performance,通常需要控制3D map points的个数 N<100 。虽然这表面看起来不是很高效,paper中介绍了原因如下:之所以选择一个full covariance matrix而不选择使用covariance submatrix减小计算,是因为MonoSLAM的目标是在一间room大小的场景中进行repeatable localization,这种情况下相机的view会较多的与彼此重叠,会有频繁的loop closure发生,这种情况下用一个full covariance matrix会更加精确,而且100个左右的map points足够表征一间room大小的场景。

MonoSLAM中对于特征的检测和匹配如下:特征点检测使用的是Shi-Tomasi corner detector (类似于Harris detector,这里有其区别),特征匹配是靠warped image patch进行NCC匹配(每个patch template保存其所在view的surface orientation,匹配时根据后续帧的pose将该patch template投影过去),paper中特意提到该patch template一旦初始化将不进行更新(为防止drift)。更进一步,patch template的surface orientation也是通过一个单独的Kalman filter进行estimate的(Section 3.8)。

基于Kalman filter的算法在每个时刻的计算一般分为两步:第一步,predict step;第二步,update step。在第一步中一般是根据运动模型或者控制模型预测state vector,是uncertainty propagation的过程,其中用到的运动模型或者控制模型需要根据实际场景设置其uncertainty的参数,直接影响covariance matrix的计算。在第二步中是根据观测到的结果来估计最佳state vector并减小uncertainty。借用wikipedia的公式,Kalman filter的计算过程如下:
Kalman filter

作为对比,EKF是将上述predict step中的变换矩阵 F 更换成非线性的函数 f() ,将update step中的观测矩阵 H 更换成非线性的函数

  • 60
    点赞
  • 300
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
http://www.iri.upc.edu/people/jsola/JoanSola/eng/toolbox.html EKF-SLAM TOOLBOX FOR MATLAB NEWS Upgrade 2012/04/22: Added support for Omni-directional cameras for ahmPnt and eucPnt points. From 2011/09/03 to 2011/09/08: a bug in the package released between these 5 days caused the toolbox to completely fail. Download the current version below. 2010/09/04: BUG FIX: Corrected bug in code for IDP. If you just want the bug fix, click here. Toolbox versions after 2011/09/08 are already fixed. INTRODUCTION This toolbox performs 6DOF SLAM using the classical EKF implementation. It is conceived as an "active-search" SLAM. It is provided for free under the GPL license (please read the file COPYING and make sure you agree in the terms and conditions before using it). Users employing the toolbox for scientific research should cite in their scientific communications one of the papers of the authors (especially SOLA-ETAL-IJCV-11, SOLA-ETAL-TRO-08) appearing in the References section of the documentation, and also acknowledging the use of this toolbox. • Download the 6DOF SLAM toolbox for Matlab. • Please email me with feedback, I will appreciate. • Read the pdf doc to have an idea. • Features: o Full 6DOF. o Points and lines, with many different parametrizations. Consult the IJCV'11 paper on landmark parametrization. o 3D graphics. o Works with any number of robots and sensors. o Monocular and stereo systems are treated alike. o Supports extrinsic self-calibration of multi-camera rigs as in our TRO'08 paper. • The toolbox supports undelayed initialization of the following landmark types: o ahmPnt : Anchored homogeneous points. See video. This parametrization performs equivalently to Inverse-depth points in filter consistency. o idpPnt : Inverse-Depth points, with conversion to Euclidean points (eucPnt) after confirming linearity. This follows Civera's TRO-08 paper on Inverse-depth parametrization. Seevideo. Also called Anchored Modified-polar points (AMPP) in SOLA-IJCV'11. o hmgPnt : Homogeneous points. See video. o fhmPnt : Framed Homogeneous points. We follow a work by Simone Ceriani et. al., 2011. o plkLin : Plucker lines as explained in our IROS-09 paper. See video. o aplLin : Anchored Plucker lines. See video. o idpLin : Inverse-depth points lines. See video. Also called Anchored Modified-polar points lines (AMPPL) in SOLA-IJCV'11. o hmgLin : Homogeneous-points lines. See video. o ahmLin : Anchored homogeneous-points lines. See video. o See this video that compares idpPnt against ahmPnt and hmgPnt points, showing the superior consistency of idpPnt and ahmPnt because of over-estimation of the covariance in hmgPnt.(note: in the video, hmgPnt is labeled HP, ahmPnt is AHP, and idpPnt is AMPP.) o See this video with all line parametrizations running in parallel. BUG FIXES BUG (fixed in toolbox releases after 2011/09/08): The Jacobians of the idpPnt initialization function were incorrect. This derived in a poor performance of idpPnt points. Now, idpPnt andahmPnt show equivalent performance. FIX: follow these simple steps: 1. Download this file. Unzip it. 2. Copy files idp2ahp.m and ahp2idp.m to toolbox folder %SLAMTB/Points/ 3. Copy file retroProjIdpPntFromPinHoleOnRob.m to toolbox folder %SLAMTB/Observations/ 4. Delete the obsolete bugged file %SLAMTB/Points/idpS2idpW.m from the toolbox.
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值