Bilinear interpolation example
In a bilinear interpolation, first the position of each pixel in the output map is determined. Then the values of 4 surrounding pixels of the input map are used to calculate an interpolated value for each pixel in the output map.
Figure 1 below shows the position of a 'new' pixel in the output map, and the position and values of 4 surrounding pixels in the input map.
The value of the 'new' pixel in the output map is calculated by:
A straight line is drawn through each set of 2 points, and from this the value of the third point is known.
A bilinear interpolation should not be used when you intend to calculate a derivative of the output map (e.g. using a DFDX, DFDY filter).
See also: