1. Epipolar Basics

1.1 Setup

setup

上图是经典的 Epipolar Geometry 极几何 的设置

  • 左右两相机的光心 / 原点

  • Epipoles,Image Point of camera origin as viewed by the other camera

    • 人话: 是右侧相机在左侧 Image Plane 上的投影, 同理
    • They are unique for a given stereo pair
  • Scene Point,拍摄场景上的一点,每个场景点都有唯一对应的 Epipolar Plane

  • Translation & Rotation Coordinates (Matrix) of in

  • Scene Point 分别在左右相机坐标系下的空间坐标

 

 

 

1.2 Epipolar Constraint

epipolar constraint

这个 constraint 的核心是:Scene Point 要在对应的 Epipolar Plane 上

图中的 为这个 Epipolar Plane 上的 Normal Vector 法向量,由于 一定在 Epipolar Plane 上,所以一定也满足

Epipolar Constraint 即

 

 

1.3 Essential Matrix

Essential Matrix 是关联 两个相机坐标系下 Scene Point 三维坐标 的工具

  • 预处理 1

    Assume is in the form

    Express the Epipolar Constraint in matrix form

    自己查 matrix cross product 就知道为什么这么写了

  • 预处理 2

    Assume is in the form

    可以通过 建立联系

将公式 (2) 代入公式 (1) 可得

由于向量对自己叉乘结果为0,所以有 ,因此

中间两个矩阵合并得到 Essential Matrix

In summary

Tip. 只要你知道了 ,就能通过 SVD 拆出

 

 

 

1.4 Fundamental Matrix

Fundamental Matrix 是关联 两个相机 Image Plane 中 Scene Point 投影坐标 的工具

Scene Point 在三维空间中的两个坐标 在各自相机 Image Plane 上对应的点为

请原谅,齐次坐标有些别扭

假设两台相机的 Intrinsic Matrix 为 ,均为已知,则有

把整理好的 公式代入

由于在齐次坐标的意义确保了 ,所以可以很安全地直接从上式中把它们干掉,最后得到

合并后得到

In Summary

 

 

1.6 Model Summary

  • Essential Matrix 展开

    For Calibrated Cameras

  • Fundamental Matrix 展开

    For Uncalibrated Camera

    此处由于去掉了 ,若使用 还原 再还原 便会出现尺度丢失的问题

  • 一半展开

  • 完全展开

 

 

 

 

 

2. Epipolar 相关应用

2.1 相机 - 求相对位姿

需要分解 Essential Matrix

需要 Scene Point 在两个相机坐标系下的三维坐标,而这几乎是不可能的

但是 1.4 提供了一条用 Fundamental Matrix ,然后再求

  1. 在两个相机的 Image Plane 上找一打对应点

  2. 用下式求出 Fundamental Matrix

  3. 用下式求出 Essential Matrix

  4. 用 SVD 从下式中拆解出

 

 

 

2.2 八点法 8-Point Algorithm

八点法是用于求解 Fundamental Matrix 的算法

 

2.2.1 基本部分

理论上 7 个自由度,选取 7 对特征点即可求出 ,但是实际上完全不够用

8-pt algorithm

如上图,八点法选取(大于)8 对特征点 ,代入下式

然后展开整理,能得到这么个齐次线性方程组

然后求 Least-Square Solution

的 scale 无所谓,所以可以加个非常 handy 的 constraint,限定 的 magnitude 为 1

用 SVD 分解可得到一个 ,但它一般不是我们要的 Fundamental Matrix

 

 

2.2.2 Rank Constraint
  • Rank Constraint of Fundamental Matrix

上一部分里通过 SVD 解得的 一般不是我们要的 Fundamental Matrix,因为 ,且一般 ,所以

这意味着 只有零解,即 ,Nein!!!

see 4.

Enforce 这个 Rank Constraint 的方法很简单,对 再进行一次 SVD

然后令 ,组合回去就是我们要的 的合法

 

2.2.3 八点法的缺陷
  • 精度较低
  • 中各元素差异较大
  • SVD 分解有数值计算问题

 

 

 

2.3 Find Correspondence

在左侧相机的 Image Plane 里指定一 Scene Point 的投影点,那 在右侧相机的 Image Plane 的投影点在何处?

 

2.3.1 Method: Epipolar Line

Epipolar Line is the Intersection of Epipolar Plane and Image Planes

epipolar line

1.1 中有提到,每个 Scene Point 都有对应的 Unique Epipolar Plane,它与两相机的 Image Plane 有唯二交线为 Epipolar Line,在图中标红

简而言之:每个 在 Epipolar 系统中都有 2条 这样的线,一个 Image Plane 一条

两个 Corresponding Points 一定在同一个 Epipolar Plane 上 (如下图中的虚线)

correspond point

而 Epipolar Plane 一定会与 Image Plane 有一条交线

所以只要能找到右侧相机 Image Plane 里的那条 Epipolar Line,找对应点的过程就能被简化为 1D Search

 

 

