Contents
Bicubic interpolation
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 f_x, f_y and f_{xy} 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 The interpolation problem consists of determining the 16 coefficients a_{ij}. Matching p(x,y) with the function values yields four equations: Likewise, eight equations for the derivatives in the x and the y directions: And four equations for the xy mixed partial derivative: The expressions above have used the following identities: This procedure yields a surface p(x,y) 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 a_{ij} in a vector and letting the above system of equations can be reformulated into a matrix for the linear equation A\alpha=x. Inverting the matrix gives the more useful linear equation, where which allows \alpha to be calculated quickly and easily. There can be another concise matrix form for 16 coefficients: or where
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 p_x, p_y, and p_{xy} become where \Delta x is the x spacing of the cell containing the point (x,y) and similar for \Delta y. In this case, the most practical approach to computing the coefficients \alpha is to let then to solve with A as before. Next, the normalized interpolating variables are computed as where and y_1 are the x and y coordinates of the grid points surrounding the point (x,y). Then, the interpolating surface becomes
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, f_x or f_y, using that method, find the slope between the two surrounding points in the appropriate axis. For example, to calculate f_x for one of the points, find f(x,y) for the points to the left and right of the target point and calculate their slope, and similarly for f_y. To find the cross derivative f_{xy}, take the derivative in both axes, one at a time. For example, one can first use the f_x procedure to find the x derivatives of the points above and below the target point, then use the f_y procedure on those values (rather than, as usual, the values of f for those points) to obtain the value of f_{xy}(x,y) for the target point. (Or one can do it in the opposite direction, first calculating f_y and then 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
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 a is usually set to −0.5 or −0.75. Note that W(0)=1 and W(n)=0 for all nonzero integers n. This approach was proposed by Keys, who showed that a=-0.5 produces third-order convergence with respect to the sampling interval of the original function. If we use the matrix notation for the common case a = -0.5, we can express the equation in a more friendly manner: for 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 here. For two dimensions first applied once in x and again in y:
Use in computer graphics
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.
This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.
Wikipedia® is a registered trademark of the
Wikimedia Foundation, Inc.
Bliptext is not
affiliated with or endorsed by Wikipedia or the
Wikimedia Foundation.