Bilinear Interpolation - Algorithm

Algorithm

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

where ,

where

We proceed by interpolating in the y-direction.

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


\begin{align}
f(x,y) \approx & \, \frac{f(Q_{11})}{(x_2-x_1)(y_2-y_1)} (x_2-x)(y_2-y) \, + \\ & \, \frac{f(Q_{21})}{(x_2-x_1)(y_2-y_1)} (x-x_1)(y_2-y) \, + \\ & \, \frac{f(Q_{12})}{(x_2-x_1)(y_2-y_1)} (x_2-x)(y-y_1) \, + \\ & \, \frac{f(Q_{22})}{(x_2-x_1)(y_2-y_1)} (x-x_1)(y-y_1) \\ = & \, \frac{1}{(x_2-x_1)(y_2-y_1)} \Big( f(Q_{11})(x_2-x)(y_2-y) \, + \\ & \, \qquad \qquad \qquad \qquad \; \; f(Q_{21})(x-x_1)(y_2-y) \, + \\ & \, \qquad \qquad \qquad \qquad \; \; f(Q_{12})(x_2-x)(y-y_1) \, + \\ & \, \qquad \qquad \qquad \qquad \; \; f(Q_{22})(x-x_1)(y-y_1) \quad \Big).
\end{align}

Read more about this topic:  Bilinear Interpolation