CS231A Lecture 4:Single View Metrology
Reading:
[HZ] Chapter 2 “Projective Geometry and Transformation in 2D”
[HZ] Chapter 3 “Projective Geometry and Transformation in 3D”
[HZ] Chapter 8 “More Single View Geometry”
[Hoeim & Savarese] Chapter 2
2D transformations
这部分介绍了四种2D变换:Isometries、Similarities、Affinity、Projective
Isometries
等距变换(Isometries),旋转+平移。
![](/images/cs231a-lecture4/image-20221027210229618.png)
Similarities
相似变换(Similarities),相当于是等距变换与均匀缩放的结合。
![](/images/cs231a-lecture4/image-20221027210243854.png)
Affinity
仿射变换(Affine),是一个平移变换与一个非奇异线性变换的结合。
其中的A矩阵可以理解成旋转与非均匀缩放的结合。
![](/images/cs231a-lecture4/image-20221027210255599.png)
![](/images/cs231a-lecture4/image-20221027210325706.png)
![](/images/cs231a-lecture4/image-20221027210342130.png)
Projective
射影变换(Projective),是齐次坐标的一般非奇异线性变换,扩展了仿射变换,是非齐次坐标的一般非奇异线性变换和一个平移的复合。
定义:由有限次中心射影的积定义的两条直线间的一一对应变换称为一维射影变换。由有限次中心射影的积定义的两个平面之间的一一对应变换称为二维射影变换。
性质:交比不变性
如果平面上点场的点建立了一个一一对应,并且满足:
(1)任何共线三点的象仍是共线三点;
(2)共线四点的交比不变。
则这个一一对应叫做点场的射影变换,简称射影变换。
![](/images/cs231a-lecture4/image-20221027210358442.png)
The cross ratio:
![](/images/cs231a-lecture4/image-20221027210443284.png)
与其他变换的关系:
$H$矩阵是可逆实矩阵,当$v$等于0则变成了仿射变换;在仿射变换的前提下,左上角的$2 \times 2$矩阵正交时为相似变换;左上角矩阵行列式为1时为等距变换。
射影变换可以分解成一串交换链的复合。
$$
H = H_{S}H_{A}H_{P} =
\begin{bmatrix} sR&t \\ 0^{T} & 1 \end{bmatrix}
\begin{bmatrix} K&0 \\ 0^{T} & 1 \end{bmatrix}
\begin{bmatrix} I&0 \\ V^{T} & v \end{bmatrix} =
\begin{bmatrix} A & Vt\\ V^{T} & v \end{bmatrix}
$$
可以看出上式中,$H_S$表示相似变换,$H_A$表示仿射变换,$H_P$表示射影变换。
Questions
Q:射影变换与仿射变换的根本区别在于射影变换中向量$v$不为0,如何理解?
A:对于理想点$(x_{1},x_{2},0)^{T}$在仿射变换与射影变换下面的映射:
在仿射变换下:
$$
\begin{bmatrix} A &t \\ 0^{T} & 1 \end{bmatrix}
\begin{pmatrix} x_{1}\\ x_{2}\\ 0 \end{pmatrix} =
\begin{pmatrix} A\begin{pmatrix} x_{1}\\ x_{2} \end{pmatrix} \\ 0 \end{pmatrix}
$$在射影变换下:
$$
\begin{bmatrix} A &t \\ V^{T} & v \end{bmatrix}
\begin{pmatrix} x_{1}\\ x_{2}\\ 0 \end{pmatrix} =
\begin{pmatrix} A\begin{pmatrix} x_{1}\\ x_{2} \end{pmatrix} \\ v_{1}x_{1}+v_{2}x_{2}
\end{pmatrix}
$$
可以看出,对于仿射变换,理想点变换后还是理想点;对于射影变换,理想点被映射到有限点。说明射影变换能对消影点建模。
Vanishing points and lines
Lines in a 2D plane
![](/images/cs231a-lecture4/image-20221028161446651.png)
Intersecting lines
![](/images/cs231a-lecture4/image-20221028161704759.png)
2D Points at infinity (ideal points)
![](/images/cs231a-lecture4/image-20221028162147134.png)
![](/images/cs231a-lecture4/image-20221028162226539.png)
Lines infinity $l_\infty$
![](/images/cs231a-lecture4/image-20221028162718069.png)
Projective transformation
这部分和2D transformations-Questions是对应的。
a point at infinity
![](/images/cs231a-lecture4/image-20221028163811252.png)
a line (in 2D)
![](/images/cs231a-lecture4/image-20221028163842739.png)
Points and planes in 3D
3D空间中的点与平面:
![](/images/cs231a-lecture4/image-20221028164728893.png)
3D空间中的直线:
![](/images/cs231a-lecture4/image-20221028164740978.png)
Points at infinity in 3D
![](/images/cs231a-lecture4/image-20221028164857067.png)
Vanishing points
![](/images/cs231a-lecture4/image-20221028164924250.png)
Vanishing points and directions
![](/images/cs231a-lecture4/image-20221028174039533.png)
Vanishing (horizon) line
![](/images/cs231a-lecture4/image-20221028173200919.png)
Example: Are these two lines parallel or not?
![](/images/cs231a-lecture4/image-20221028174055129.png)
Vanishing points and planes
Furthermore, the horizon line allows us to compute useful properties about the world. For example, we can derive an interesting relationship between the the normal n of a plane in 3D with the corresponding horizon line $l_{horiz}$ in an image:
![](/images/cs231a-lecture4/image-20221028174710565.png)
This means that if we can recognize the horizon line associated with a plane, and if our camera is calibrated, then we can estimate the orientation of that plane.
Planes at infinity
![](/images/cs231a-lecture4/image-20221028174817317.png)
Angle between 2 vanishing points
![](/images/cs231a-lecture4/image-20221028174939830.png)
Properties of $\omega$
![](/images/cs231a-lecture4/image-20221028175128501.png)
Summary
![](/images/cs231a-lecture4/image-20221028175208575.png)
Questions
Q:为什么无穷远处的线$l_\infty=\begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}$
A:有穷点显然不在$l_\infty$上,因此$\begin{bmatrix} x \\ y \\ 1 \end{bmatrix} l_\infty \neq 0$;无穷点显然应该在$l_\infty$上,因此$\begin{bmatrix} x \\ y \\ 0 \end{bmatrix} l_\infty = 0$。
Q:为什么3D中两条平行直线的交点与直线的方向向量是相同的
A:TODO(不过把两条直线的一般方程摆出来,确实就应该是直线的方向向量才满足条件)
Estimating geometry from a single image
Single view calibration - example
![](/images/cs231a-lecture4/image-20221028175618266.png)
![](/images/cs231a-lecture4/image-20221028175656737.png)
![](/images/cs231a-lecture4/image-20221028175725632.png)
![](/images/cs231a-lecture4/image-20221028175740607.png)
![](/images/cs231a-lecture4/image-20221028175753728.png)
Single view reconstruction - example
![](/images/cs231a-lecture4/image-20221028175836046.png)
![](/images/cs231a-lecture4/image-20221028175847411.png)
Single view reconstruction - drawbacks
![](/images/cs231a-lecture4/image-20221028175939406-16677053070291.png)