A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

视觉里程计简介什么是视觉里程计?

首先我们看一看维基百科的介绍在机器人和计算机视觉问题中,视觉里程计就是一个通过分析处理相关图像序列来确定机器人的位置和姿态。
In robotics and computer vision, visual odometry is the process of determining the position and orientation of a robot by analyzing the associated camera images.
我们知道在汽车中有一个里程计,记录着汽车行驶的距离,可能的计算方式就是通过计算车轮滚动的次数乘以轮子的周长,但是里程计会遇到精度的问题,例如轮子打滑,随着时间的增加,误差会变得越来越大。另外在我们机器人和视觉领域,不仅仅要知道行驶的距离,而且要知道机器人行驶的整个轨迹(机器人每个时刻的位置和姿态)我们记着在时间t时刻机器人的位置和姿态信息是<span class="MathJax" id="MathJax-Element-98-Frame" tabindex="0" data-mathml="(xt,yt,zt,&#x3C8;t,&#x3C7;t,&#x3D5;t)" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">(xt,yt,zt,ψt,χt,ϕt)(xt,yt,zt,ψt,χt,ϕt),其中<span class="MathJax" id="MathJax-Element-99-Frame" tabindex="0" data-mathml="xt,yt,zt" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">xt,yt,ztxt,yt,zt表示机器人在世界坐标系中的位置信息,<span class="MathJax" id="MathJax-Element-100-Frame" tabindex="0" data-mathml="&#x3C8;t,&#x3C7;t,&#x3D5;t" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">ψt,χt,ϕtψt,χt,ϕt表示机器人的姿态,分布表示为roll(<span class="MathJax" id="MathJax-Element-101-Frame" tabindex="0" data-mathml="&#x3C8;t" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">ψtψt), pitch(<span class="MathJax" id="MathJax-Element-102-Frame" tabindex="0" data-mathml="&#x3C7;t" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">χtχt),yaw(<span class="MathJax" id="MathJax-Element-103-Frame" tabindex="0" data-mathml="&#x3D5;t" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">ϕtϕt)
确定机器人轨迹的方法有很多,我们这里主要讲述的是视觉里程计,正如维基百科所述,我们将一个摄像头(或多个摄像头)刚性连接到一个移动的物体上(如机器人),通过摄像头采集的视频流来确定相机的6自由度,如果使用1个摄像头,则称为单目视觉里程计,如果使用两个(或者更多)摄像机,则称为立体视觉里程计。

单目或立体视觉里程计

主要阐述两者之间的优缺点,立体视觉里程计的优点在于可以估算出精确的轨迹,单目估计的轨迹存在一个比例因子,所以对于单目VO,我们可以说的是机器人在X方向上移动了一个单位,但是对于立体VO,我们可以说机器人在X方向上移动了1米。另外对于立体VO计算的轨迹通常更精确(因为提供了更多的数据),但是在有些情况下,如相见与观测物体的距离相距太远(与立体VO中的两个相机之间的距离进行对比),这样立体VO就退化为单目VO,另外考虑设备的装配,单目更有一些优势,比如在一些非常小的机器人上

基本算法过程

主要阐述简单的算法过程,基于OpenCV3.0进行简单实现,后期进行扩展,对效率及精度进行一步步优化。

输入
  • 通过摄像头获取的视频流(主要为灰度图像),记录摄像头在t和t+1时刻获得的图像为ItIt和It+1It+1
  • 相机的内参,通过相机标定获得,可以通过matlab或者opencv计算为固定量
输出
  • 计算每一帧相机的位置+姿态
基本过程
  • 获取图像 It,It+1It,It+1
  • 对获取的图像进行畸变处理
  • 通过FAST算法对图像ItIt进行特征检测,通过KLT算法跟踪这些特征到It+1It+1 中,如果跟踪特征有所丢失,特征数小于某个阈值的时候,重新进行特征检测。
  • 通过RANSAC的五店算法来估计两幅图像的本章矩阵
  • 通过计算的本质矩阵来计算R,t
  • 对尺度进行估计,最终确定旋转矩阵和平移向量

您需要登录后才可以回帖 登录 | 加入黑马