assignments-scalingterminology

Terminology for discrete scaling

This is a minor annoyance, and I’m surprised in all of these years it hasn’t come up before.

When we scale an image (say by a factor of 2), its not exactly clear what that means in terms of the sampling.

Consider the 1D case:

  1. You might think of scaling by 2 as putting a new sample between each original sample, but this leads to a result that has 2*N-1 (rather than 2*N samples).
   0     1     2
   0  1  2  3  4

1a) Since we insist that our result has 2*N samples, we could just pad an extra thing on one of the ends. Its less clear what to do if N>2, or N is not an integer.

  1. You might think about spreading out 2*N samples such that the first and last samples are in the sample places
   0    1    2
   0 1 2 3 4 5

One obvious problem is that the old samples and new samples don’t line up as nicely.

  1. Both #1 and #2 assume that the “range” of the image is 0->N-1. But, often we like to thing of the point samples of the image “in the center of the pixel” (mixing the little square model a little bit).
   |   0   |  1  |  2  |

So the real “range” of the image is -.5 to N-.5. And if we divide these pixels in half, and sample in the middle of each one, we get…

   |   0   |   1   |   2   |
   | 0 | 1 | 2 | 3 | 4 | 5 |

Which is a different sampling pattern than 1 or 2, but has the interesting effect that no samples (for the 2x scaling) case align with the original.

3A) Alternatively, you could view the samples as being at the left edge of the pixel, in which case the image actually goes from 0 to N+1 (except that the interval is open on the left). This justifies the solution of 1A.

So which is right?

In my mind, if you ask for twice as many samples, you should get 2*N samples. Not 2*N-1. Or more to the point, if you ask for a result of size M samples, that’s how many you should get.

That still leaves 3 choices. (2,3, or 1A/3A).

The 1A/3A choice is the only one that gives the nice property that the samples correspond (when the scaling factor is an integer - either up or down). So, for the purposes of this class (where we’re often talking about scaling like this), its OK.

In reality, 2 or 3 is probably better. If you do choice 3 (or 3A), you need to make sure that if you go off the edge, you do some reasonable extrapolation (i.e. pick a method for dealing with convolution boundaries that doesn’t mix 0 values at the edges).

Page last modified on September 25, 2008, at 09:52 AM