Sampling

 

Sub Sampling: 

Sub sampling is done by taking every other pixel in an image.  This is a simple process that can easily be done which will divide the total size of the image by 4.  (half the height and half the width).

A special form of sub sampling allows us to reduce the image by as little as 1 pixel at a time.  To reduce an image, we calculate the new set of pixels in terms of the old set, depending on how close the new pixel is to the old.  We can take an equation using linear interpolation to do this.  The equation is as follows:

G(t) = (1-t)G1 + t*G2

Therefore, if we had an 8 pixel wide image that we wanted to reduce to 7 pixels, we could use the following equation to calculate the first pixel (1/7 of the way across).

G(1/7) = (6/7)*G1 + (1/7)*G2

where the new pixel is between old pixels G1 and G2.

Splines can also be used to perform this transformation.  The spline method requires more computation, but will give better results.

An example of sub sampling is shown on the right where a 512 X 512 image of lena was reduces to 256 X 256.  (Note, all images are sized down to 200 X 200 for downloadability so they are not actually to scale.)


 

 

 

Super Sampling: 

Super sampling is the process of expanding the image.  We can easily double the dimensions of and image by inserting a pixel inbetween every 2 pixels.  We can determine the color of the inbetween pixel using Linear or Spline interpolation.  With linear interpolation we simply use the average of the surrounding pixels.  With Spline interpolation, we use the four pixels surrounding the pixel (in the vertical or horizontal directions) and perform a spline caluculation to determine the pixels value.  This is illustrated below

 X1     X2    NP   X3     X4

   .         .        .       .         .

NP is the new pixel.  We use these four surrounding values in the spline and take X2(1/2) to determine the value of the new pixel.  The two approaches are demonstrated with the images at the right.  The first image is the linear interpolation and the second uses splines.  As you can see, the splines method produces far better results.