I recently read that before downsampling an image, it should be blurred using a Gaussian Kernel. This way, the downsampled image is better than just picking a single pixel out of a NxN block or averaging over the block. After searching in this site as well as google, I didn't get any exact answer.

But there were questions on how to select $\sigma$ for blurring. Reading the answers on those posts, I learned that downsampling has to be done in accordance with sampling theorem. Downsampling without blurring causes aliasing effects.

  1. Can someone please explain why image has to be blurred before downsampling? I mean what is the exact relation to sampling theorem. What happens when an image is downsampled without blurring? I mean what are these aliasing effects? How can I notice them in the downsampled image?
  2. Why is Gaussian blurring better than Averaging over a block?

If you can give some examples of the images, I would be a lot grateful. Ans, I would appreciate all kind of answers, partial, intuitive, rigorous, anything.

Thank You!

up vote 10 down vote accepted

It should not, the need really depends on your application. However, this is a safe bet for most needs, and almost mandatory when you want to control the information lost by the downsampling.

Blurring is often another word for low-pass filtering. When an image contains high-frequency content (fast variations), downsampling can produce visually weird or annoying aliasing or moiré artifacts. There is an example on wikipedia Aliasing: the original

brick wall patterns

and the downsampled, represented at the same size:

brick wall patterns moiré

The ripples on the bottom right are low-frequency artifacts generated by a careless brute-force downsampling. A blurring would attenuate image sharpness, dim the borders between bricks, and reduce the apparent aliasing aspects.

The choice of appropriate blurring filters has a long history in image processing. Gaussian shapes have long been considered somehow optimal for different reasons for "theoretical" continuous images. Plus, it is both decreasing and symmetric in the space and the frequency domains. In the time domain, this means that faraway pixels have less influence. In the frequency domain, frequencies are reduced monotonously from low to high.

Since most images are discretized, reality is somewhat different. Since the Gaussian convolution used to be computationally expensive, early approximating filters were designed with short support, borrowed for instance from Pascal triangle. Later, fast recursive implementations were designed (Deriche, Shen, etc.)

I guess question 1) is answered. For question 2) simple averaging gives an equal weight to all pixels in the window. Hence, faraway pixels are given equal importance with respect to closer pixels, which is not optimal in regions where images exhibit weak stationarity, like trends, edges and textures.

  • 1
    Great answer! I’d add that simple averaging causes phase reversal for certain frequency bands, and has a much worse attenuation for the frequencies it is supposed to suppress. See here for a good example of phase reversal: crisluengo.net/index.php/archives/22 – Cris Luengo Oct 20 at 16:30
  • 1
    Let me check and further read on phase reversal, I think I never thought about it that way – Laurent Duval Oct 20 at 16:38
  • It comes about because, in the frequency domain, you have regions where the kernel is negative. – Cris Luengo Oct 20 at 17:28

According to (digital) sampling theory, signals should be properly bandlimited, before they are (down) sampled.

A digital filter limits the bandwidth of the signal and makes it suitable for downsampling without aliasing.

A Gausssian filter is very suitable as a filter, as it has a number of nice features. The Gaussian function is mathematically tractable. It has sufficient frequency attenuation. It has small time domain footprint. It has little noticeable artefacts. Therefore it's the programmers choice in image processing.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.