Affine Transform
The affine transform is quite simply, a piece of art. Usually when you have a linear system with 2 dimensions, the transforms are represented by a 2x2 matrix. What the affine transform does, is add another dimension to the domain, thus enabling an extra degree of freedom.
For example, a transform in 2 dimensions would be something like:
When applied to a 2D image, where and represent the row and column of pixels in the source and destination images, the above transformation represents translations of the position of the pixels from source to destination. This allows us to create effects like the following:
Transformation name | Affine matrix | Example |
---|---|---|
Identity (transform to original image) | ||
Reflection |
These can cover all transforms of the kind
However, this cannot cover translation, which has the form
or the more general form
Enter, the affine transform. It extends the above transformation matrix such that
- Equation as well as other transformations can be supported by a single transformation matrix
- Multiple operations can be combined using a multiplication of the corresponding matrices. I.e. if represents a reflection and represents a scaling, then represents the combination. Also, the affine transform matrix is closed under multiplication, which basically says that the matrix multiplication is composable.
It is this second property that makes the affine transform so amazing.
The affine transform extends as follows:
Let’s take an example where we are translating every point by 4 pixels to the right. Then we translate it by 3 pixels downwards. The individual transforms are
The combination is
which is what we would expect for the combined combination. It is easy to see that this works for any combination of operations.
This section from the wikipedia article on affine transforms gives examples of multiple transformations and their affine matrices.
Comments