Bicubic interpolation

Extension of cubic spline interpolation

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 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.

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.

## Computation

[edit]

Bicubic interpolation on the square  [ 0 , 4 ] × [ 0 , 4 ] {\displaystyle [0,4]\times [0,4]} 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. Bilinear interpolation on the same dataset as above. Derivatives of the surface are not continuous over the square boundaries. Nearest-neighbor interpolation on the same dataset as above.

Suppose the function values  f {\displaystyle f} and the derivatives  f x {\displaystyle f_{x}} ,  f y {\displaystyle f_{y}} and  f x y {\displaystyle f_{xy}} are known at the four corners  ( 0 , 0 ) {\displaystyle (0,0)} ,  ( 1 , 0 ) {\displaystyle (1,0)} ,  ( 0 , 1 ) {\displaystyle (0,1)} , and  ( 1 , 1 ) {\displaystyle (1,1)} of the unit square. The interpolated surface can then be written as  p ( x , y ) = ∑ i = 0 3 ∑ j = 0 3 a i j x i y j . {\displaystyle p(x,y)=\sum \limits _{i=0}^{3}\sum _{j=0}^{3}a_{ij}x^{i}y^{j}.}

The interpolation problem consists of determining the 16 coefficients  a i j {\displaystyle a_{ij}} . Matching  p ( x , y ) {\displaystyle p(x,y)} with the function values yields four equations:

1. f ( 0 , 0 ) = p ( 0 , 0 ) = a 00 , {\displaystyle f(0,0)=p(0,0)=a_{00},}
2. f ( 1 , 0 ) = p ( 1 , 0 ) = a 00 + a 10 + a 20 + a 30 , {\displaystyle f(1,0)=p(1,0)=a_{00}+a_{10}+a_{20}+a_{30},}
3. f ( 0 , 1 ) = p ( 0 , 1 ) = a 00 + a 01 + a 02 + a 03 , {\displaystyle f(0,1)=p(0,1)=a_{00}+a_{01}+a_{02}+a_{03},}
4. f ( 1 , 1 ) = p ( 1 , 1 ) = ∑ i = 0 3 ∑ j = 0 3 a i j . {\displaystyle f(1,1)=p(1,1)=\textstyle \sum \limits _{i=0}^{3}\sum \limits _{j=0}^{3}a_{ij}.}

Likewise, eight equations for the derivatives in the  x {\displaystyle x} and the  y {\displaystyle y} directions:

1. f x ( 0 , 0 ) = p x ( 0 , 0 ) = a 10 , {\displaystyle f_{x}(0,0)=p_{x}(0,0)=a_{10},}
2. f x ( 1 , 0 ) = p x ( 1 , 0 ) = a 10 + 2 a 20 + 3 a 30 , {\displaystyle f_{x}(1,0)=p_{x}(1,0)=a_{10}+2a_{20}+3a_{30},}
3. f x ( 0 , 1 ) = p x ( 0 , 1 ) = a 10 + a 11 + a 12 + a 13 , {\displaystyle f_{x}(0,1)=p_{x}(0,1)=a_{10}+a_{11}+a_{12}+a_{13},}
4. f x ( 1 , 1 ) = p x ( 1 , 1 ) = ∑ i = 1 3 ∑ j = 0 3 a i j i , {\displaystyle f_{x}(1,1)=p_{x}(1,1)=\textstyle \sum \limits _{i=1}^{3}\sum \limits _{j=0}^{3}a_{ij}i,}
5. f y ( 0 , 0 ) = p y ( 0 , 0 ) = a 01 , {\displaystyle f_{y}(0,0)=p_{y}(0,0)=a_{01},}
6. f y ( 1 , 0 ) = p y ( 1 , 0 ) = a 01 + a 11 + a 21 + a 31 , {\displaystyle f_{y}(1,0)=p_{y}(1,0)=a_{01}+a_{11}+a_{21}+a_{31},}
7. f y ( 0 , 1 ) = p y ( 0 , 1 ) = a 01 + 2 a 02 + 3 a 03 , {\displaystyle f_{y}(0,1)=p_{y}(0,1)=a_{01}+2a_{02}+3a_{03},}
8. f y ( 1 , 1 ) = p y ( 1 , 1 ) = ∑ i = 0 3 ∑ j = 1 3 a i j j . {\displaystyle f_{y}(1,1)=p_{y}(1,1)=\textstyle \sum \limits _{i=0}^{3}\sum \limits _{j=1}^{3}a_{ij}j.}

