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
Suppose the function values f and the derivatives fx, fy and fxy are known at the four corners (0,0), (1,0), (0,1), and (1,1) of the unit square. The interpolated surface can then be written as p(x,y)=∑i=03∑j=03aijxiyj. The interpolation problem consists of determining the 16 coefficients aij. Matching p(x,y) with the function values yields four equations:
f(0,0)=p(0,0)=a00, f(1,0)=p(1,0)=a00+a10+a20+a30, f(0,1)=p(0,1)=a00+a01+a02+a03, f(1,1)=p(1,1)=∑i=03∑j=03aij. Likewise, eight equations for the derivatives in the x and the y directions:
fx(0,0)=px(0,0)=a10, fx(1,0)=px(1,0)=a10+2a20+3a30, fx(0,1)=px(0,1)=a10+a11+a12+a13, fx(1,1)=px(1,1)=∑i=13∑j=03aiji, fy(0,0)=py(0,0)=a01, fy(1,0)=py(1,0)=a01+a11+a21+a31, fy(0,1)=py(0,1)=a01+2a02+3a03, fy(1,1)=py(1,1)=∑i=03∑j=13aijj. And four equations for the xy mixed partial derivative:
fxy(0,0)=pxy(0,0)=a11, fxy(1,0)=pxy(1,0)=a11+2a21+3a31, fxy(0,1)=pxy(0,1)=a11+2a12+3a13, fxy(1,1)=pxy(1,1)=∑i=13∑j=13aijij. The expressions above have used the following identities: px(x,y)=∑i=13∑j=03aijixi−1yj, py(x,y)=∑i=03∑j=13aijxijyj−1, pxy(x,y)=∑i=13∑j=13aijixi−1jyj−1. This procedure yields a surface p(x,y) on the unit square [0,1]×[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 aij in a vector α=[a00a10a20a30a01a11a21a31a02a12a22a32a03a13a23a33]T and letting x=[f(0,0)f(1,0)f(0,1)f(1,1)fx(0,0)fx(1,0)fx(0,1)fx(1,1)fy(0,0)fy(1,0)fy(0,1)fy(1,1)fxy(0,0)fxy(1,0)fxy(0,1)fxy(1,1)]T, the above system of equations can be reformulated into a matrix for the linear equation Aα=x. Inverting the matrix gives the more useful linear equation A−1x=α, where A−1=[10000000000000000000100000000000−3300−2−100000000002−2001100000000000000000010000000000000000000100000000000−3300−2−100000000002−2001100−30300000−20−1000000000−30300000−20−109−9−9963−6−36−63−34221−666−6−3−333−44−22−2−2−1−120−20000010100000000020−2000001010−666−6−4−242−33−33−2−1−2−14−4−4422−2−22−22−21111], which allows α to be calculated quickly and easily. There can be another concise matrix form for 16 coefficients: [f(0,0)f(0,1)fy(0,0)fy(0,1)f(1,0)f(1,1)fy(1,0)fy(1,1)fx(0,0)fx(0,1)fxy(0,0)fxy(0,1)fx(1,0)fx(1,1)fxy(1,0)fxy(1,1)]=[1000111101000123][a00a01a02a03a10a11a12a13a20a21a22a23a30a31a32a33][1100011101020103], or [a00a01a02a03a10a11a12a13a20a21a22a23a30a31a32a33]=[10000010−33−2−12−211][f(0,0)f(0,1)fy(0,0)fy(0,1)f(1,0)f(1,1)fy(1,0)fy(1,1)fx(0,0)fx(0,1)fxy(0,0)fxy(0,1)fx(1,0)fx(1,1)fxy(1,0)fxy(1,1)][10−32003−201−2100−11], where p(x,y)=[1xx2x3][a00a01a02a03a10a11a12a13a20a21a22a23a30a31a32a33][1yy2y3].
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 px,py, and pxy become px(x,y)=∑i=13∑j=03aijixi−1yjΔx, py(x,y)=∑i=03∑j=13aijxijyj−1Δy, pxy(x,y)=∑i=13∑j=13aijixi−1jyj−1ΔxΔy, where Δx is the x spacing of the cell containing the point (x,y) and similar for Δy. In this case, the most practical approach to computing the coefficients α is to let x=[f(0,0)f(1,0)f(0,1)f(1,1)Δxfx(0,0)Δxfx(1,0)Δxfx(0,1)Δxfx(1,1)Δyfy(0,0)Δyfy(1,0)Δyfy(0,1)Δyfy(1,1)ΔxΔyfxy(0,0)ΔxΔyfxy(1,0)ΔxΔyfxy(0,1)ΔxΔyfxy(1,1)]T, then to solve α=A−1x with A as before. Next, the normalized interpolating variables are computed as x‾=x−x0x1−x0,y‾=y−y0y1−y0 where x0,x1,y0, and y1 are the x and y coordinates of the grid points surrounding the point (x,y). Then, the interpolating surface becomes p(x,y)=∑i=03∑j=03aijx‾iy‾j.
Finding derivatives from function values 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, fx or fy, using that method, find the slope between the two surrounding points in the appropriate axis. For example, to calculate fx for one of the points, find f(x,y) for the points to the left and right of the target point and calculate the slope of the straight line between them, and similarly for fy. To find the cross derivative fxy, take the derivative in both axes, one at a time. For example, one can first use the fx procedure to find the x derivatives of the points above and below the target point, then use the fy procedure on those values (rather than, as usual, the values of f for those points) to obtain the value of fxy(x,y) for the target point. (Or one can do it in the opposite direction, first calculating fy and then fx 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
… excerpt ends here. Continue reading the full article.


![Bicubic interpolation: Bicubic interpolation on the square [0,4]×[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.](https://thumb.wikimedia.org/wikipedia/commons/thumb/f/f5/Interpolation-bicubic.svg/330px-Interpolation-bicubic.svg.png?utm_source=en.wikipedia.org&utm_campaign=parser&utm_content=thumbnail)
![Bicubic interpolation: Bilinear interpolation on the same dataset as above.[dubious – discuss] Derivatives of the surface are not continuous over the square boundaries.](https://thumb.wikimedia.org/wikipedia/commons/thumb/d/dd/Interpolation-bilinear.svg/330px-Interpolation-bilinear.svg.png?utm_source=en.wikipedia.org&utm_campaign=parser&utm_content=thumbnail)

