0
$\begingroup$

I have been performing digital image upscaling of pixel art in one of my hobby projects, and the two simplest upscaling algorithms are point sampling or bilinear upscaling.

Point sampling exhibits tricky aliasing/pixel column/row duplication effects if the upscaled image size is not an integer multiple of the source image size. For example, while upscaling a 200 pixels wide image to e.g. 800 pixels wide image is easy (just repeat each pixel four times), upscaling to a 850 pixels wide image will exhibit a repeating aliasing pattern, where columns of pixels periodically have to get "doubled", e.g. group of four consecutive source pixels a,b,c,d might upscale like this:

aaaabbbbcccccdddd

where the pixel c appears five times instead of four, which can cause an annoying observable visual effect.

If on the other hand, I bilinearly upscale the 200px wide image to 850 pixels, the above "duplicated pixel column" visual effect is hard to find, but then the result will look quite blurry, since three quarters of the output pixels were interpolated smoothly.

So something I thought then was to do the following: I take the source image WxH pixels, and first upscale it using point sampling by integer scale-up factors k and m to form the largest image Wk x Hm that is still smaller than the desired final output width and height of the image.

Then bilinearly upscale this intermediate image to generate the final desired image.

So e.g. when upscaling an image of 200x300 to, say, 850x1350, what I will do is first point sample upscale this image to 800x1200 by an integer factor of four in both dimensions, and then bilinearly upscale that image to the final resolution 850x1350.

This two-step "first point-sample, then bilinearly upsample" process seems to provide a nice balance between the two algorithms for my application, and is equally simple to implement.

So I was curious what this kind of upsampling method might be called? I'd like to know more about it, but wasn't able to come up with good search terms. The closest I found in spirit was "stairstep interpolation" ( https://en.wikipedia.org/wiki/Stairstep_interpolation ) which also does repeated upscaling, but the method is still different.

EDIT: let me add images to highlight the difference.

Say I have a 320x200 source image: 320x200 source image

Point upsampling it to a desired 1440x1080 produces undesirable distortion most noticeable on raster patterns on the walls: enter image description here . Also the sizes of the pirates' eyes can become uneven.

Bilinearly upscaling is too blurry: enter image description here

But first point upscaling from 320x200 to 1280x1000, and then bilinearly upscaling that to 1440x1080 gives pleasing results that preserve rasters on the walls and the eyes, without smoothing too much: enter image description here

$\endgroup$
1
  • $\begingroup$ I don't know if that has a name... I'd suggest nearest neighbor with supersampling. the sampling pattern exhibits both aspects, multiple samples per pixel but also fairly much space between the sample clusters of pixels. $\endgroup$ Commented Jan 31, 2023 at 11:08

1 Answer 1

1
$\begingroup$

The pixel repeat scaling can be thought of as a boxcar filter scaled so that only one input pixel is considered.

Bilinear scaling is a 2-d triangular kernel scaled/sampled so that (usually) 4 input pixels contribute to each output.

I wonder if your 2-step scaling could somehow be represented as a «boxcar with tapered edges» single pass scaling. Such that usually the input pixels are just copied, but for some offsets, you get a weighted average of several input pixels?

$\endgroup$
1
  • $\begingroup$ I'd suggest a few illustrative pictures, NN sampling (rectangular), common bilinear (triangular), and a hybrid with a _/‾ shape. $\endgroup$ Commented Jan 31, 2023 at 11:14

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.