2.3.2 Find Epipolar Line
  • Given

    1. Fundamental Matrix
    2. Left Image 上一点
  • 方法 1:

    依据 1.6 提供的公式

    展开后得

    由于 均已知,所以可以直接合并成系数,化简所得即右侧 Image Plane 上的 Epipolar Line

    然后做个 1D Search 就完事了

  • 方法 2:

    参考 1.6 提供的公式

    以及 “点 在线 上” 的点乘条件

    对比一下可以很快得出左右 Epipolar Line 的公式

    方法 1 的结果对比一下,一模一样!

 

 

2.3.3 Example

example

 

 

 

2.4 Find Depth

epipolar

  • Given:

    1. Scene Point 在两相机 Image Plane 里的投影点坐标

    2. 两台相机的 Intrinsic Matrix

    3. 两台相机的相对位置

  • Find:

    Depth of from the Right Camera !

  • 预处理 1

    假定 中的三维坐标为

    与在各自相机 Image Plane 上的投影点 通过 Camera Matrix 分别建立联系

  • 预处理 2

    通过描述相机相对位置的 建立联系

    然后代入 预处理 1 中右侧相机的映射关系

  • Computation

    联立预处理后的两个公式

    显然 只差一个 scale ,对于 同理,因此有

    那更进一步,如果公式两侧叉乘,就会

    这样就能完全忽略归一化项 ,上式展开后联立可得

    最后 find least-square solution using Pseudo-Inverse 即可找出

 

 

 

 

 

3. Stereo

3.1 Binocular Vision Setup

这样的 Stereo System 是 Epipolar System 的特殊版本,类似于一台相机拍一张照片,然后平移一段距离,再拍一张照片

两台相机一模一样,间距为 ,且 Image Plane 相互平行,Scene Point 位于

binocular

这个系统有如下特性:

  • Epipoles 在无穷远处,左侧相机的 Epipole 在左侧无穷远,右侧的在右侧无穷远

  • Scene Point 的 Epipolar Line 水平于 Image Plane 的 轴,如上图黄线所示

    不止水平,而且重合,不过原因很简单,因为此时 Epipolar Line 是 Epipolar Plane 的组成部分之一了

  • Scene Point 的投影点高度相等

 

 

 

3.2 Triangulation

设定两台相机的 Camera Matrix 为

所以两个 Image Plane 上 Scene Point 投影点与其三维坐标的关系为

展开后分别得到

  • 右侧投影点

  • 左侧投影点

这里就能看出来

 

 

 

3.3 Disparity

Solve for with the equations of two projection points

where is Disparity,也就是一个 Scene Point 在两个 Image Plane 上 投影点的 轴距离差

  • Disparity 与 Depth 反比

    若 Scene Point 位于无限远处,那么它在相机在平移前后所摄照片里会在一模一样的位置

  • Disparity 于 Baseline 正比

    相机平移距离越长,同一个 Scene Point 在平移前后所摄照片里的 Disparity 越大

  • Disparity 仅存在于 Image Plane 的

    因为 轴数值完全相等

disparity map

右图是用某些器械手动测量的左图场景的 Disparity Map

Map 中亮度越高的地方有更大的 Disparity

所以很明显,离相机越近,Disparity 越大,与 Depth 成反比

 

 

 

3.4 Stereo Matching

  • Given

    1. 用 Binocular Vision 拍摄的左右两张图片
    2. Binocular Vision 的相机配置
  • Find

    Depth Map!

 

3.4.1 Template Matching

在左图选一个小窗口 Template Window ,由于 Binocular Vision 的特性,这个窗口的 Feature 在左右图的高度是相同的

template match

你只需要顺着一条线做 1D Search,然后用某些 Similarity Metric 匹配特征就能找到对应点

能找到对应点,就能找到 ,就能求 Disparity,就能求 Depth!

 

3.4.2 影响结果的因素
  • Window Size

    在做 Template Matching 时,选取的 Template Window 大小会对最终结果造成某些影响,各有利弊

    window size problem

  • Similarity Metric

    在做特征匹配时选的 Similarity Metric 也会有不同的效果

    similarity metric difference

 

 

3.4.3 存在的问题
  1. Repetitive Texture 重复 / 同质特征

    下图这两种 Texture 可谓大寄特寄,取 Template Window 做匹配的时候到处都能匹配上

    repetitive feat

  2. Foreshortening 透视缩短

    下图中场景投影到左右两个 Image Plane 的是同一个区域,但是右侧成像长度比左侧更短,被压缩了,不太好匹配了!

    foreshortening

  3. 遮挡

    典中典的问题

    blocking

 

 

 

 

 

4. 补充材料: Matrix Null Space

  • Null Space

    Null Space of Matrix is a set of vectors satisfying

  • Nullity

    Nulity of is the dimension of Nullspace

  • Rank-Nullity Theorem