Understanding the Basics
Both homography and affine transformation are geometric transformations used to map points from one image or plane to another. However, they differ in their degrees of freedom and the types of transformations they can represent.
Homography
A homography is a projective transformation that maps lines to lines. It preserves collinearity (points that are collinear in the source image remain collinear in the target image) and cross-ratios (ratios of distances between points on a line).
- Example: A homography can be used to rectify a tilted image, making it appear as if it were taken from a straight-on perspective.
Affine Transformation
An affine transformation is a linear transformation that preserves parallelism (parallel lines in the source image remain parallel in the target image) but not necessarily angles or lengths.
- Example: An affine transformation can be used to stretch or shear an image, but it cannot change the overall shape of the object.
Key Differences
Here's a table summarizing the key differences:
Feature | Homography | Affine Transformation |
---|---|---|
Type of Transformation | Projective | Linear |
Preserves | Collinearity, cross-ratios | Parallelism |
Angles | Not preserved | Not preserved (except for rotations) |
Lengths | Not preserved | Not preserved (except for rotations and uniform scaling) |
Degrees of Freedom | 8 | 6 |
Practical Applications
- Homographies: Image stitching, panorama creation, object recognition, augmented reality.
- Affine Transformations: Image registration, object tracking, shape analysis.
Conclusion
In summary, homography is a more general transformation than affine transformation, allowing for perspective changes. Affine transformations are simpler and can be used in situations where perspective distortion is not a concern.