Lably
Skip to content

Bicubic interpolation

Extension of cubic spline interpolation

  • 6 min read
  • 5 chapters

Related on Lably

Through Mathematics, Two-dimensional space and Digital image processing

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:

  1. f(0,0)=p(0,0)=a00,
  2. f(1,0)=p(1,0)=a00+a10+a20+a30,
  3. f(0,1)=p(0,1)=a00+a01+a02+a03,
  4. f(1,1)=p(1,1)=∑i=03∑j=03aij.

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

  1. fx(0,0)=px(0,0)=a10,
  2. fx(1,0)=px(1,0)=a10+2a20+3a30,
  3. fx(0,1)=px(0,1)=a10+a11+a12+a13,
  4. fx(1,1)=px(1,1)=∑i=13∑j=03aiji,
  5. fy(0,0)=py(0,0)=a01,
  6. fy(1,0)=py(1,0)=a01+a11+a21+a31,
  7. fy(0,1)=py(0,1)=a01+2a02+3a03,
  8. fy(1,1)=py(1,1)=∑i=03∑j=13aijj.

And four equations for the xy mixed partial derivative:

  1. fxy(0,0)=pxy(0,0)=a11,
  2. fxy(1,0)=pxy(1,0)=a11+2a21+3a31,
  3. fxy(0,1)=pxy(0,1)=a11+2a12+3a13,
  4. 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].

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Computing and communication