Transformation matrices

For most transformation, we assume that we can compute only the translation coefficients (ai). 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

  • translation: a1, a2

$$ \begin{bmatrix} 1 & 0 & a_1 \\ 0 & 1 & a_2 \\ 0 & 0 & 1 \end{bmatrix} $$

Euclidean

Number of parameters: 4

  • translation: a1, a2
  • scaling: ϕ
  • rotation: θ

$$ \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 (θ) and the single scaling (ϕ) coefficients, as follows: $$ \phi = \sqrt{b_1^2 + b_2^2}\\ \theta = tan^{-1}(\frac{b_2}{b_1}) $$

Affine

Number of parameters: 6

  • translation: a1, a2
  • scaling · rotation · sheer: b1, b2, b3, b4

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

Projective

Number of parameters: 8

  • translation: a1, a2
  • scaling · rotation · sheer · projection: b1b6

$$ \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

  • translation: a1, a2, a3

$$ \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

  • translation: a1, a2, a3
  • scaling: ϕ
  • rotation: θ

For all Euclidean rotations, we opted to use coefficient b3 to code scaling (ϕ), whereas b2 = sin(θ) and b1 = ϕ cos(θ). 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 ϕ is computed from b1 and b2 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

  • translation: a1, a2, a3
  • scaling · rotation · sheer: b1b9

$$ \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

  • translation: a1, a2, a3
  • scaling · rotation · sheer · projection: b1b12

$$ \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} $$