Transformation matrices

Alexander (Sasha) Pastukhov

2021-10-05

For most transformation, we assume that we can compute only the translation coefficients (\(a_i\)). The only exception are Euclidean transformation around a single axis of rotation that allow to compute a single scaling and a single rotation coefficient. In all other cases, values of computed coefficients would depend on the assumed order of individual transformation, making them no more than a potentially misleading guesses.

Bidimensional regression

Translation

Number of parameters: 2

\[ \begin{bmatrix} 1 & 0 & a_1 \\ 0 & 1 & a_2 \\ 0 & 0 & 1 \end{bmatrix} \]

Euclidean

Number of parameters: 4

\[ \begin{bmatrix} b_1 & b_2 & a_1 \\ -b_2 & b_1 & a_2 \\ 0 & 0 & 1 \end{bmatrix} \]

The Euclidean transformation is a special case, where we can compute rotation (\(\theta\)) and the single scaling (\(\phi\)) coefficients, as follows: \[ \phi = \sqrt{b_1^2 + b_2^2}\\ \theta = tan^{-1}(\frac{b_2}{b_1}) \]

Affine

Number of parameters: 6

\[ \begin{bmatrix} b_1 & b_2 & a_1 \\ b_3 & b_4 & a_2 \\ 0 & 0 & 1 \end{bmatrix} \]

Projective

Number of parameters: 8

\[ \begin{bmatrix} b_1 & b_2 & a_1 \\ b_3 & b_4 & a_2 \\ b_5 & b_6 & 1 \end{bmatrix} \]

Tridimensional regression

Translation

Number of parameters: 3

\[ \begin{bmatrix} 1 & 0 & 0 & a_1 \\ 0 & 1 & 0 & a_2 \\ 0 & 0 & 1 & a_3 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]

Euclidean

Number of parameters: 5

For all Euclidean rotations, we opted to use coefficient \(b_3\) to code scaling (\(\phi\)), whereas \(b_2 = sin(\theta)\) and \(b_1=\phi~ cos(\theta)\). The coefficients are computed as follows: \[ \phi = \sqrt{b_1^2 + b_2^2}\\ \theta = tan^{-1}(\frac{b_2}{b_1}) \]

Euclidean, rotation about x axis

Note that during fitting \(\phi\) is computed from \(b_1\) and \(b_2\) on the fly. \[ \begin{bmatrix} \phi & 0 & 0 & a_1 \\ 0 & b_1 &-b_2 & a_2 \\ 0 & b_2 & b_1 & a_3 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]

Euclidean, rotation about y axis

\[ \begin{bmatrix} b_1 & 0 & b_2 & a_1 \\ 0 & \phi & 0 & a_2 \\ -b_2 & 0 & b_1 & a_3 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]

Euclidean, rotation about z axis

\[ \begin{bmatrix} b_1 &-b_2 & 0 & a_1 \\ b_2 & b_1 & 0 & a_2 \\ 0 & 0 & \phi & a_3 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]

Affine

Number of parameters: 12

\[ \begin{bmatrix} b_1 & b_2 & b_3 & a_1 \\ b_4 & b_5 & b_6 & a_2 \\ b_7 & b_8 & b_9 & a_3 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]

Projective

Number of parameters: 15

\[ \begin{bmatrix} b_1 & b_2 & b_3 & a_1 \\ b_4 & b_5 & b_6 & a_2 \\ b_7 & b_8 & b_9 & a_3 \\ b_{10} & b_{11} & b_{12} & 1 \end{bmatrix} \]