Direct linear transformation

From HandWiki

Direct linear transformation (DLT) is an algorithm which solves a set of variables from a set of similarity relations:

[math]\displaystyle{ \mathbf{x}_{k} \propto \mathbf{A} \, \mathbf{y}_{k} }[/math]   for [math]\displaystyle{ \, k = 1, \ldots, N }[/math]

where [math]\displaystyle{ \mathbf{x}_{k} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} }[/math] are known vectors, [math]\displaystyle{ \, \propto }[/math] denotes equality up to an unknown scalar multiplication, and [math]\displaystyle{ \mathbf{A} }[/math] is a matrix (or linear transformation) which contains the unknowns to be solved.

This type of relation appears frequently in projective geometry. Practical examples include the relation between 3D points in a scene and their projection onto the image plane of a pinhole camera,[1] and homographies.

Introduction

An ordinary system of linear equations

[math]\displaystyle{ \mathbf{x}_{k} = \mathbf{A} \, \mathbf{y}_{k} }[/math]   for [math]\displaystyle{ \, k = 1, \ldots, N }[/math]

can be solved, for example, by rewriting it as a matrix equation [math]\displaystyle{ \mathbf{X} = \mathbf{A} \, \mathbf{Y} }[/math] where matrices [math]\displaystyle{ \mathbf{X} }[/math] and [math]\displaystyle{ \mathbf{Y} }[/math] contain the vectors [math]\displaystyle{ \mathbf{x}_{k} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} }[/math] in their respective columns. Given that there exists a unique solution, it is given by

[math]\displaystyle{ \mathbf{A} = \mathbf{X} \, \mathbf{Y}^{T} \, (\mathbf{Y} \, \mathbf{Y}^{T})^{-1} . }[/math]

Solutions can also be described in the case that the equations are over or under determined.

What makes the direct linear transformation problem distinct from the above standard case is the fact that the left and right sides of the defining equation can differ by an unknown multiplicative factor which is dependent on k. As a consequence, [math]\displaystyle{ \mathbf{A} }[/math] cannot be computed as in the standard case. Instead, the similarity relations are rewritten as proper linear homogeneous equations which then can be solved by a standard method. The combination of rewriting the similarity equations as homogeneous linear equations and solving them by standard methods is referred to as a direct linear transformation algorithm or DLT algorithm. DLT is attributed to Ivan Sutherland. [2]

Example

Suppose that [math]\displaystyle{ k \in \{1, ..., N\} }[/math]. Let [math]\displaystyle{ \mathbf{x}_{k} = (x_{1k}, x_{2k}) \in \mathbb{R}^{2} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} = (y_{1k}, y_{2k}, y_{3k}) \in \mathbb{R}^{3} }[/math] be two known vectors, and we want to find the [math]\displaystyle{ 2 \times 3 }[/math] matrix [math]\displaystyle{ \mathbf{A} }[/math] such that

[math]\displaystyle{ \alpha_{k} \, \mathbf{x}_{k} = \mathbf{A} \, \mathbf{y}_{k} }[/math]

where [math]\displaystyle{ \alpha_{k} \neq 0 }[/math] is the unknown scalar factor related to equation k.

To get rid of the unknown scalars and obtain homogeneous equations, define the anti-symmetric matrix

[math]\displaystyle{ \mathbf{H} = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} }[/math]

and multiply both sides of the equation with [math]\displaystyle{ \mathbf{x}_{k}^{T} \, \mathbf{H} }[/math] from the left

[math]\displaystyle{ \begin{align} (\mathbf{x}_{k}^{T} \, \mathbf{H}) \, \alpha_{k} \, \mathbf{x}_{k} &= (\mathbf{x}_{k}^{T} \, \mathbf{H}) \, \mathbf{A} \, \mathbf{y}_{k} \\ \alpha_{k} \, \mathbf{x}_{k}^{T} \, \mathbf{H} \, \mathbf{x}_{k} &= \mathbf{x}_{k}^{T} \, \mathbf{H} \, \mathbf{A} \, \mathbf{y}_{k} \end{align} }[/math]

Since [math]\displaystyle{ \mathbf{x}_{k}^{T} \, \mathbf{H} \, \mathbf{x}_{k} = 0, }[/math] the following homogeneous equations, which no longer contain the unknown scalars, are at hand

[math]\displaystyle{ \mathbf{x}_{k}^{T} \, \mathbf{H} \, \mathbf{A} \, \mathbf{y}_{k} = 0 }[/math]

In order to solve [math]\displaystyle{ \mathbf{A} }[/math] from this set of equations, consider the elements of the vectors [math]\displaystyle{ \mathbf{x}_{k} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} }[/math] and matrix [math]\displaystyle{ \mathbf{A} }[/math]:

[math]\displaystyle{ \mathbf{x}_{k} = \begin{pmatrix} x_{1k} \\ x_{2k} \end{pmatrix} }[/math],   [math]\displaystyle{ \mathbf{y}_{k} = \begin{pmatrix} y_{1k} \\ y_{2k} \\ y_{3k} \end{pmatrix} }[/math],   and   [math]\displaystyle{ \mathbf{A} = \begin{pmatrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23} \end{pmatrix} }[/math]

and the above homogeneous equation becomes

[math]\displaystyle{ 0 = a_{11} \, x_{2k} \, y_{1k} - a_{21} \, x_{1k} \, y_{1k} + a_{12} \, x_{2k} \, y_{2k} - a_{22} \, x_{1k} \, y_{2k} + a_{13} \, x_{2k} \, y_{3k} - a_{23} \, x_{1k} \, y_{3k} }[/math]   for [math]\displaystyle{ \, k = 1, \ldots, N. }[/math]

This can also be written in the matrix form:

[math]\displaystyle{ 0 = \mathbf{b}_{k}^{T} \, \mathbf{a} }[/math]   for [math]\displaystyle{ \, k = 1, \ldots, N }[/math]

where [math]\displaystyle{ \mathbf{b}_{k} }[/math] and [math]\displaystyle{ \mathbf{a} }[/math] both are 6-dimensional vectors defined as

[math]\displaystyle{ \mathbf{b}_{k} = \begin{pmatrix} x_{2k} \, y_{1k} \\ -x_{1k} \, y_{1k} \\ x_{2k} \, y_{2k} \\ -x_{1k} \, y_{2k} \\ x_{2k} \, y_{3k} \\ -x_{1k} \, y_{3k} \end{pmatrix} }[/math]   and   [math]\displaystyle{ \mathbf{a} = \begin{pmatrix} a_{11} \\ a_{21} \\ a_{12} \\ a_{22} \\ a_{13} \\ a_{23} \end{pmatrix}. }[/math]

So far, we have 1 equation and 6 unknowns. A set of homogeneous equations can be written in the matrix form

[math]\displaystyle{ \mathbf{0} = \mathbf{B} \, \mathbf{a} }[/math]

where [math]\displaystyle{ \mathbf{B} }[/math] is a [math]\displaystyle{ N \times 6 }[/math] matrix which holds the known vectors [math]\displaystyle{ \mathbf{b}_{k} }[/math] in its rows. The unknown [math]\displaystyle{ \mathbf{a} }[/math] can be determined, for example, by a singular value decomposition of [math]\displaystyle{ \mathbf{B} }[/math]; [math]\displaystyle{ \mathbf{a} }[/math] is a right singular vector of [math]\displaystyle{ \mathbf{B} }[/math] corresponding to a singular value that equals zero. Once [math]\displaystyle{ \mathbf{a} }[/math] has been determined, the elements of matrix [math]\displaystyle{ \mathbf{A} }[/math] can rearranged from vector [math]\displaystyle{ \mathbf{a} }[/math]. Notice that the scaling of [math]\displaystyle{ \mathbf{a} }[/math] or [math]\displaystyle{ \mathbf{A} }[/math] is not important (except that it must be non-zero) since the defining equations already allow for unknown scaling.

In practice the vectors [math]\displaystyle{ \mathbf{x}_{k} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} }[/math] may contain noise which means that the similarity equations are only approximately valid. As a consequence, there may not be a vector [math]\displaystyle{ \mathbf{a} }[/math] which solves the homogeneous equation [math]\displaystyle{ \mathbf{0} = \mathbf{B} \, \mathbf{a} }[/math] exactly. In these cases, a total least squares solution can be used by choosing [math]\displaystyle{ \mathbf{a} }[/math] as a right singular vector corresponding to the smallest singular value of [math]\displaystyle{ \mathbf{B}. }[/math]

More general cases

The above example has [math]\displaystyle{ \mathbf{x}_{k} \in \mathbb{R}^{2} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} \in \mathbb{R}^{3} }[/math], but the general strategy for rewriting the similarity relations into homogeneous linear equations can be generalized to arbitrary dimensions for both [math]\displaystyle{ \mathbf{x}_{k} }[/math] and [math]\displaystyle{ \mathbf{y}_{k}. }[/math]

If [math]\displaystyle{ \mathbf{x}_{k} \in \mathbb{R}^{2} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} \in \mathbb{R}^{q} }[/math] the previous expressions can still lead to an equation

[math]\displaystyle{ 0 = \mathbf{x}_{k}^{T} \, \mathbf{H} \, \mathbf{A} \, \mathbf{y}_{k} }[/math]   for   [math]\displaystyle{ \, k = 1, \ldots, N }[/math]