And four equations for the  x y {\displaystyle xy} mixed partial derivative:

1. f x y ( 0 , 0 ) = p x y ( 0 , 0 ) = a 11 , {\displaystyle f_{xy}(0,0)=p_{xy}(0,0)=a_{11},}
2. f x y ( 1 , 0 ) = p x y ( 1 , 0 ) = a 11 + 2 a 21 + 3 a 31 , {\displaystyle f_{xy}(1,0)=p_{xy}(1,0)=a_{11}+2a_{21}+3a_{31},}
3. f x y ( 0 , 1 ) = p x y ( 0 , 1 ) = a 11 + 2 a 12 + 3 a 13 , {\displaystyle f_{xy}(0,1)=p_{xy}(0,1)=a_{11}+2a_{12}+3a_{13},}
4. f x y ( 1 , 1 ) = p x y ( 1 , 1 ) = ∑ i = 1 3 ∑ j = 1 3 a i j i j . {\displaystyle f_{xy}(1,1)=p_{xy}(1,1)=\textstyle \sum \limits _{i=1}^{3}\sum \limits _{j=1}^{3}a_{ij}ij.}

The expressions above have used the following identities:  p x ( x , y ) = ∑ i = 1 3 ∑ j = 0 3 a i j i x i − 1 y j , {\displaystyle p_{x}(x,y)=\textstyle \sum \limits _{i=1}^{3}\sum \limits _{j=0}^{3}a_{ij}ix^{i-1}y^{j},} p y ( x , y ) = ∑ i = 0 3 ∑ j = 1 3 a i j x i j y j − 1 , {\displaystyle p_{y}(x,y)=\textstyle \sum \limits _{i=0}^{3}\sum \limits _{j=1}^{3}a_{ij}x^{i}jy^{j-1},} p x y ( x , y ) = ∑ i = 1 3 ∑ j = 1 3 a i j i x i − 1 j y j − 1 . {\displaystyle p_{xy}(x,y)=\textstyle \sum \limits _{i=1}^{3}\sum \limits _{j=1}^{3}a_{ij}ix^{i-1}jy^{j-1}.}

This procedure yields a surface  p ( x , y ) {\displaystyle p(x,y)} on the unit square [ 0 , 1 ] × [ 0 , 1 ] {\displaystyle [0,1]\times [0,1]} 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  a i j {\displaystyle a_{ij}} in a vector  α = [ a 00 a 10 a 20 a 30 a 01 a 11 a 21 a 31 a 02 a 12 a 22 a 32 a 03 a 13 a 23 a 33 ] T {\displaystyle \alpha =\left[{\begin{smallmatrix}a_{00}&a_{10}&a_{20}&a_{30}&a_{01}&a_{11}&a_{21}&a_{31}&a_{02}&a_{12}&a_{22}&a_{32}&a_{03}&a_{13}&a_{23}&a_{33}\end{smallmatrix}}\right]^{T}} and letting  x = [ f ( 0 , 0 ) f ( 1 , 0 ) f ( 0 , 1 ) f ( 1 , 1 ) f x ( 0 , 0 ) f x ( 1 , 0 ) f x ( 0 , 1 ) f x ( 1 , 1 ) f y ( 0 , 0 ) f y ( 1 , 0 ) f y ( 0 , 1 ) f y ( 1 , 1 ) f x y ( 0 , 0 ) f x y ( 1 , 0 ) f x y ( 0 , 1 ) f x y ( 1 , 1 ) ] T , {\displaystyle x=\left[{\begin{smallmatrix}f(0,0)&f(1,0)&f(0,1)&f(1,1)&f_{x}(0,0)&f_{x}(1,0)&f_{x}(0,1)&f_{x}(1,1)&f_{y}(0,0)&f_{y}(1,0)&f_{y}(0,1)&f_{y}(1,1)&f_{xy}(0,0)&f_{xy}(1,0)&f_{xy}(0,1)&f_{xy}(1,1)\end{smallmatrix}}\right]^{T},} the above system of equations can be reformulated into a matrix for the linear equation  A α = x {\displaystyle A\alpha =x} .

