13
\$\begingroup\$

Was reading this question and got to thinking. How exactly can you determine what the best resampling solution is? I have a concept, albeit somewhat vague, of what the basic methods do.

Are there some good general rules for different types of images? For instance using a particular set of resampling algorithms for photos and a different set for web graphics? Would the overall color of the image, contrast of the subject and the background, etc. come into play?

\$\endgroup\$
1

3 Answers 3

10
\$\begingroup\$

There are a series of very informative tutorials on Cambridge in Colour that deal with the subject of image resizing.

  1. Understanding Image Interpolation covers the basic theory behind image interpolation.
  2. Image resizing for Web and Email covers downsizing images and the pitfalls to look out for.
  3. Optimizing Digital Photo Enlargement similarly covers up-scaling images.

The last tutorial is particularly good, as there is a table of common interpolation algorithms together with a diagram that helps you visualize the trade-off each algorithm has with respect to anti-aliasing, blurring and edge halos.

\$\endgroup\$
0
7
\$\begingroup\$

The direct answer is that ultimately, you don't. In an awful lot of cases, it comes down to a question of taste. Three people looking at resized versions of a particular image might (and often will) have three different opinions about which one is best. About the best you can do is pick out which features of an image you consider important, and choose a method based on that.

For example, nearest neighbor does quite a good job of maintaining sharp edges on lines -- much more so than most interpolation methods. At the same time, it can when applied to things that should look "smooth" (e.g., clear blue sky) it can produce artifacts that look rather like edges.

The reverse is also true: interpolation can help smooth gradients, but also tends to "smooth" away what should be sharp edges. If you go too far, fine details can be wiped out completely.

Most of the better methods are adaptive to some degree. Simplifying considerably, they estimate how "sharp" of gradients the original data contains and attempt to maintain roughly the same level of smoothness/sharpness that's present in the original. The adaptation is normally done by scanning the picture in blocks, and applying the adaptation on a block-by-block basis.

For example, if you have a landscape with a clear blue sky and trees with lots of fine detail (branches, leaves, etc.) it'll apply a lot less smoothing to the branches than to the sky.

There are, however, various ways of estimating gradients, none of which is perfect, and various sizes of windows, none of which is ideal for all pictures. That leaves room for a fair amount of difference even between adaptive algorithms.

\$\endgroup\$
6
\$\begingroup\$

This site (Comparisons of Image Magnification Methods) does a good job of comparing the different interpolation methods. And if you download their tool (SAR Image Processor, version 4.3) you can actually measure the differences in quality.

While it seems to be a good guide it does not answer the question of what algorithm suits what type of image.

Below is an extract of their test results for the various interpolation algorithms. Diagram copyright general-cathexis.com.

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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