Jump to content

Bilinear interpolation

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Als0605 (talk | contribs) at 19:49, 7 June 2008. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In mathematics, bilinear interpolation is an extension of linear interpolation for interpolating functions of two variables on a regular grid. The key idea is to perform linear interpolation first in one direction, and then in the other direction.

The four red dots show the data points and the green dot is the point at which we want to interpolate.
Example of bilinear interpolation on the unit square with the z-values 0, 1, 1 and 0.5 as indicated. Interpolated values in between represented by colour.

Suppose that we want to find the value of the unknown function f at the point P = (x, y). It is assumed that we know the value of f at the four points Q11 = (x1y1), Q12 = (x1y2), Q21 = (x2y1), and Q22 = (x2y2).

We first do linear interpolation in the x-direction. This yields

 

We proceed by interpolating in the y-direction.

This gives us the desired estimate of f(x, y).

If we choose a coordinate system in which the four points where f is known are (0, 0), (0, 1), (1, 0), and (1, 1), then the interpolation formula simplifies to

Or equivalently, in matrix operations:

Contrary to what the name suggests, the interpolant is not linear. Instead, it is of the form

so it is a product of two linear functions. Alternatively, the interpolant can be written as

where

In both cases, the number of constants (four) correspond to the number of data points where f is given. The interpolant is linear along lines parallel to either the or the direction, equivalently if or is set constant. Along any other straight line, the interpolant is quadratic.

The result of bilinear interpolation is independent of the order of interpolation. If we had first performed the linear interpolation in the y-direction and then in the x-direction, the resulting approximation would be the same.

The obvious extension of bilinear interpolation to three dimensions is called trilinear interpolation.

In Image Processing

In computer vision, bilinear interpolation is the one of the basic interpolatoin techniques.


It is "a texture mapping technique that produces a reasonably realistic image, also known as "bilinear filtering" and "bilinear texture mapping." An algorithm is used to map a screen pixel location to a corresponding point on the texture map. A weighted average of the attributes (color, alpha, etc.) of the four surrounding texels is computed and applied to the screen pixel. This process is repeated for each pixel forming the object being textured"Bilinear interpolation definition


When an image needs to be scaled-up, each pixel of the original image needs to be moved in certain direction based on scale constant. However, when scaling up an image, there are pixels (i.e. Hole) that are not assigned to appropriate pixel values. In this case, those holes should be assigned to appropriate image vlues so that the output image does not have non-value pixels.

Typically, bilinear interpolation can be used where perfect image transformation, matching and imaging is impossible so that it can calculates and assgin appropriate image vlues to pixels. Unlike, other interpolation techniques such as Nearest Neighbor Interpolation, Cubic interpolation In order to find appropritate image values for a specific pixel, Bilinear Interpolation, uses 4 nearest pixel values which are located in diagonal direction from that specific pixel.


In an image, we want to find the image value for pixel P(r, c) wheree 'r' represents row and 'c' is for column. Then, image value for this pixel can be represented as I(r1, c1).


File:Bilinear Interpolation.png
image value of X, A, B, C and D represent I, I1, I2, I3 and I4 in the above description respectively

In bilinear interpolation image values of 4 nearest points can be represented as followings, I1(r0, c0), I2(r0, c1), I3(r1, c0), I4(r1, c1)

in bilinear Interpolation, 4 pixels are weighted differenctly based on the disstance from pixel P(r,c) and the sum of those weighted value will the desired image value for specific pixel location.

This gives us the desired estimate image value I for the pixel P(r, c).



Where a and b are the horizontal and vertical distances from the pixel P(r, c) to P1(r0, c0). The equation clearly shows that pixels which are more close the P(r,c) gets more weight. Vertical and horizontal weighs are independent to each other. By putting more weight on close pixels, bilinear interpolation can produce smoother output image.


See also