Omni Calculator logo

Bilinear Interpolation Calculator

Created by Anna Szczepanek, PhD
Reviewed by Dominik Czernia, PhD and Jack Bowater
Last updated: Jun 02, 2023


Welcome to Omni's bilinear interpolation calculator! Are you a bilinear interpolation professional? Or rather wondering what bilinear interpolation is all about? Here you can find a brief overview of the bilinear interpolation method as well as a detailed explanation and derivation of the formula for bilinear interpolation.

As a bonus, we provided an example of how to perform bilinear interpolation by hand.

What is a bilinear interpolation?

Bilinear interpolation is a popular method for two-dimensional interpolation on a rectangle. That is, we assume that we know the values of some unknown function at four points that form a rectangle. Let these points equal (x₁, y₁), (x₁, yβ‚‚), (xβ‚‚, y₁) and (xβ‚‚, yβ‚‚) and the values of the function are the following:

  • The value at (x₁, y₁) is Q₁₁;
  • The value at (x₁, yβ‚‚) is Q₂₁;
  • The value at (xβ‚‚, y₁) is Q₁₂; and
  • The value at (xβ‚‚, yβ‚‚) is Qβ‚‚β‚‚.

Using bilinear interpolation, we can estimate this function's value at any point (x, y) inside this rectangle. We will denote this unknown value by P.

Bilinear interpolation formula derivation step 1

This interpolation scheme is widespread and has many applications, in particular in computer vision and image processing. It is based on a much simpler and widely taught procedure of linear interpolation, which you can discover with the help of Omni's linear interpolation calculator. For details, see the sections below.

It's worth knowing that the data required for bilinear interpolation is often collected in the form of the following table. Compare it to the plot above to see how smart the design of this table is!

Bilinear interpolation table

How to use this bilinear interpolation calculator?

Using this calculator is straightforward:

  1. Enter the data:

    • x₁, y₁, xβ‚‚, yβ‚‚ for the coordinates of the base points of interpolation;

    • Q₁₁, Q₁₂, Q₂₁, Qβ‚‚β‚‚ for the values at these points; and

    • x, y for the point at which we want to interpolate the unknown function by means of bilinear interpolation

  2. That's it! Our bilinear interpolation calculator returns the result, i.e., the value of P at (x, y). A piece of cake, isn't it? 🍰

Bilinear interpolation formula

The general idea of the bilinear interpolation method is the following:

  • Start by performing two linear interpolations in the x-direction (horizontal): first at (x, y₁), then at (x, yβ‚‚).
  • Next, perform linear interpolation in the y-direction (vertical): use the interpolated values at (x, y₁) and (x, yβ‚‚) to obtain the interpolation at the final point (x, y).

Let's have a look at the details.

  1. We find the linear interpolation of function f at (x, y₁) using the values of f at (x₁, y₁) and (xβ‚‚, y₁) which are Q₁₁ and Q₂₁ respectively:
Bilinear interpolation formula derivation step 1
  1. We find the linear interpolation of f at (x, yβ‚‚) using the values of f at (x₁, yβ‚‚) and (xβ‚‚, yβ‚‚) which are Q₁₂ and Qβ‚‚β‚‚ respectively:
Bilinear interpolation formula derivation step 1
  1. Finally, we find the linear interpolation at (x, y) using the interpolated values of f at (x, y₁) and (x, yβ‚‚):
Bilinear interpolation formula derivation step 2

All that's left to do is to rewrite the above expression for P to get rid of the intermediate values R₁ and Rβ‚‚.

  • Substituting the expressions for R₁ and Rβ‚‚ from Steps 1 & 2, we get the following formula for P:
Bilinear interpolation final formula
  • Using vectors and matrices, we can rewrite the above bilinear interpolation formula for P into the following form:
Bilinear interpolation formula matrix form

Tip: You may want to use to our matrix multiplication calculator while using the matrix form of the bilinear interpolation formula.

Bilinear interpolation example

