Bilinear Interpolation

Bilinear interpolation considers the values of the four pixels closest to the center of each affine pixel in the affine sampling rectangle. The distance-weighted average of the values of the four pixels is computed and used for the value of the affine pixel.

The figure below shows how bilinear interpolation is computed.

Bilinear interpolation

The value of the interpolated affine pixel is computed using the following formula:

where

a, b, c, and d are the four distances shown in the figure above, normalized so that the distance between pixel centers is 1.

p1, p2, p3, and p4 are the values of the four pixels shown in the figure above.

The figure below shows how bilinear interpolation would produce the affine sampled image shown in Orthogonal and non-orthogonal affine sampling rectangles. The centers of the affine pixels are shown as grey crosses, and the four pixels used to compute each affine pixel are surrounded by a heavy border.

Computing a interpolated sample image

The computed interpolated pixel values are rounded to the nearest whole integer value.

Note: Depending on which platform you are using, the interpolation arithmetic might be done using scaled integer math or floating point math. In general, this has no effect on the resulting image.