TCS - Interpolation

Interpolation

by Tom Zinneman
CC Personal Computer Users Group
From the May 2003 issue of the I/O Port Newsletter

Whenever we work with digital images, interpolation comes into play. If you scan an image at a different resolution than the scanner's native resolution, the data is automatically interpolated by the scanner's software to match your requirements. Likewise, the image sensor in a digital camera has a fixed resolution. If you choose to save your images at a different resolution, the camera software will use interpolation to save the data at the specified resolution. All printers have a fixed native resolution. If the resolution of the image to be printed is different, the printer's driver software uses interpolation to change the image's resolution to match that required by the printer. Image editing programs use interpolation when rotating, resampling or resizing images. Only in the image editing programs does a user have some control over the type of interpolation being used.

Exactly what do we mean by the word interpolate. One of the definitions in Webster's dictionary is "to estimate values of (a function) between two known values." When applied to a digital image, the process of interpolation is the computation of points or values between ones that are known or tabulated using the surrounding points or values.

There are a variety of interpolation techniques that may be used for such functions as enlarging or reducing the size of an image. For example, Adobe's Photoshop program allows the user to choose from one of three techniques: nearest neighbor, bilinear, and bicubic. PaintShopPro also offers three techniques: pixel resize, bilinear, and bicubic,

Let's examine each of these techniques and discuss their advantages or shortcomings. The nearest neighbor and pixel resize methods are essentially the same. Neither use interpolation algorithms. The value of the new pixel is made the same as that of the closest existing pixel. When enlarging an image, these techniques duplicate pixels; when reducing the size of an image, they delete pixels. These methods are quite a bit faster than the bilinear or bicubic methods, but they are also the least precise. When enlarging images, edges are more noticeably jagged. Downsizing produces a coarse, grainy effect. These methods work best when enlarging or reducing by an even number.

Bilinear resampling is an interpolation method that uses the values from the four surrounding pixels, that is, above, below, right, and left of the spot where the new pixel is to be created. The new pixel value is determined by calculating a weighted average of the four closest pixels (a 2x2 array) based on distance. This method tends to make an image softer, that is, the contrast is reduced because of averaging neighboring values together. However, the stair-step effect apparent in the nearest neighbor approach is reduced and the image looks smoother. This interpolation method appears to work better for image reduction, rather than image enlargement.

Bicubic interpolation determines the values of new pixels by calculating the weighted average of the closest 16 pixels (a 4x4 array) based on distance. Usually, a cubic b-spline algorithm is used. This method also produces a much smoother image then the nearest neighbor technique. As with bilinear resampling, bicubic interpolation tends to make an image softer. So it is a good idea to apply some sharpening to the image to reduce the softness. Some bicubic algorithms include an extra parameter that you can use to sharpen image quality during the interpolation process. Although this method requires more computational time, it is considered the default image-enlargement technique in just about every image manipulation program.

Just how much can you enlarge an image without sacrificing quality? Using the bicubic interpolation technique, experience has shown that 120 - 150 percent enlargement appears reasonable, depending on the eye of the beholder. However, even greater enlargement is possible if the enlargement is done using multiple small steps, say 5 to 10 percent at a time, rather than one large step.

There are more sophisticated interpolation techniques becoming available. One of these, the Lanczos interpolation method, is considered to be more accurate and sharper than the spline interpolation method used in most image editing programs. When upsizing, this method uses a 4x4, 6x6, or 8x8 cell of pixels surrounding each new pixel location. The 4x4 method method is nearly identical to bicubic interpolation with no sharpening. Using 6x6 or 8x8 cells produces slightly more accurate results than the bicubic method, but takes a little longer to compute. An excellent and also free image viewing program, IrfanView (see www.irfanview.com) uses the Lanczos method when interpolation is required. An excellent printing program called Qimage Pro (see www.ddisoftware.com/qimage) also uses Lanczos interpolation to enlarge images for printing.

Another software program that can be used to enlarge images is called S-Spline 2. The program is produced by a Netherlands-based company called Shortcut Software (www.s-spline.com). The software applies B-Spline interpolation on the smoother areas within an image. For sharper areas, it uses proprietary interpolation techniques. Using this program, it is possible to produce a decent 8 x 10 print using a 1-megapixel image.

For Photoshop users, a plug-in called Genuine Fractals (see www.altamira-group.com) is available. This program does not resample images directly. You can save your images using their proprietary compression algorithms in a special file format. When you open the compressed file, you have the option of resizing the image, which, in effect, provides a fractal resampling feature.

Photographer Fred Miranda (see www.fredmiranda.com) has developed an action for Photoshop that he calls Stair Interpolation. This action, which uses Photoshop's bicubic interpolation algorithm, generates a series of small multiple steps to achieve enlargements of 1.5, 2.0, 3.0 and 4.0 times the original size. He has performed a comparison of this technique with the Genuine Fractals, Lanczos, and the S-Spline techniques and provides examples of each. This comparison can be found under the menu heading Actions; scroll down to the section called Free Photoshop actions and select Stair Interpolation.

Although the best way to generate high quality enlarged prints is to use original images with high resolution, advanced interpolation techniques are providing an acceptable alternative. It is now possible to generate 8x10, 11x14, or even larger prints using images having a resolution of one or two megapixels.

T. Zinneman is a CCPCUG member. If you have any questions or comments, please send them to tzinneman@home.com.



For more information on the Tulsa Computer Society click here




Tulsa Computer Society 5/02/2003
Don Singleton, President