Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Bilinear interpolation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Inverse and generalization == In general, the interpolant will assume any value (in the [[convex hull]] of the vertex values) at an infinite number of points (forming branches of [[hyperbola]]s<ref>{{Cite journal|last=Monasse|first=Pascal|date=2019-08-10|title=Extraction of the Level Lines of a Bilinear Image|url=https://www.ipol.im/pub/art/2019/269/|journal=Image Processing on Line|language=en|volume=9|pages=205β219|doi=10.5201/ipol.2019.269|issn=2105-1232|doi-access=free}}</ref>), so the interpolation is not invertible. However, when bilinear interpolation is applied to two functions simultaneously, such as when interpolating a [[vector field]], then the interpolation is invertible (under certain conditions). In particular, this inverse can be used to find the "unit square coordinates" of a point inside any [[Convex polygon|convex]] [[quadrilateral]] (by considering the coordinates of the quadrilateral as a vector field which is bilinearly interpolated on the unit square). Using this procedure bilinear interpolation can be extended to any convex quadrilateral, though the computation is significantly more complicated if it is not a parallelogram.<ref>{{Cite web|last=Quilez|first=Inigo|date=2010|title=Inverse bilinear interpolation|url=https://iquilezles.org/articles/ibilinear|url-status=live|access-date=2024-02-17|website=iquilezles.org|archive-url=https://web.archive.org/web/20100813104121/http://iquilezles.org:80/www/articles/ibilinear/ibilinear.htm |archive-date=2010-08-13 }}</ref> The resulting map between quadrilaterals is known as a ''bilinear transformation'', ''bilinear warp'' or ''bilinear distortion''. Alternatively, a [[projective map]]ping between a quadrilateral and the unit square may be used, but the resulting interpolant will not be bilinear. In the special case when the quadrilateral is a [[parallelogram]], a linear mapping to the unit square exists and the generalization follows easily. The obvious extension of bilinear interpolation to three dimensions is called [[trilinear interpolation]]. {{Collapse top|Inverse computation}} Let <math display="inline">F</math> be a vector field that is bilinearly interpolated on the unit square parameterized by <math display="inline">\mu, \lambda \in [0,1]</math>. Inverting the interpolation requires solving a system of two bilinear polynomial equations:<math display="block">A + B\lambda + C\mu + D\lambda\mu = 0</math>where <math display="block">\begin{align} A &= F_{00} - F \\ B &= F_{10} - F_{00} \\ C &= F_{01} - F_{00} \\ D &= F_{11} - F_{01} - F_{10} + F_{00} \end{align}</math>Taking a 2-d cross product (see [[Grassman product]]) of the system with a carefully chosen vectors allows us to eliminate terms:<math display="block">\begin{align} (A + B\lambda + C\mu) &\times D &= 0 \\ (A + B\lambda) &\times (C + D\lambda) &= 0 \\ (A + C\mu) &\times (B + D\mu) &= 0 \\ \end{align}</math>which expands to<math display="block">\begin{align} c + e\lambda + f\mu &= 0 \\ b + (c + d)\lambda + e\lambda^2&= 0 \\ a + (c - d)\mu + f\mu^2&= 0 \\ \end{align}</math>where<math display="block">\begin{align} a &= A \times B \\ b &= A \times C \qquad d = B \times C \\ c &= A \times D \qquad e = B \times D \qquad f = C \times D \end{align}</math>The quadratic equations can be solved using the [[quadratic formula]]. We have the equivalent determinants <math display="block">\mathbb{D} = (c + d)^2 -4eb = (c - d)^2 - 4fa</math>and the solutions<math display="block">\lambda = \frac{-c -d \pm\sqrt{\mathbb{D}}}{2e} \qquad \mu = \frac{-c +d \mp\sqrt{\mathbb{D}}}{2f}</math>(opposite signs are enforced by the linear relation). The cases when <math>e=0</math> or <math>f=0</math> must be handled separately. Given the right conditions, one of the two solutions should be in the unit square. {{Collapse bottom}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)