Inverting the matrix gives the more useful linear equation  A − 1 x = α {\displaystyle A^{-1}x=\alpha } , where  A − 1 = [ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 − 3 3 0 0 − 2 − 1 0 0 0 0 0 0 0 0 0 0 2 − 2 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 − 3 3 0 0 − 2 − 1 0 0 0 0 0 0 0 0 0 0 2 − 2 0 0 1 1 0 0 − 3 0 3 0 0 0 0 0 − 2 0 − 1 0 0 0 0 0 0 0 0 0 − 3 0 3 0 0 0 0 0 − 2 0 − 1 0 9 − 9 − 9 9 6 3 − 6 − 3 6 − 6 3 − 3 4 2 2 1 − 6 6 6 − 6 − 3 − 3 3 3 − 4 4 − 2 2 − 2 − 2 − 1 − 1 2 0 − 2 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 2 0 − 2 0 0 0 0 0 1 0 1 0 − 6 6 6 − 6 − 4 − 2 4 2 − 3 3 − 3 3 − 2 − 1 − 2 − 1 4 − 4 − 4 4 2 2 − 2 − 2 2 − 2 2 − 2 1 1 1 1 ] , {\displaystyle A^{-1}=\left[{\begin{smallmatrix}{\begin{array}{rrrrrrrrrrrrrrrr}1&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0\\\0&0&0&0&1&0&0&0&0&0&0&0&0&0&0&0\\\\-3&3&0&0&-2&-1&0&0&0&0&0&0&0&0&0&0\\\2&-2&0&0&1&1&0&0&0&0&0&0&0&0&0&0\\\0&0&0&0&0&0&0&0&1&0&0&0&0&0&0&0\\\0&0&0&0&0&0&0&0&0&0&0&0&1&0&0&0\\\0&0&0&0&0&0&0&0&-3&3&0&0&-2&-1&0&0\\\0&0&0&0&0&0&0&0&2&-2&0&0&1&1&0&0\\\\-3&0&3&0&0&0&0&0&-2&0&-1&0&0&0&0&0\\\0&0&0&0&-3&0&3&0&0&0&0&0&-2&0&-1&0\\\9&-9&-9&9&6&3&-6&-3&6&-6&3&-3&4&2&2&1\\\\-6&6&6&-6&-3&-3&3&3&-4&4&-2&2&-2&-2&-1&-1\\\2&0&-2&0&0&0&0&0&1&0&1&0&0&0&0&0\\\0&0&0&0&2&0&-2&0&0&0&0&0&1&0&1&0\\\\-6&6&6&-6&-4&-2&4&2&-3&3&-3&3&-2&-1&-2&-1\\\4&-4&-4&4&2&2&-2&-2&2&-2&2&-2&1&1&1&1\end{array}}\end{smallmatrix}}\right],} which allows  α {\displaystyle \alpha } to be calculated quickly and easily.

