1
$\begingroup$

Bilinear interpolation can be achieved by interpolating two values across the x axis, and then interpolating between the results across the y axis, like in the image below (from https://blog.demofox.org/2015/04/30/bilinear-filtering-bilinear-interpolation/)

enter image description here

A way to write this mathematically is like this:

$x,y,P_{xy} \in \mathbb{R}$

$x,y \in [0,1]$

$z = (P_{00}(1-x) + P_{10}x)(1-y) + (P_{01}(1-x)+P_{11}x)y$

Doing some algebra, you can get it into a polynomial form:

$z = (P_{00}-P_{10}-P_{01}+P_{11})xy + (P_{10}-P_{00})x + (P_{01}-P_{00})y + P_{00}$

I'm trying to find the (geometric?) intuition for this form of bilinear interpolation but the first term doesn't make much sense to me.

The second term makes some sense because it's saying "add in the difference across the x axis, multiplied by how far you are down the x axis". The third term is the same, but for the y axis.

The last term is just adding the value at the "starting coordinate" that everything else adds to, so that makes sense as well.

I can't figure out how that first term fits in though, or what exactly it's calculating. it is the only term that deals with the $P_{11}$ so it is obviously doesn't something meaningful, but I can't quite figure out what it is.

Can anyone explain bilinear interpolation from this point of view?

Note: $P_{00}$ is (0,0), $P_{01}$ is (0,1), $P_{10}$ is (1,0) and $P_{11}$ is (1,1).

$\endgroup$

2 Answers 2

2
$\begingroup$

If we look at the two terms with only x or only y they fully describe what happens when you go right or up from the starting point.

The xy-terms does not come into play at all.

When you want to go "into the square" or along the upper or the right edge then the xy-term comes into play. It cancels out the x/y-terms and introduce the P11-value that it should obtain in upper-right.

No full explanation here, just nudging along towards insight!

$\endgroup$
1
$\begingroup$

An answer was provided to me via twitter by two people independently.

  1. https://twitter.com/nothings/status/987797966789341184
  2. https://twitter.com/DarrenMoo/status/987796950274764802

The intuition is that without the xy term, that equation describes a plane defined by the 3 points involved (all points except $P_{11}$).

The xy term is there to correct it to be a bilinear surface, which is defined additionally by the point $P_{11}$.

$\endgroup$
2
  • $\begingroup$ See also: reedbeta.com/blog/quadrilateral-interpolation-part-2/#inversion 🙂 The last term can be thought of as the delta of P11 from where it would be if the equation were planar. $\endgroup$ Apr 21, 2018 at 23:27
  • $\begingroup$ I believe I've seen it named "twist" or "twist vector" in some articles, if that's any help. It is indeed what allows curvature in what would otherwise be a parallelogram. $\endgroup$
    – Olivier
    Apr 22, 2018 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.