Image Processing Toolbox User's Guide

Interpolation

Interpolation is the process used to estimate an image value at a location in between image pixels. For example, if you resize an image so it contains more pixels than it did originally, the toolbox uses interpolation to determine the values for the additional pixels. The `imresize` and `imrotate` geometric functions use two-dimensional interpolation as part of the operations they perform. The `improfile` image analysis function also uses interpolation. See Getting the Intensity Profile of an Image for information about this function.

Interpolation Methods

The Image Processing Toolbox provides three interpolation methods:

• Nearest-neighbor interpolation
• Bilinear interpolation
• Bicubic interpolation

The interpolation methods all work in a fundamentally similar way. In each case, to determine the value for an interpolated pixel, they find the point in the input image that the output pixel corresponds to. They then assign a value to the output pixel by computing a weighted average of some set of pixels in the vicinity of the point. The weightings are based on the distance each pixel is from the point.

The methods differ in the set of pixels that are considered:

• For nearest-neighbor interpolation, the output pixel is assigned the value of the pixel that the point falls within. No other pixels are considered.
• For bilinear interpolation, the output pixel value is a weighted average of pixels in the nearest 2-by-2 neighborhood.
• For bicubic interpolation, the output pixel value is a weighted average of pixels in the nearest 4-by-4 neighborhood.

The number of pixels considered affects the complexity of the computation. Therefore the bilinear method takes longer than nearest-neighbor interpolation, and the bicubic method takes longer than bilinear. However, the greater the number of pixels considered, the more accurate the effect is, so there is a tradeoff between processing time and quality.

Interpolation and Image Types

You can use all three types of interpolation with grayscale, truecolor, or binary images; however, bilinear or bicubic are recommended. Nearest-neighbor is the only type of interpolation that can be used with indexed images.

 Spatial Transformations Resizing an Image