There can be another concise matrix form for 16 coefficients:  [ f ( 0 , 0 ) f ( 0 , 1 ) f y ( 0 , 0 ) f y ( 0 , 1 ) f ( 1 , 0 ) f ( 1 , 1 ) f y ( 1 , 0 ) f y ( 1 , 1 ) f x ( 0 , 0 ) f x ( 0 , 1 ) f x y ( 0 , 0 ) f x y ( 0 , 1 ) f x ( 1 , 0 ) f x ( 1 , 1 ) f x y ( 1 , 0 ) f x y ( 1 , 1 ) ] = [ 1 0 0 0 1 1 1 1 0 1 0 0 0 1 2 3 ] [ a 00 a 01 a 02 a 03 a 10 a 11 a 12 a 13 a 20 a 21 a 22 a 23 a 30 a 31 a 32 a 33 ] [ 1 1 0 0 0 1 1 1 0 1 0 2 0 1 0 3 ] , {\displaystyle {\begin{bmatrix}f(0,0)&f(0,1)&f_{y}(0,0)&f_{y}(0,1)\\\f(1,0)&f(1,1)&f_{y}(1,0)&f_{y}(1,1)\\\f_{x}(0,0)&f_{x}(0,1)&f_{xy}(0,0)&f_{xy}(0,1)\\\f_{x}(1,0)&f_{x}(1,1)&f_{xy}(1,0)&f_{xy}(1,1)\end{bmatrix}}={\begin{bmatrix}1&0&0&0\\\1&1&1&1\\\0&1&0&0\\\0&1&2&3\end{bmatrix}}{\begin{bmatrix}a_{00}&a_{01}&a_{02}&a_{03}\\\a_{10}&a_{11}&a_{12}&a_{13}\\\a_{20}&a_{21}&a_{22}&a_{23}\\\a_{30}&a_{31}&a_{32}&a_{33}\end{bmatrix}}{\begin{bmatrix}1&1&0&0\\\0&1&1&1\\\0&1&0&2\\\0&1&0&3\end{bmatrix}},} or  [ a 00 a 01 a 02 a 03 a 10 a 11 a 12 a 13 a 20 a 21 a 22 a 23 a 30 a 31 a 32 a 33 ] = [ 1 0 0 0 0 0 1 0 − 3 3 − 2 − 1 2 − 2 1 1 ] [ f ( 0 , 0 ) f ( 0 , 1 ) f y ( 0 , 0 ) f y ( 0 , 1 ) f ( 1 , 0 ) f ( 1 , 1 ) f y ( 1 , 0 ) f y ( 1 , 1 ) f x ( 0 , 0 ) f x ( 0 , 1 ) f x y ( 0 , 0 ) f x y ( 0 , 1 ) f x ( 1 , 0 ) f x ( 1 , 1 ) f x y ( 1 , 0 ) f x y ( 1 , 1 ) ] [ 1 0 − 3 2 0 0 3 − 2 0 1 − 2 1 0 0 − 1 1 ] , {\displaystyle {\begin{bmatrix}a_{00}&a_{01}&a_{02}&a_{03}\\\a_{10}&a_{11}&a_{12}&a_{13}\\\a_{20}&a_{21}&a_{22}&a_{23}\\\a_{30}&a_{31}&a_{32}&a_{33}\end{bmatrix}}={\begin{bmatrix}1&0&0&0\\\0&0&1&0\\\\-3&3&-2&-1\\\2&-2&1&1\end{bmatrix}}{\begin{bmatrix}f(0,0)&f(0,1)&f_{y}(0,0)&f_{y}(0,1)\\\f(1,0)&f(1,1)&f_{y}(1,0)&f_{y}(1,1)\\\f_{x}(0,0)&f_{x}(0,1)&f_{xy}(0,0)&f_{xy}(0,1)\\\f_{x}(1,0)&f_{x}(1,1)&f_{xy}(1,0)&f_{xy}(1,1)\end{bmatrix}}{\begin{bmatrix}1&0&-3&2\\\0&0&3&-2\\\0&1&-2&1\\\0&0&-1&1\end{bmatrix}},} where  p ( x , y ) = [ 1 x x 2 x 3 ] [ a 00 a 01 a 02 a 03 a 10 a 11 a 12 a 13 a 20 a 21 a 22 a 23 a 30 a 31 a 32 a 33 ] [ 1 y y 2 y 3 ] . {\displaystyle p(x,y)={\begin{bmatrix}1&x&x^{2}&x^{3}\end{bmatrix}}{\begin{bmatrix}a_{00}&a_{01}&a_{02}&a_{03}\\\a_{10}&a_{11}&a_{12}&a_{13}\\\a_{20}&a_{21}&a_{22}&a_{23}\\\a_{30}&a_{31}&a_{32}&a_{33}\end{bmatrix}}{\begin{bmatrix}1\\\y\\\y^{2}\\\y^{3}\end{bmatrix}}.}

## Extension to rectilinear grids

[edit]

