最全面的homogeneous单应性坐标的定义,以及不同投影,仿射,相似,刚体变换矩阵的关系和*度分析

本文对图像的投影变换,做了最基础和全面的总结。包括了摄影几何,homogeneous单应性坐标与变换矩阵分析。


 学习的一些类容来源于:Photogrammetry - Homogeneous Coordinates.

 本文主要分析了homogeneous坐标的定义,应用点。以及不同homogeneous变换的矩阵和*度。包括了刚体变换,相似变换,仿射变换和射影变换(投影变换)。

1. Homogeneous Coordinate的定义

  需要提前了解与掌握homogeneous coordinate的相关信息。homogeneous coordinate具有尺度不变性,主要是为了方便在描述同一直线上的时候,可以用一个尺度λ\lambda 来表示一系列的点。

  1. What is homogeneous coordinate?
    Given a coordinate of a point XX,
    if :λx=X,λ0.\lambda x =X, \quad \lambda \neq0.
    then, we call this point is in the homogeneous coordinate.

   简明的说,就是在欧式坐标下,多加一个尺度因子,使用一个代表的点,就能够表明在这一条直线上的所有点。
Euclidean:xE=[x,y]THomogeneous:xH=[x,y,1]T Euclidean : \quad x_{E}=[x, y]^T \\ Homogeneous: \quad x_H = [x,y,1]^T

  1. Why should we use homogeneous coordinates?
    A Euclidean coordinate can only represent one point, where as a homogeneous coordinate can represent one line.
    最全面的homogeneous单应性坐标的定义,以及不同投影,仿射,相似,刚体变换矩阵的关系和*度分析
    比如,在欧式坐标E.C.E.C.的一点PEP_EPE=(1,2)P_E = (1,2),那么,PEP_E在单应坐标H.C.H.C.中,表示为PE=(1,2,1)P_E = (1,2,1)。由于homogeneous coordinate的性质,以下的等式成立:
    λ[121]=[121](1) \lambda \left[ \begin{matrix} 1 \\ 2 \\ 1 \end{matrix} \right] \tag{1}=\left[\begin{matrix} 1\\ 2\\ 1 \end{matrix}\right] 因此,[1,2,1][1,2,1]在homogeneous coord空间中,也表示[3,6,3][3,6,3].欧式空间中的一点[1,2][1,2]可以在H.C.H.C.空间中表示无数个点,即,一条线。

2. 使用Homogeneous Coordinate的优点

  1. Infinity has better representation in H.C.H.C. than E.C..E.C..
      In 2D world, infinity representation in E.C.E.C. is PinfinityE=[,]T.P_{infinity_{E}} = [\infty, \infty ]^T. In H.C.H.C. is PinfinityH=[1,2,0]T.P_{infinity_{H}} = [1, 2 ,0 ]^T.
      In the H.C.H.C. representation, if we normalize the coordinate using the last dimension, we get PinfinityH=[,,0]T.P_{infinity_{H}}=[\infty, \infty, 0]^T. The first two dimensions match with the representation in E.C.E.C.
      Comparing with PinfinityEP_{infinity_{E}}, clearly, PinfinityHP_{infinity_{H}} has a significant advantage that the PinfinityHP_{infinity_{H}} use its first two dimensions to indicate the direction of the infinity. Where as PinfinityEP_{infinity_{E}} only tell where the infinity is, but never shows the direction.

3. 相机投影的特点

camera projection, 投影变换(projective transformation)是最基础的变换,在homogeneous矩阵中,除了最后一个元素(2D情况下,为第9个元素;3D情况下,为第16个元素)不变,为尺度因子λ\lambda, 矩阵中的其他的所有元素,都是参数可变的。因此,投影变换矩阵的*度(DOF)最多,为8(2D homogeneous矩阵)或者15(3D homogeneous矩阵)。投影变换,只具有保线性。其他的保角性,平行性,都不再保证。关于这一系列性质的证明,见我提供的证明文件。

1. line preserving(保线性)
2. Not angle preserving (非保角性)
3. Not parallel preserving (非保平行性,平行线会交于某个点)
4. No depth, scale information (无深度,尺度信息)

4. H.C.H.C.在射影几何作用

Using H.C.H.C. in projective geometry can make the math more easier.
相机投影是将3D世界中的点投影到2D的相机图像平面,在投影过程中,深度信息被丢失。因此,我们无法知道相机图像平面上目标的大小,但由于在单应性H.C.H.C.坐标中,具有尺度不变性,这使得我们能够利用H.C.H.C.来表示我们的图像的投影。
  要想恢复深度,尺度信息,需要额外的3D信息,比如:

  1. 多张图像,不同角度,位置拍摄的;
  2. 相机的参数;
  3. 已知的拍摄物体的大小。

5. Homogeneous Transformation的*度分析

  下面对3D坐标下的变换,进行简单的分析。并分别罗列出不同变换的*度。

  1. 刚体变换(Rigid Body Transformation)
    最简单的是刚体变换(rigid body transformation)。 包括了平移(translation),旋转(rotation)。因此,旋转包括X,Y,ZX, Y, Z 3轴的变换,以及三个方向的平移。因此,*度,也就是参数的个数为6个。
    T=λ[R3×3t3×101×31](2) T \tag{2}=\lambda\left[\begin{matrix} R_{3\times 3} &t_{3\times 1}\\ 0_{1\times 3} & 1\\ \end{matrix}\right]
  2. 相似性变换(Similarity Transformation)
    在刚体变换的基础上,加上了尺度因子mm。在3×33\times 3的旋转矩阵上,乘上尺度因子。因此,*度DOF为7。矩阵中右7个未知参数。
    S=λ[mR3×3t3×101×31](3) S \tag{3}=\lambda\left[\begin{matrix} mR_{3\times 3} &t_{3\times 1}\\ 0_{1\times 3} & 1\\ \end{matrix}\right]
  3. 仿射变换(Affine Transformation)
    仿射变换具有平行性,即,变换前为平行的线段在仿射变换后,也为平行的。但角度也许会发生变化。在刚体变换的基础上,引入了3个尺度变换因子,3个剪切元素。因此,3×33\times3的旋转矩阵不在保持正交性质。因此*度DOF为9+3=12。
    A=λ[N3×3t3×101×31](4) A\tag{4}=\lambda\left[\begin{matrix} N_{3\times3} &t_{3\times 1}\\ 0_{1\times 3} & 1\\ \end{matrix}\right]
  4. 射影(投影)变换(Projective Transformation)
    平行线通过射影变换之后,不再保持平行。除了尺度归一化因子λ\lambda之外,其他所有的元素均为变量。因此,投影变换的*度DOF为15
    P=λ[N3×3t3×1a1×31](5) P\tag{5}=\lambda\left[\begin{matrix} N_{3\times3} &t_{3\times 1}\\ a_{1\times 3} & 1\\ \end{matrix}\right]
    其中,aTa^T对应于将平行线变为不平行。

6. 变换层次分析

  下面是对不同变换之间的关系,进行分析。包括了几种不同的变换,以及他们之间的*度DOF。包括2D和3D下的不同变换矩阵的*度。

Projective Transformation: 2D 8 / 3D 15 params
Affine Transformation: 2D 6 / 3D 12 params
Similarity Transformation: 2D 4 / 3D 7 params
Rigid body Transformation: 2D 3 /3D 6 params
Translation: 2D 2 / 3D 3 params
Rotation: 2D 1 / 3D 3 params