[Go] linear interpolation & bilinear interpolation & Tri-linear interpolation

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/yingying0907/archive/2012/11/21/2780092.html

Interpolation is the process or method of finding unknown data through known discrete data in mathematical field numerical analysis.

According to some discrete data, a continuous function (i.e. curve) or a more dense discrete equation coincides with the known data. This process is called fitting. Interpolation is the curve that must be fitted through a known point.

1. Linear interpolation

The known coordinates (x0, y0) and (x1, y1) are the values of the [x0, X1] interval where x is on a straight line.

Because the x value is known, you can get the value of Y from the formula

The procedure known as Y for X is the same as above, except that X and Y are exchanged.

For example

Original sequence of values: 0,10,20,30,40
Linear interpolation once is: 0,5,10,15,20,25,30,35,40
That is to say that the change (increase or decrease) is linear, you can draw a line on the coordinate chart.

Linear interpolation is often used to supplement the interval sections in a table.

The application of linear interpolation between two values in computer graphics is so common that people call it lerp in the field of computer graphics. Linear interpolation operations are integrated in all of today's computer graphics processors and are often used to make more complex operations: for example, you can perform a bilinear interpolation operation with three-step linear interpolation. Because of the low cost of this operation, it is a good way to achieve an accurate and fast lookup table for smooth functions that do not have a sufficient number of entries.

In some high-demand situations, linear interpolation often fails to meet the requirements. In this case, polynomial interpolation or spline interpolation can be used instead.

Linear interpolation can be extended to bilinear interpolation of functions with two variables. Bilinear interpolation is often used as a coarse antialiasing filter, and the three-wire interpolation is used for interpolation of functions of three variables. Other extended situations of linear interpolation can be used for other types of mesh operations such as triangles and tetrahedral.

2. bilinear interpolation

In geophysics, bilinear interpolation (Bilinear interpolation)is often used. For example, the velocity field or the same earthquake displacement field on the surface uniform grid is simulated. Compare with the observation of the GPS observation point and the displacement field of the earthquake. You must interpolate the value of the uniform grid point to the GPS station. This requires bilinear interpolation.

bilinear interpolation .

In mathematics, bilinear interpolation are an extension of linear interpolation for interpolating fun Ctions of variables(e.g, x andy) on a regular grid. The interpolated function should not use the term of x2 or y2, but xy, which is the BI Linear form of x and y.

The core idea is to perform a linear interpolation in two directions respectively .

Thekey idea was to perform linear interpolation first in one direction, and then again in the other direction. Although each step was linear in the sampled values and in the position, the interpolation as a whole was not linear but rat Her quadratic at the sample location (details below).

Red data points and the green points to be inserted

If we want the value of the unknown function f at point P = (x, y), suppose we know that the function f is in Q11 = (x1, y1), Q12 = (x1, y2), Q21 = (x2, y1), and Q22 = (x2, y2) The value of four points.

First, linear interpolation in the x direction is performed to obtain

And then linear interpolation in the Y direction to get

This gives you the desired result f (x, y),

If you select a coordinate system so that the four known point coordinates of F are (0, 0), (0, 1), (1, 0), and (1, 1), then the interpolation formula can be reduced to

Or it is represented by a matrix operation as

Unlike this interpolation method name, this interpolation method is not linear, and it is in the form of

It is the product of two linear functions. See, bilinear interpolation is not linear.

Contrary to what the name suggests, the bilinear interpolant are not linear

In addition, interpolation can also be expressed as

For unit squares,

In both cases, the number of constants corresponds to the number of data points for a given F.

the results of linear interpolation are independent of the order of interpolation. First, the Y-direction interpolation, and then the X-direction interpolation, the result is the same.

An obvious three-dimensional spatial extension of bilinear interpolation is three linear interpolation .

3. Three linear interpolation

Three linear interpolation is a method for linear interpolation on tensor product meshes of three-dimensional discrete sampled data. This tensor product grid may have any non-overlapping mesh points on each dimension, but it is not a triangulated finite element analysis mesh. This method calculates the value of the point (x, Y, z) linearly on the local rectangular prism by the data points on the grid.

    • Three linear interpolation is performed in the parametric space of a n=1 three-dimensional d=3 (bilinear interpolation: d=2, linear interpolation: d=1), which requires (1 + n)D = 8 data points adjacent to the desired interpolation point.
    • Three linear interpolation is equivalent to the first order B-spline interpolation of three-dimensional tensor.
    • The three-linear interpolation operation is the tensor product of three linear interpolation operations.

  Instance

On a periodic cubic grid with a step distance of 1, take xD,yd,Zd as the point to be computed, and the difference between the maximum integers less than x, Y, z, i.e.,

  

  

  

First, along the z-axis interpolation, get:

  

  

  

  

Then, along the y-axis interpolation, get:

  w1 = i1 (1− yd) + i2yd

  W2 = J1 (1− yd) + J2yd

Finally, along the x-axis interpolation, we get:

  I V = w1 (1− xD) + W2xD
This gives you the predicted value for that point.

The results of the tri-linear interpolation are not related to the order in which the interpolation is computed, that is, interpolation in the order of another dimension, such as interpolation along X, Y, and Z, will result in the same results. This is also consistent with tensor product exchange laws.

Reference links: linear interpolation, bilinear interpolation, three-line interpolation

[Go] linear interpolation & bilinear interpolation & Tri-linear interpolation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.