Bilinear interpolation
|
In mathematics, bilinear interpolation is an extension of linear interpolation for interpolating functions of two variables. The key idea is to perform linear interpolation first in one direction, and then in the other direction.
Bilinear_interpolation.png
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 = (x1, y1), Q12 = (x1, y2), Q21 = (x2, y1), and Q22 = (x2,y2).
We first do linear interpolation in the x-direction. This yields
- <math> f(R_1) \approx \frac{x_*-x_2}{x_1-x_2} f(Q_{11}) + \frac{x_*-x_1}{x_2-x_1} f(Q_{21}) \quad\mbox{where}\quad R_1 = (x_*,y_1), <math>
- <math> f(R_2) \approx \frac{x_*-x_2}{x_1-x_2} f(Q_{12}) + \frac{x_*-x_1}{x_2-x_1} f(Q_{22}) \quad\mbox{where}\quad R_2 = (x_*,y_2). <math>
We proceed by interpolate in the y-direction. This gives us the desired estimate of f(P).
- <math> f(P) \approx \frac{y_*-y_2}{y_1-y_2} f(R_1) + \frac{y_*-y_1}{y_2-y_1} f(R_2). <math>
Note that 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 interpolant is not linear, but a product of two linear functions in x and y respectively. So it is of the form (a1x + a2)(a3y + a4). The four constants ak correspond to the four data points Qij.
The obvious extension of bilinear interpolation to three dimensions is called trilinear interpolation.