Gaussian smooths everything — noise and edges alike. Bilateral is smarter: it only trusts a neighbour if that neighbour is close in space AND similar in colour. Result — flat regions get smoothed to porcelain while edges stay razor sharp. This is the magic behind portrait beautification, cartoon filters, and HDR tone mapping.
Hover on the image — a live "neighbour trust map" appears on the right, showing which nearby pixels bilateral is willing to average and which it refuses. On a smooth region the map is a bright blob. On an edge, it literally gets cut in half.
For every neighbour, bilateral asks two things: "How far are you?" and "How different in colour are you?" Only if both answers are small does the neighbour get to vote. This one extra question turns a mediocre smoother into an edge-preserving one.
σ spatial controls how far the influence spreads (like a normal Gaussian). σ range controls how much colour difference is tolerated. Small σ range = ultra-edge-preserving (great for portraits). Large σ range → filter degenerates back into a regular Gaussian.
Bilateral can't be separated into 1D passes like Gaussian, because each pixel's weight depends on this specific neighbourhood's colours. That makes it 10× slower — but modern phones do it in real time to make selfies look smoother without losing eye and lip crispness.
You're smoothing a portrait for a beauty filter. You want skin porcelain-smooth but eyes, eyebrows, and lips razor sharp. Which setting makes bilateral behave most like this?