That was lots of theory, wasn't it? If you feel a bit overwhelmed, don't worry! In this section, we'll solve an example to show you how to use the bilinear interpolation formula in practice.

Assume that an unknown function has:

  • Value 12 at (0, 1);
  • Value -4 at (0, 3);
  • Value 0 at (4, 1); and
  • Value 8 at (4, 3).

We want to estimate the value of this function at (1, 2).

  1. Let's begin by writing down some data.

    • For the rectangle corners, we have:

      x₁ = 0, xβ‚‚ = 4, y₁ = 1, and yβ‚‚ = 3

    • The respective function values are:

      Q₁₁ = 12, Q₂₁ = -4, Q₁₂ = 0, and Qβ‚‚β‚‚ = 8

    • The point at which we perform the bilinear interpolation is:

      x = 1, y = 2

  2. Let's calculate the terms that appear in the bilinear interpolation formula for P:

    • (xβ‚‚ - x₁) Γ— (yβ‚‚ - y₁) = (4 - 0) Γ— (3 - 1) = 8

    • (xβ‚‚ - x) Γ— (yβ‚‚ - y) = (4 - 1) Γ— (3 - 2) = 3

    • (x - x₁) Γ— (yβ‚‚ - y) = (1 - 0) Γ— (3 - 2) = 1

    • (xβ‚‚ - x) Γ— (y - y₁) = (4 - 1) Γ— (2 - 1) = 3

    • (x - x₁) Γ— (y - y₁) = (1 - 0) Γ— (2 - 1) = 1

  3. Let's put those values together into the formula for P. We obtain:

    P = 3/8 Γ— Q₁₁ + 1/8 Γ— Q₂₁ + 3/8 Γ— Q₁₂ + 1/8 Γ— Qβ‚‚β‚‚

  4. It's time to substitute the values Q₁₁, Q₂₁, Q₁₂, and Qβ‚‚β‚‚:

    P = 3/8 Γ— 12 + 1/8 Γ— (-4) + 3/8 Γ— 0 + 1/8 Γ— 8

  5. Finally, we have:

    P = 9/2 - 1/2 + 1 = 5

Properties of bilinear interpolation

Let's look once again at the final formula for P and point out some of its properties:

Bilinear interpolation final formula

From this formula we see that:

  1. Bilinear interpolation is

    • Linear with respect to the values Q₁₁, Q₁₂, Q₂₁, and Qβ‚‚β‚‚ of the unknown function at the corners of the rectangle;

    • Linear along every horizontal line (where x changes and y is constant) and along every vertical line (where x is constant and y changes); but

    • Quadratic with respect to the location of the interpolation point, i.e., as a function of both x and y.

  2. Bilinear interpolation is the weighted average of the values Q₁₁, Q₁₂, Q₂₁, and Qβ‚‚β‚‚ at the four corners of the rectangle, and the weights are determined by the distance between the corners and the point (x, y). The closer a corner is to (x, y), the more weight that corner gets. See the weighted average calculator to learn more.

Anna Szczepanek, PhD
Bilinear interpolation formula derivation step 1
Corner points coordinates
x₁
y₁
xβ‚‚
yβ‚‚
Corner points values
Q₁₁
Q₂₁
Q₁₂
Qβ‚‚β‚‚
Interpolated point
x
y
P
Check out 45 similar coordinate geometry calculators πŸ“ˆ
Average rate of changeCatenary curveCoordinate grid… 42 more
People also viewed…

Books vs e-Books

The books vs. e-books calculator answers the question: how ecological is your e-book reader? πŸ“š

Double angle identities

Use our double angle identities calculator to learn how to find the sine, cosine, and tangent of twice the value of a starting angle.

Length and width of rectangle given area

If you already know the area of a rectangle but miss the width or length, this calculator is the right tool for you.

Sunbathing

Do you always remember to put on sunscreen before going outside? Are you sure that you use enough? The Sunbathing Calculator β˜€ will tell you when's the time to go back under an umbrella not to suffer from a sunburn!
Copyright by Omni Calculator sp. z o.o.
Privacy, Cookies & Terms of Service