Often, applications call for bicubic interpolation using data on a rectilinear grid, rather than the unit square. In this case, the identities for  p x , p y , {\displaystyle p_{x},p_{y},} and  p x y {\displaystyle p_{xy}} become  p x ( x , y ) = ∑ i = 1 3 ∑ j = 0 3 a i j i x i − 1 y j Δ x , {\displaystyle p_{x}(x,y)=\textstyle \sum \limits _{i=1}^{3}\sum \limits _{j=0}^{3}{\frac {a_{ij}ix^{i-1}y^{j}}{\Delta x}},} p y ( x , y ) = ∑ i = 0 3 ∑ j = 1 3 a i j x i j y j − 1 Δ y , {\displaystyle p_{y}(x,y)=\textstyle \sum \limits _{i=0}^{3}\sum \limits _{j=1}^{3}{\frac {a_{ij}x^{i}jy^{j-1}}{\Delta y}},} p x y ( x , y ) = ∑ i = 1 3 ∑ j = 1 3 a i j i x i − 1 j y j − 1 Δ x Δ y , {\displaystyle p_{xy}(x,y)=\textstyle \sum \limits _{i=1}^{3}\sum \limits _{j=1}^{3}{\frac {a_{ij}ix^{i-1}jy^{j-1}}{\Delta x\Delta y}},} where  Δ x {\displaystyle \Delta x} is the  x {\displaystyle x} spacing of the cell containing the point  ( x , y ) {\displaystyle (x,y)} and similar for  Δ y {\displaystyle \Delta y} . In this case, the most practical approach to computing the coefficients  α {\displaystyle \alpha } is to let  x = [ f ( 0 , 0 ) f ( 1 , 0 ) f ( 0 , 1 ) f ( 1 , 1 ) Δ x f x ( 0 , 0 ) Δ x f x ( 1 , 0 ) Δ x f x ( 0 , 1 ) Δ x f x ( 1 , 1 ) Δ y f y ( 0 , 0 ) Δ y f y ( 1 , 0 ) Δ y f y ( 0 , 1 ) Δ y f y ( 1 , 1 ) Δ x Δ y f x y ( 0 , 0 ) Δ x Δ y f x y ( 1 , 0 ) Δ x Δ y f x y ( 0 , 1 ) Δ x Δ y f x y ( 1 , 1 ) ] T , {\displaystyle x=\left[{\begin{smallmatrix}f(0,0)&f(1,0)&f(0,1)&f(1,1)&\Delta xf_{x}(0,0)&\Delta xf_{x}(1,0)&\Delta xf_{x}(0,1)&\Delta xf_{x}(1,1)&\Delta yf_{y}(0,0)&\Delta yf_{y}(1,0)&\Delta yf_{y}(0,1)&\Delta yf_{y}(1,1)&\Delta x\Delta yf_{xy}(0,0)&\Delta x\Delta yf_{xy}(1,0)&\Delta x\Delta yf_{xy}(0,1)&\Delta x\Delta yf_{xy}(1,1)\end{smallmatrix}}\right]^{T},} then to solve  α = A − 1 x {\displaystyle \alpha =A^{-1}x} with  A {\displaystyle A} as before. Next, the normalized interpolating variables are computed as  x ¯ = x − x 0 x 1 − x 0 , y ¯ = y − y 0 y 1 − y 0 {\displaystyle {\begin{aligned}{\overline {x}}&={\frac {x-x_{0}}{x_{1}-x_{0}}},\\\\{\overline {y}}&={\frac {y-y_{0}}{y_{1}-y_{0}}}\end{aligned}}} where  x 0 , x 1 , y 0 , {\displaystyle x_{0},x_{1},y_{0},} and  y 1 {\displaystyle y_{1}} are the  x {\displaystyle x} and  y {\displaystyle y} coordinates of the grid points surrounding the point  ( x , y ) {\displaystyle (x,y)} . Then, the interpolating surface becomes  p ( x , y ) = ∑ i = 0 3 ∑ j = 0 3 a i j x ¯ i y ¯ j . {\displaystyle p(x,y)=\sum \limits _{i=0}^{3}\sum _{j=0}^{3}a_{ij}{\overline {x}}^{i}{\overline {y}}^{j}.}

## Finding derivatives from function values

[edit]

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,  f x {\displaystyle f_{x}} or  f y {\displaystyle f_{y}} , using that method, find the slope between the two surrounding points in the appropriate axis. For example, to calculate  f x {\displaystyle f_{x}} for one of the points, find  f ( x , y ) {\displaystyle f(x,y)} for the points to the left and right of the target point and calculate their slope, and similarly for  f y {\displaystyle f_{y}} .

