Top Qs
Timeline
Chat
Perspective

Bicubic interpolation

Extension of cubic spline interpolation From Wikipedia, the free encyclopedia

Bicubic interpolation
Remove ads

In mathematics, bicubic interpolation is an extension of cubic spline interpolation (a method of applying cubic interpolation to a data set) for interpolating data points on a two-dimensional regular grid. The interpolated surface (meaning the kernel shape, not the image) is smoother than corresponding surfaces obtained by bilinear interpolation or nearest-neighbor interpolation. Bicubic interpolation can be accomplished using either Lagrange polynomials, cubic splines, or cubic convolution algorithm.

Thumb
Comparison of Bicubic interpolation with some 1- and 2-dimensional interpolations.
Black and red/yellow/green/blue dots correspond to the interpolated point and neighbouring samples, respectively.
Their heights above the ground correspond to their values.

In image processing, bicubic interpolation is often chosen over bilinear or nearest-neighbor interpolation in image resampling, when speed is not an issue. In contrast to bilinear interpolation, which only takes 4 pixels (2×2) into account, bicubic interpolation considers 16 pixels (4×4). Images resampled with bicubic interpolation can have different interpolation artifacts, depending on the b and c values chosen.

Remove ads

Computation

Thumb
Bicubic interpolation on the square consisting of 25 unit squares patched together. Bicubic interpolation as per Matplotlib's implementation. Colour indicates function value. The black dots are the locations of the prescribed data being interpolated. Note how the color samples are not radially symmetric.
Thumb
Bilinear interpolation on the same dataset as above. Derivatives of the surface are not continuous over the square boundaries.
Thumb
Nearest-neighbor interpolation on the same dataset as above.

Suppose the function values and the derivatives , and are known at the four corners , , , and of the unit square. The interpolated surface can then be written as

The interpolation problem consists of determining the 16 coefficients . Matching with the function values yields four equations:

Likewise, eight equations for the derivatives in the and the directions:

And four equations for the mixed partial derivative:

The expressions above have used the following identities:

This procedure yields a surface on the unit square that is continuous and has continuous derivatives. Bicubic interpolation on an arbitrarily sized regular grid can then be accomplished by patching together such bicubic surfaces, ensuring that the derivatives match on the boundaries.

Grouping the unknown parameters in a vector and letting the above system of equations can be reformulated into a matrix for the linear equation .

Inverting the matrix gives the more useful linear equation , where which allows to be calculated quickly and easily.

There can be another concise matrix form for 16 coefficients: or where

Remove ads

Extension to rectilinear grids

Often, applications call for bicubic interpolation using data on a rectilinear grid, rather than the unit square. In this case, the identities for and become where is the spacing of the cell containing the point and similar for . In this case, the most practical approach to computing the coefficients is to let then to solve with as before. Next, the normalized interpolating variables are computed as where and are the and coordinates of the grid points surrounding the point . Then, the interpolating surface becomes

Remove ads

Finding derivatives from function values

Summarize
Perspective

If the derivatives are unknown, they are typically approximated from the function values at points neighbouring the corners of the unit square, e.g. using finite differences.

To find either of the single derivatives, or , using that method, find the slope between the two surrounding points in the appropriate axis. For example, to calculate for one of the points, find for the points to the left and right of the target point and calculate their slope, and similarly for .

To find the cross derivative , take the derivative in both axes, one at a time. For example, one can first use the procedure to find the derivatives of the points above and below the target point, then use the procedure on those values (rather than, as usual, the values of for those points) to obtain the value of for the target point. (Or one can do it in the opposite direction, first calculating and then from those. The two give equivalent results.)

At the edges of the dataset, when one is missing some of the surrounding points, the missing points can be approximated by a number of methods. A simple and common method is to assume that the slope from the existing point to the target point continues without further change, and using this to calculate a hypothetical value for the missing point.

Remove ads

Bicubic convolution algorithm

Summarize
Perspective
Thumb
Convolution kernel
Thumb
Convolution kernel (expanded in 2D)

