CV Lab 07 · Module 2 — Filtering & Noise

Blurring: Box, Gaussian, Median

Three ways to soften an image — but they're not equivalent. Two are smooth averages (predictable, boring math). One is a sort (weird math, superpower against noise). Watch each one destroy or preserve different things.

Box blur

uniform average

Gaussian blur

bell-curve weighted

Median blur

middle-value sort
median → middle value wins
Ready.

Click a blur type on the cards above, then tune it here.

Kernel size
5 × 5

Box blur: every pixel becomes the plain average of its neighbours. Fast, cheap — but the flat top means straight edges get blocky "steps."

Kernel visualization
1D cross-section (weights)
Impulse response (single dot → after blur)

Same word, three very different filters

Box — flat and fast

Every pixel in the neighbourhood counts equally. Because the "weight profile" is a flat top, the blur has a boxy footprint — you can see faint square halos around bright dots after a strong box blur. Cheap and everywhere in real-time pipelines.

Gaussian — the bell curve

Weights follow a bell (Gaussian) shape: centre matters most, distant neighbours barely count. The mathematically "cleanest" blur — its output curve is smooth in every direction. Sigma (σ) controls how wide the bell is; a bigger σ means more spread and more smoothing.

Median — the outlier killer

Not an average at all. Sort the 9 or 25 neighbours by brightness, take the middle value. A single hot pixel (salt) or dead pixel (pepper) never reaches the middle after sorting — it just vanishes. This is why medical scans and old scanned photos are routinely median-blurred before anything else.

Predict, then verify

You've got an old scanned photo covered in random black and white specks (salt-and-pepper noise). You need to clean it up without turning the whole image into mush. Which blur do you reach for?