Image Processing & Filtering

gaussian blur

Gaussian blur smooths an image by replacing each pixel with a weighted average of its neighbourhood, where the weights follow a bell-shaped (Gaussian) curve: the closer a neighbour, the more it counts. Unlike a flat average, the soft bell falls off gently, so the blur looks natural and free of harsh artifacts. It is the canonical low-pass filter: it lets slow, smooth variations through while attenuating fine detail and high-frequency noise.

The 2D kernel is G(x,y) = (1/(2*pi*sigma^2)) * exp(-(x^2 + y^2)/(2*sigma^2)), a hill centered on the pixel whose single parameter sigma (the standard deviation) sets the blur radius: small sigma touches only the nearest neighbours, large sigma reaches far and erases more. In practice you truncate the infinite bell to a finite window of about 6*sigma + 1 pixels (covering roughly plus or minus 3 sigma). The kernel is separable into a horizontal and a vertical 1D Gaussian and isotropic (rotationally symmetric), so it blurs equally in all directions and runs fast.

Two deeper facts make the Gaussian special. Its Fourier transform is again a Gaussian, so it rolls off high frequencies smoothly with no ringing or overshoot, unlike a box filter. And convolving repeatedly with almost any small kernel approaches a Gaussian by the central limit theorem, which is why repeated box blurs approximate it cheaply. The Gaussian is also the foundation of scale space: blurring with increasing sigma generates a family of coarser images underpinning SIFT, the Laplacian-of-Gaussian, and the Gaussian image pyramid.

Before running Canny edge detection, a sigma=1.4 Gaussian (about a 9x9 kernel) is applied so that random pixel noise does not masquerade as hundreds of tiny spurious edges, the blur sets the scale of edges you care about.

Pitfall: a Gaussian blurs noise and edges alike, it has no notion of where an object boundary is. If you must reduce noise without melting edges, use an edge-preserving filter (bilateral, guided, non-local means) instead.

Also called
Gaussian smoothingGaussian low-pass filter