CV Lab 23 · Module 10 — Detection

Classical Object Detection

Before neural networks learned what to look for, humans hand-designed the features: gradient directions (HOG) and rectangle-sum patterns (Haar). Inspect the exact per-pixel math, watch the integral image do its trick, then break these hand-crafted features on purpose — rotation, lighting, scale — to feel exactly why deep learning replaced them.

Scan everywhere, score everything Every classical detector is the same loop: slide a window across the image at multiple scales, score each position with hand-designed features, keep the confident ones.
Gradient / feature Candidate window Confirmed detection Rejected / duplicate
Ready.
Live Explanation
Loading…

Drag the amber window, then hover anywhere for a live gradient-vector magnifying glass — I_x, I_y, magnitude, angle, and the exact bin it lands in.

Window size
96px
Orientation bins
9
📋 Live OpenCV codeHOGDescriptor

        

Hand-designed features, then a classifier

HOG is not rotation-invariant

Gradient bins are fixed to image axes. Rotate the object and every gradient direction shifts, scrambling which bin it lands in — coarser bins tolerate a bit more drift, but nothing here makes HOG genuinely rotation-invariant.

Normalisation fights lighting

Dividing a Haar response by the window's own local mean/variance cancels out a uniform brightness shift or gradient — the same trick behind real Viola-Jones robustness to lighting.

Pyramids fake scale-invariance

A fixed-size detector can only ever match one physical size well. An image pyramid tests the same small window against many resized copies of the image — brute-forcing scale coverage a CNN instead learns implicitly.

Predict, then verify

In Level 1 (Angle of Attack), you set Orientation Bins very high (18) for maximum precision. As the pedestrian rotates toward 45°, what happens to detection confidence?