The easiest way to understand bilinear interpolation is to understand linear interpolation in 1D.
This first number should give you memories of high school math. Given some location a in which we want to know f (a) , we take the neighboring βknownβ values ββand set a line between them.
So, we used the old high school equations y = mx + b and y-y1 = m (x-x1). Nothing unusual.
We basically transfer this concept to two-dimensional in order to obtain bilinear interpolation. We can attack the problem of finding f (a, b) for any a, b by doing three interpolations. Carefully read the following figure. Do not be alarmed by all the shortcuts. This is actually quite simple.
For bilinear interpolation, we again use neighboring points. Now there are four of them, since we are in 2D. The trick is to attack the problem one dimension at a time.
We project our (a, b) to the sides and first calculate two (one-dimensional!) Interpolating lines.
- f (a, y j ) , where y j is kept constant
- f (a, y j + 1 ) , where y j + 1 is kept constant.
Now there is only one last step. You take two points calculated by you, f (a, y j ) and f (a, y j + 1 ) , and set a line between them. The fact that blue goes from left to right in the diagram goes through f (a, b) . Interpolation on this last line gives the final answer.
I will leave the math for the 2-D case for you. It is not difficult if you are working with a chart. And after going through this, you yourself can find out what is happening.
One small note, no matter which side you choose for the first two interpolations. You could select the top and bottom, and then make a third interpolation line between the two. The answer would be the same.
nsanders
source share