Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The deformation applied to the source image is a mathematical transformation that can be either linear or non-linear.

A linear transformation is expressed as:

p′=Mpp' = M p

where

For example, a translation is given by a transformation matrix defined as:

M=(10tx01ty001)⇒p′=(x′y′1)=(x+txy+ty1)M = \begin{pmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{pmatrix} \qquad\Rightarrow\qquad p' = \begin{pmatrix} x' \\ y' \\ 1 \end{pmatrix} = \begin{pmatrix} x + t_x \\ y + t_y \\ 1 \end{pmatrix}

The coordinates of pixel p′p' in the transformed image correspond to those of pixel pp in the source image after a translation of txt_x pixels in xx and tyt_y pixels in yy.

The transformation change the geometry of the image and the intensities of the transformed image are computed by using Interpolation.

The next sections illustrate several common transformations. As an example, Figure 1 presents the source image to which the transformation models are applied.

The source image.

Figure 1:The source image.

Euclidean transformation

An Euclidean transformation, also called rigid transformation, is a linear transformation consisting of a rotation by an angle α\alpha and a translation in the two axes of (tx,ty)(t_x,t_y). Thus it is defined by 3 parameters θ={α,tx,ty}\theta=\{\alpha,t_x,t_y\} and the transformation matrix is:

M=(cos⁡αsin⁡αtx−sin⁡αcos⁡αty001)M = \begin{pmatrix} \cos\alpha & \sin\alpha & t_x \\ -\sin\alpha & \cos\alpha & t_y \\ 0 & 0 & 1 \end{pmatrix}

Specifically, a translation is possible if α=0\alpha=0, and a rotation is possible if (tx,ty)=(0,0)(t_x,t_y) = (0,0).

Translation (t_x,t_y)=(25, 100).

Figure 2:Translation (tx,ty)=(25,100)(t_x,t_y)=(25, 100).

Rotation \alpha=\pi/6 (the rotation center is pixel (0,0)).

Figure 3:Rotation α=π/6\alpha=\pi/6 (the rotation center is pixel (0,0)(0,0)).

Euclidean transformation with \alpha = \pi/4 and (t_x,t_y)=(250,50).

Figure 4:Euclidean transformation with α=π/4\alpha = \pi/4 and (tx,ty)=(250,50)(t_x,t_y)=(250,50).

Affine transformation

An affine deformation is defined by 6 parameters: θ={m11,m12,m13,m21,m22,m23}\theta=\{m_{11}, m_{12}, m_{13}, m_{21}, m_{22}, m_{23}\}. It transforms the source image through a combination of translation, rotation, scaling, and shearing. Parallel lines remain parallel after the deformation, but their angles change. The deformation matrix is written as:

M=(m11m12m13m21m22m23001)M = \begin{pmatrix} m_{11} & m_{12} & m_{13} \\ m_{21} & m_{22} & m_{23} \\ 0 & 0 & 1 \end{pmatrix}
Scale of 0.7.

Figure 5:Scale of 0.7.

Shear of 0.5

Figure 6:Shear of 0.5

Affine transformation with scale 0.7 and shear 0.5.

Figure 7:Affine transformation with scale 0.7 and shear 0.5.

Projective transformation

A projective transformation, also called homography, preserves lines but not necessarily parallelism. It has 9 parameters which are the 9 elements of the matrix MM:

M=(m11m12m13m21m22m23m31m32m33)M = \begin{pmatrix} m_{11} & m_{12} & m_{13} \\ m_{21} & m_{22} & m_{23} \\ m_{31} & m_{32} & m_{33} \end{pmatrix}
Projective transformation with matrix

M = \begin{pmatrix}
  0.35   & -0.50  & 245 \\
  0.2    &  0.04  &  57 \\
  0.0004 & -0.002 &   1 \\
\end{pmatrix}.

Figure 8:Projective transformation with matrix
M=(0.35−0.502450.20.04570.0004−0.0021) M = \begin{pmatrix} 0.35 & -0.50 & 245 \\ 0.2 & 0.04 & 57 \\ 0.0004 & -0.002 & 1 \\ \end{pmatrix}.

Non-linear transformation

Alternatively, non-linear deformations can be defined using specific 2D functions (such as polynomials, sinusoids, splines, or wavelets) or non-parametric deformation fields.

Example of non-linear deformation.

Figure 9:Example of non-linear deformation.