Bicubic spline interpolation requires the solution of the linear system described above for each grid cell. An interpolator with similar properties can be obtained by applying a convolution with the following kernel in both dimensions: where is usually set to −0.5 or −0.75. Note that and for all nonzero integers .

This approach was proposed by Rifman of TRW Systems Group, targeting image data from ERTS (Earth Resources Technology Satellite, later Landsat 1). [1] [2] [3] Initially, was fixed at -1, but later it was parameterized by Simon of the same company, making -0.5, -0.75, and -1.0 meaningful values. [4] However, these proposals did not sufficiently present the derivation process or formulas, so Keys later re-proposed it in a complete form, demonstrating that with , cubic convergence is achieved regarding the sampling interval of the original function. [5]

The convolution kernel is derived as follows[6]:

With the conditions: , , also for first derivative: , , we get;

Solving the above simultaneous equations gives us; and the above equation.

Matrix notation

Thumb
Convolution kernel shifted into 0 to 1 for matrix notation

If we use the matrix notation, we can express the equation in a more friendly manner: for between 0 and 1 for one dimension. Note that for 1-dimensional cubic convolution interpolation 4 sample points are required. For each inquiry two samples are located on its left and two samples on the right. These points are indexed from −1 to 2 in this text. The distance from the point indexed with 0 to the inquiry point is denoted by here.

Since , it coincides with the Catmull-Rom spline. Therefore, bicubic interpolation with set to is sometimes called "Catmull-Rom interpolation".[7]

For two dimensions first applied once in and again in :

Differential Continuity

It is continuous in the first derivative by definition, and can be easily verified using the following matrix notation.

Hence, it is continuous in the first derivative.

Hence, it is not continuous in the second derivative.

Comparison with other methods

Below is a comparison of the kernel functions for each method:

More information Method, Kernel Function ...
Remove ads

Use in computer graphics

Summarize
Perspective

The bicubic algorithm is frequently used for scaling images and video for display (see bitmap resampling). It preserves fine detail better than the common bilinear algorithm.

Bicubic algorithm is also used for image downscaling, but because resampling during downscaling differs from the effect of zooming out in real optics, other methods may be more suitable.

Effect of parameter "a"

Thumb
The lower half of this figure is a magnification of the upper half, showing how the apparent sharpness of the left-hand line is created. Bicubic interpolation causes overshoot, which increases acutance.

However, due to the negative lobes on the kernel, it causes overshoot (haloing). This can cause clipping, and is an artifact (see also ringing artifacts), but it increases acutance (apparent sharpness), and can be desirable. This effect is larger when the parameter is or than when it is . Thumb

When , the interpolation result matches the Taylor approximation up to the second derivative (excluding the remainder term) of the original image (the continuous function before sampling).[8][9] A clear example of this effect is when the original image is a linear function (a simple gradient image), and the interpolated result is a linear function only when . For example, if the input is the interpolated result is and it is a linear function (quadratic and cubic terms are 0) only when .[10]

More information , ...

Below are a simple gradient image enlarged 16x, and a portion of the standard test image "cameraman"[11] enlarged 8x. The vertical stripes in the former and the artificial mottled pattern around the temples in the latter are artifacts caused by the above-mentioned effect.

More information , ...

Note that when , the second derivative of the convolution kernel is continuous at [10], but the interpolation result does not have a continuous second derivative. Also, when , the derivative of the convolution kernel matches the derivative of the sinc function at [10], but this has no significance other than for comparison with sinc interpolation.

Below is an example of a setting for in a commonly used implementations.

More information , ...

Resampling Position

When enlarging an image by an integer multiple, it is common to set the resampling position between the input image pixels so that the center of gravity of the enlarged image does not shift relative to the input image (see the left image below).
On the other hand, there is also a method of setting the resampling position to overlap the input image pixels (see the right image below). This method ensures the reversibility of the transformation.

Thumb
Example of resample position

Extrapolation

Two pixels of the input image are required on the left and right (or top and bottom) for interpolation. Since the outer edges of the image are invalid, extrapolation is required. The extrapolation method varies depending on the implementation.
The following is an example of copying and extrapolating the outermost pixels.

Thumb
Example of extrapolation by copying the outermost pixel values
Remove ads

See also

References

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads