Learning Objective¶
Understand the lighting model as a general linear transform, see what each parameter does geometrically in pixel-value space, and learn why orthogonal transforms (DFT, DCT) preserve energy while general linear transforms do not.
8. Linear Transformations¶
Intuition¶
In real-world template matching, the scene patch is rarely a pixel-perfect copy of the template. Lighting changes. The relationship is modelled as a linear transform:
where:
= contrast change (stretches/compresses the pixel spread)
= brightness offset (shifts all pixels up or down uniformly)
Geometric effect in pixel space¶
Scaling (): Multiplies the vector by a scalar. Changes the length (distance from origin) but not the direction. All points stay on the same ray through the origin. Cosine similarity handles this correctly.
Offset (): Adds to the vector. Shifts the point toward the diagonal. This changes the direction — so cosine similarity gives the wrong answer. Mean subtraction is needed to undo this.
9. Orthogonal (Energy-Preserving) Transforms¶
Intuition¶
An orthogonal transform is a special linear transform where the matrix satisfies:
This means:
The columns of are orthonormal (perpendicular unit vectors)
The transform is a pure rotation (and/or reflection) — no stretching
Energy is preserved:
A general linear transform can change the L2 norm (energy) of the signal:
This means the transform distorts the signal — it stretches some directions and compresses others.
Parseval’s theorem¶
Transforms like the DFT (Discrete Fourier Transform) and DCT are orthogonal. When you transform a signal to the frequency domain, the total energy is the same — it is just redistributed across frequency bins instead of pixel positions. This is Parseval’s theorem:
The hierarchy¶
All transforms
└── Linear transforms (T(ax + by) = aT(x) + bT(y))
├── General linear (energy changes)
│ • contrast scaling: I = 2T
│ • brightness offset: I = T + 50
│ • both: I = aT + b
│
└── Orthogonal / Unitary (energy preserved: ‖Qx‖ = ‖x‖)
• Rotation matrices
• DFT (Discrete Fourier Transform)
• DCT (Discrete Cosine Transform)
• Hadamard transformLinearity is necessary but not sufficient for energy preservation. Orthogonality is the additional property that guarantees it.