Homography Transformation Demo
Run the Homography Transformation Demo Fullscreen
Edit the Homography Transformation Demo with the p5.js editor
About This MicroSim
This MicroSim demonstrates homography transformations - projective mappings between planes. Drag the corner points to see how a 3×3 matrix can create perspective effects.
How to Use
-
Select a Preset: Try Identity, Perspective, Rotation, or Shear transformations
-
Drag Corners: Click and drag the red corner points to create custom transformations
-
Toggle Grid: Show/hide the transformation grid to see how lines map
-
View Matrix: See the computed homography matrix and its interpretation
Key Concepts
| Transformation | DOF | Preserves | Matrix Structure |
|---|---|---|---|
| Translation | 2 | Everything | [I | t] |
| Euclidean | 3 | Distances | [R | t] |
| Affine | 6 | Parallelism | [A | t] |
| Projective | 8 | Straight lines | Full 3×3 |
Learning Objectives
Students will be able to: - Understand homographies as mappings between projective planes - Apply the 3×3 homography matrix to transform points - Recognize the hierarchy of 2D transformations - Use homographies for perspective correction applications
The Mathematics
Homography Equation (homogeneous coordinates):
Cartesian Coordinates:
Lesson Plan
Introduction (5 minutes)
Homographies model the mapping when a camera views a planar surface from different angles. Unlike affine transformations, they can make parallel lines converge.
Exploration (10 minutes)
- Start with Identity - source equals destination
- Try Perspective - observe converging lines (railroad tracks effect)
- Use Rotation - note that angles are preserved
- Test Shear - parallel lines remain parallel (affine subset)
Interactive Exercise (10 minutes)
- Drag corners to simulate "looking at a sign from an angle"
- Try to make a trapezoid into a rectangle (perspective correction)
- Observe the matrix values as you drag
Discussion Questions
- Why does a homography have 8 DOF, not 9?
- What real-world situations create homography relationships?
- How would you correct a photo of a tilted document?
Applications
- Panorama Stitching: Align overlapping photos
- Document Scanning: Straighten tilted captures
- Augmented Reality: Place virtual objects on surfaces
- Sports Graphics: Insert ads on playing fields