To find the cross derivative  f x y {\displaystyle f_{xy}} , take the derivative in both axes, one at a time. For example, one can first use the  f x {\displaystyle f_{x}} procedure to find the  x {\displaystyle x} derivatives of the points above and below the target point, then use the  f y {\displaystyle f_{y}} procedure on those values (rather than, as usual, the values of  f {\displaystyle f} for those points) to obtain the value of  f x y ( x , y ) {\displaystyle f_{xy}(x,y)} for the target point. (Or one can do it in the opposite direction, first calculating  f y {\displaystyle f_{y}} and then  f x {\displaystyle f_{x}} 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.

## Bicubic convolution algorithm

[edit]

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:  W ( x ) = { ( a + 2 ) | x | 3 − ( a + 3 ) | x | 2 + 1 for  | x | ≤ 1 , a | x | 3 − 5 a | x | 2 + 8 a | x | − 4 a for  1 < | x | < 2 , 0 otherwise , {\displaystyle W(x)={\begin{cases}(a+2)|x|^{3}-(a+3)|x|^{2}+1&{\text{for }}|x|\leq 1,\\\a|x|^{3}-5a|x|^{2}+8a|x|-4a&{\text{for }}1<|x|<2,\\\0&{\text{otherwise}},\end{cases}}} where  a {\displaystyle a} is usually set to −0.5 or −0.75. Note that  W ( 0 ) = 1 {\displaystyle W(0)=1} and  W ( n ) = 0 {\displaystyle W(n)=0} for all nonzero integers  n {\displaystyle n} .

This approach was proposed by Keys, who showed that  a = − 0.5 {\displaystyle a=-0.5} produces third-order convergence with respect to the sampling interval of the original function.[1]

If we use the matrix notation for the common case  a = − 0.5 {\displaystyle a=-0.5} , we can express the equation in a more friendly manner:  p ( t ) = 1 2 [ 1 t t 2 t 3 ] [ 0 2 0 0 − 1 0 1 0 2 − 5 4 − 1 − 1 3 − 3 1 ] [ f − 1 f 0 f 1 f 2 ] {\displaystyle p(t)={\tfrac {1}{2}}{\begin{bmatrix}1&t&t^{2}&t^{3}\end{bmatrix}}{\begin{bmatrix}0&2&0&0\\\\-1&0&1&0\\\2&-5&4&-1\\\\-1&3&-3&1\end{bmatrix}}{\begin{bmatrix}f_{-1}\\\f_{0}\\\f_{1}\\\f_{2}\end{bmatrix}}} for  t {\displaystyle t} 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  t {\displaystyle t} here.

For two dimensions first applied once in  x {\displaystyle x} and again in  y {\displaystyle y} :  b − 1 = p ( t x , f ( − 1 , − 1 ) , f ( 0 , − 1 ) , f ( 1 , − 1 ) , f ( 2 , − 1 ) ) , b 0 = p ( t x , f ( − 1 , 0 ) , f ( 0 , 0 ) , f ( 1 , 0 ) , f ( 2 , 0 ) ) , b 1 = p ( t x , f ( − 1 , 1 ) , f ( 0 , 1 ) , f ( 1 , 1 ) , f ( 2 , 1 ) ) , b 2 = p ( t x , f ( − 1 , 2 ) , f ( 0 , 2 ) , f ( 1 , 2 ) , f ( 2 , 2 ) ) , {\displaystyle {\begin{aligned}b_{-1}&=p(t_{x},f_{(-1,-1)},f_{(0,-1)},f_{(1,-1)},f_{(2,-1)}),\\\\[1ex]b_{0}&=p(t_{x},f_{(-1,0)},f_{(0,0)},f_{(1,0)},f_{(2,0)}),\\\\[1ex]b_{1}&=p(t_{x},f_{(-1,1)},f_{(0,1)},f_{(1,1)},f_{(2,1)}),\\\\[1ex]b_{2}&=p(t_{x},f_{(-1,2)},f_{(0,2)},f_{(1,2)},f_{(2,2)}),\end{aligned}}} p ( x , y ) = p ( t y , b − 1 , b 0 , b 1 , b 2 ) . {\displaystyle p(x,y)=p(t_{y},b_{-1},b_{0},b_{1},b_{2}).}

## Use in computer graphics

[edit]

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.

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.

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.

## See also

[edit]

* Mathematics portal

* Spatial anti-aliasing
* Bézier surface
* Bilinear interpolation
* Cubic Hermite spline, the one-dimensional analogue of bicubic spline
* Lanczos resampling
* Natural neighbor interpolation
* Sinc filter
* Spline interpolation
* Tricubic interpolation
* Directional Cubic Convolution Interpolation

## References

[edit]

1. ^ R. Keys (1981). "Cubic convolution interpolation for digital image processing". IEEE Transactions on Acoustics, Speech, and Signal Processing. 29 (6): 1153–1160\. Bibcode:1981ITASS..29.1153K. CiteSeerX 10.1.1.320.776. doi:10.1109/TASSP.1981.1163711.

## External links

[edit]

* Application of interpolation to elevation samples
* Interpolation theory
* Explanation and Java/C++ implementation of (bi)cubic interpolation
* Excel Worksheet Function for Bicubic Lagrange Interpolation