Image Processing Reference

In-Depth Information

Four adjacent pixels of different values

Nearest neighbor interpolated

0%

0%

0%

21%

59%

59%

100%

100%

21%

59%

100%

Pixel color values

Pixel color values

Figure 34-7
Nearest neighbor.

In all of these cases, some form of interpolation is necessary. The spatial interpolation

must be processed separately from the temporal interpolation. A variety of different algo-

rithms have been developed to deal with spatial interpolations.

34.4.3

Nearest-Neighbor Interpolation

Taking into account the relative positions in the raster of each line, the nearest line to the

correct position is simply duplicated. Figure 34-7 shows how a 4-pixel-wide area is scaled

to a 7-pixel-wide area.

34.4.4

Linear Interpolation

This technique refines the nearest-neighbor approach. It calculates a proportional differ-

ence between two adjacent pixels and selects a value that is a blend of the two. This is not

a discrete computation just based on two pixels; it is a curve-fitting exercise based on the

rate of change of the pixel values. A line is fitted to the values on the input grid and

the output values are calculated proportionally according to the output grid positions.

Figure 34-8 shows the same group of 4 pixels scaled using a linear interpolator.

Four adjacent pixels of different values

Linear interpolated

7%

0%

0%

20%

40%

62%

86%

100%

21%

59%

100%

Pixel color values

Pixel color values

Figure 34-8
Linear interpolation.

Search WWH ::

Custom Search