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:
x' &=& a_0 x + a_1 y + a_2\\
y' &=& b_0 x + b_1 y + b_2
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:
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.
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.