4
$\begingroup$

I want to downsample images to arbitrary sizes using supersampling to avoid aliasing effect.

The only two good explanations I found were on Wikipedia and everything2.com, but there are still gaps. For example:

  • The image should be upsampled before supersampling. But how much? Is there any special filter to be used for upsampling prior to supersampling? Is just taking interpolated color values on sub-pixel positions in source image sufficient?
  • What if I want to resize image to e.g. 80% of its size with supersampling? How much I have to upsample it and how to treat non-integral size ratio (e.g. downsampling from 379 pixels to 377 pixels)?
  • Are the multiple samples taken from the single pixel, multiple pixels or around sample point (both cases can occur)?

UPDATE:

I have tested the "Super Sampling" method in Paint.NET with test target on this page. Suprisingly, the result looked just like "Photoshop Bicubic" filter:

enter image description here

The only advantage can been achieved by pre-blurring input image and than using some conventional method.

I've implemented and tried ordinary "Box" and "Cubic" convolution filters with excellent results!

enter image description here

enter image description here

So now I don't see any benefit of using supersampling over the convolution-based filters. Or is there any?

$\endgroup$
4
  • $\begingroup$ What is the image size you currently have and what size you want to get to? What type of images you have or what concerns you - quality, crispness or just getting to that size? $\endgroup$ Apr 18, 2012 at 5:13
  • $\begingroup$ I think Supersampling is not a regular term. There is "Super resolution" methods - but that is not quite you need here. So you should only search for "Image resizing" or "Image resampling" - which generally includes up as well as down sampling. DO NOT Reply to these comments: update your question. $\endgroup$ Apr 18, 2012 at 5:15
  • $\begingroup$ @Libor Good pictures. It's not clear to me what process you used on each version though. If you could post a "start" picture, and then the various clearly marked results, that would be cool. $\endgroup$
    – Jim Clay
    Apr 18, 2012 at 15:49
  • $\begingroup$ @Jim The start picture is in the link provided. It is 1000x1000 pixel GIF image which is too large to post it here. To compute pixels of downsampled images, I have used method from my CodeProject article. The method computes weighted average of the pixels around sample position. The weights are given by the convolution filter. The surprising fact was the it perfoms so well... I thought the supersampling is state-of-the art method for image resampling... $\endgroup$
    – Libor
    Apr 18, 2012 at 17:04

1 Answer 1

3
$\begingroup$

EDIT: I took this answer down for a time because I realized a lot depends on whether there are any idiosyncrasies in how images are mapped to pixels by actual devices, and, not being an image guy, I don't know a lot about that. I decided to bring it back, with the caveat that the answer may be insufficient given said idiosyncrasies.

The image should be upsampled before supersampling. But how much?

You are just trying to soften quantization (pixel resolution) error by collecting information from neighboring pixels. Thus, oversampling by a factor of 2 should be plenty. In other words, once you oversample until your sample resolution is twice that of the pixel resolution, nothing can be gained by oversampling more.

Is there any special filter to be used for upsampling prior to supersampling?

I might be misunderstanding the terms, but it appears to me that upsampling is part of supersampling. No, you don't need to use any special filters. Insert 0's in between your samples and then low-pass filter. You'll probably need to adjust the gain of your low-pass filter by your upsampling rate to get the pixel intensity to come out right.

What if I want to resize image to e.g. 80% of its size with supersampling?

Then factor that into your upsample/decimation calculations. After you upsample you have to decimate down to the pixel resolution. By resizing the image you are, in effect, changing the pixel resolution.

How much I have to upsample it and how to treat non-integral size ratio?

How much you have to upsample it depends on the details of the image, pixel resolution, etc.

How much I have to upsample it and how to treat non-integral size ratio?

You can deal with non-integral ratios with fractional resampling. Essentially you upsample by an integer and decimate by another integer, giving you a fractional sample change.

$\endgroup$
3
  • $\begingroup$ Thanks. It now seems to me that upsampling the image will not be necessary if I am able to take pixel values at arbitrary image points (using bilinear or bicubic interpolation). So the supersampling is then nothing more than taking multiple samples around the position (sub-pixel accuracy) in source image, right? $\endgroup$
    – Libor
    Apr 18, 2012 at 2:05
  • $\begingroup$ @Libor Yes, I suspect interpolation would work fine. Though I think you do grok supersampling at this point, I would still consider your last sentence to be incorrect. It is taking multiple neighboring points, and then blending them in an intelligent way. Interpolation and low-pass filtering are both ways to do that blending. $\endgroup$
    – Jim Clay
    Apr 18, 2012 at 2:42
  • $\begingroup$ I will make some tests with bicubic interpolator as this one does both interpolation and smoothing and compare the results with Paint.NET, which does have the supersampling resizing feature. $\endgroup$
    – Libor
    Apr 18, 2012 at 11:04

Your Answer

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

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