You are here: Home > Affine geometric transforms

### Affine geometric transforms

#### Short tutorial

In geometric image transforms, the pixel coordinates themselves are mapped. One class of mappings is called affine transforms. It includes scaling, rotation and translation. More specifically, the transforms are given as:

$\begin{eqnarray} x' &=& a_0 x + a_1 y + a_2\\ y' &=& b_0 x + b_1 y + b_2 \end{eqnarray}$
where (x',y') is where the point/pixel (x,y) is mapped, and $a_0, a_1, a_2, b_0, b_1$ and $b_2$ are real-valued parameters. These equations can be expressed as a simple matrix multiplication:
$\left[ \begin{array}{c} x' \\ y' \\ 1 \end{array} \right]\ = \left[ \begin{array}{ccc} a_0 & a_1 & a_2 \\ b_0 & b_1 & b_2 \\ 0 & 0 & 1 \end{array} \right] \left[ \begin{array}{c} x \\ y \\ 1 \end{array} \right]$
After changing the pixel coordinates, the image must be resampled back into a square grid of pixel values. Common techniques are nearest neighbor and bilinear interpolation. Nearest neighbor simply chooses the pixel value of the closest neihboring pixel, while bilinear interpolation does a weighted averaging of the 4 nearest pixels. Higher-order interpolation techniques are also an option, but they are more computationally expensive.

#### Applet instructions

Click the images on the upper right to change the image being processed. You can edit the numbers in the transformation matrix directly, or you can chose to alter the slidebars. The slidebars give a transform which first does the rotation, the scaling and then finally the x/y translation. If the "bilinear" checkbox is not checked, a simple nearest-neighbor interpolation is used.