What is homography?
A homography is a mathematical relationship that maps points from one flat surface (or image) to another flat surface, assuming both surfaces lie on the same plane. In simple terms, it’s a set of equations that tells you how to stretch, rotate, shift, or skew one picture so that it lines up perfectly with another picture taken from a different viewpoint.
Let's break it down
- Imagine you have a photo of a poster on a wall. If you take another photo of the same poster from a different angle, the shape of the poster looks distorted.
- A homography is the “recipe” that describes how each point on the first photo moves to its new position on the second photo.
- Mathematically, it’s a 3×3 matrix (a grid of 9 numbers) that you multiply by the coordinates of a point to get its new coordinates.
- Because we work with images, we use “homogeneous coordinates” (adding a third value) so that scaling, rotation, and perspective changes can all be expressed with that single matrix.
Why does it matter?
Understanding homography lets computers see that two different-looking images actually show the same flat object. This is crucial for tasks where we need to compare, combine, or transform images accurately, such as stitching photos together or measuring real‑world distances from pictures.
Where is it used?
- Panorama stitching: aligning multiple photos to create a wide‑angle view.
- Augmented reality: placing virtual objects on real surfaces so they stay fixed as the camera moves.
- Robotics and drones: figuring out where a robot is relative to a floor or a wall.
- Document scanning apps: correcting the perspective of a photographed page so it looks flat.
- 3‑D reconstruction: turning multiple 2‑D views of a plane into a single, undistorted model.
Good things about it
- Simple and fast: Computing a homography only needs a few point correspondences and basic linear algebra.
- Works well for flat surfaces: If the scene is mostly planar, the result is very accurate.
- Versatile: The same matrix can handle rotation, scaling, translation, and perspective distortion all at once.
- Widely supported: Most computer‑vision libraries (OpenCV, MATLAB, etc.) have built‑in functions to estimate and apply homographies.
Not-so-good things
- Only for planes: It fails when the scene has depth variations (e.g., a 3‑D object) because a single homography cannot model those changes.
- Sensitive to errors: If the matched points are inaccurate or noisy, the computed homography can be wrong, leading to misalignment.
- Requires enough good points: At least four non‑collinear point matches are needed; fewer points make the solution impossible or unstable.
- Can produce unrealistic warps: When applied to images with large perspective differences, the result may look stretched or distorted beyond what’s useful.