where [math]\displaystyle{ \mathbf{A} }[/math] now is [math]\displaystyle{ 2 \times q. }[/math] Each k provides one equation in the [math]\displaystyle{ 2q }[/math] unknown elements of [math]\displaystyle{ \mathbf{A} }[/math] and together these equations can be written [math]\displaystyle{ \mathbf{B} \, \mathbf{a} = \mathbf{0} }[/math] for the known [math]\displaystyle{ N \times 2 \, q }[/math] matrix [math]\displaystyle{ \mathbf{B} }[/math] and unknown 2q-dimensional vector [math]\displaystyle{ \mathbf{a}. }[/math] This vector can be found in a similar way as before.

In the most general case [math]\displaystyle{ \mathbf{x}_{k} \in \mathbb{R}^{p} }[/math] and [math]\displaystyle{ \mathbf{y}_{k} \in \mathbb{R}^{q} }[/math]. The main difference compared to previously is that the matrix [math]\displaystyle{ \mathbf{H} }[/math] now is [math]\displaystyle{ p \times p }[/math] and anti-symmetric. When [math]\displaystyle{ p \gt 2 }[/math] the space of such matrices is no longer one-dimensional, it is of dimension

[math]\displaystyle{ M = \frac{p\,(p-1)}{2}. }[/math]

This means that each value of k provides M homogeneous equations of the type

[math]\displaystyle{ 0 = \mathbf{x}_{k}^{T} \, \mathbf{H}_{m} \, \mathbf{A} \, \mathbf{y}_{k} }[/math]   for   [math]\displaystyle{ \, m = 1, \ldots, M }[/math]   and for [math]\displaystyle{ \, k = 1, \ldots, N }[/math]

where [math]\displaystyle{ \mathbf{H}_{m} }[/math] is a M-dimensional basis of the space of [math]\displaystyle{ p \times p }[/math] anti-symmetric matrices.

Example p = 3

In the case that p = 3 the following three matrices [math]\displaystyle{ \mathbf{H}_{m} }[/math] can be chosen

[math]\displaystyle{ \mathbf{H}_{1} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \end{pmatrix} }[/math],   [math]\displaystyle{ \mathbf{H}_{2} = \begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 0 \\ -1 & 0 & 0 \end{pmatrix} }[/math],   [math]\displaystyle{ \mathbf{H}_{3} = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix} . }[/math]

In this particular case, the homogeneous linear equations can be written as

[math]\displaystyle{ \mathbf{0} = [\mathbf{x}_{k}]_{\times} \, \mathbf{A} \, \mathbf{y}_{k} }[/math]   for   [math]\displaystyle{ \, k = 1, \ldots, N }[/math]

where [math]\displaystyle{ [\mathbf{x}_{k}]_{\times} }[/math] is the matrix representation of the vector cross product. Notice that this last equation is vector valued; the left hand side is the zero element in [math]\displaystyle{ \mathbb{R}^{3} }[/math].

Each value of k provides three homogeneous linear equations in the unknown elements of [math]\displaystyle{ \mathbf{A} }[/math]. However, since [math]\displaystyle{ [\mathbf{x}_{k}]_{\times} }[/math] has rank = 2, at most two equations are linearly independent. In practice, therefore, it is common to only use two of the three matrices [math]\displaystyle{ \mathbf{H}_{m} }[/math], for example, for m=1, 2. However, the linear dependency between the equations is dependent on [math]\displaystyle{ \mathbf{x}_{k} }[/math], which means that in unlucky cases it would have been better to choose, for example, m=2,3. As a consequence, if the number of equations is not a concern, it may be better to use all three equations when the matrix [math]\displaystyle{ \mathbf{B} }[/math] is constructed.

The linear dependence between the resulting homogeneous linear equations is a general concern for the case p > 2 and has to be dealt with either by reducing the set of anti-symmetric matrices [math]\displaystyle{ \mathbf{H}_{m} }[/math] or by allowing [math]\displaystyle{ \mathbf{B} }[/math] to become larger than necessary for determining [math]\displaystyle{ \mathbf{a}. }[/math]

References

  1. Abdel-Aziz, Y.I.; Karara, H.M. (2015-02-01). "Direct Linear Transformation from Comparator Coordinates into Object Space Coordinates in Close-Range Photogrammetry". Photogrammetric Engineering & Remote Sensing (American Society for Photogrammetry and Remote Sensing) 81 (2): 103–107. doi:10.14358/pers.81.2.103. ISSN 0099-1112. 
  2. Sutherland, Ivan E. (April 1974), "Three-dimensional data input by tablet", Proceedings of the IEEE 62 (4): 453–461, doi:10.1109/PROC.1974.9449 
  • Richard Hartley and Andrew Zisserman (2003). Multiple View Geometry in computer vision. Cambridge University Press. ISBN 978-0-521-54051-3. 

External links