If 'bilinear' is selected, the gray values are determined using bilinear interpolation. In contrast to nearest neighbor interpolation, in bilinear interpolation the gray value is determined from the four surrounding neighboring pixels, as depicted in figure 2.2.
The influence of a neighboring pixel depends on the distance between its center and the center of the resulting pixel. Therefore, first the horizontal and vertical distances of the transformed coordinates to the adjacent pixel centers are determined. Then, the resulting gray value is computed as follows:
hres = b · ( a · h11 + (1 − a) · h01 ) + (1 − b) · ( a · h10 + (1 − a) · h00 )
with hres denoting the gray value of the resulting pixel and hij denoting the gray values of the neighboring pixels. Because in this case, the resulting gray value is influenced by the gray values of all four neighboring pixels, bilinear interpolation produces smoother images than nearest neighbor interpolation. However, it also requires longer computation times.
Note that bilinear interpolation may lead to unexpected results due to aliasing if the image is downscaled. To reduce these undesired effects, an interpolation method with integrated smoothing (see section “Bilinear Interpolation with Integrated Smoothing”) should be used if a high quality of downscaled images is required.