Spatial filtering slides a small window (kernel) over the image. Each output pixel is the weighted sum of the window values. The weights decide the filter: a box blur averages neighbours, the Gaussian weights by distance, and a sharpening kernel subtracts a blurred copy from the original.
Convolving an image with a smoothing or sharpening kernel| Kernel | Action | Use |
|---|
| Box (all 1/9) | Average of 3x3 block | Fast smoothing |
| Gaussian (1,2,1 / 16) | Distance-weighted average | Noise reduction |
| Sharpen (center 5) | Original + high-pass | Emphasize edges |
| Laplacian (center 4) | Second derivative | Edge detection |
Smoothing hides detail
Noise is high-frequency; smoothing suppresses it, but it also softens genuine edges. Sharpening does the reverse: it boosts high-frequency content, which amplifies noise too.