Bilinear interpolation is used to compute an output pixel value based on a weighted average of its four nearest pixels. It is mainly used when scaling up an image, rotating it, or performing 3D rendering.
Note: The "bi" prefix indicates that the interpolation is performed in two directions (horizontally and vertically).
Bilinear interpolation is an extension of the linear interpolation for interpolating functions of the two variables (
It considers the closest
The major advantages for using bilinear interpolation are given below.
Better approximation of data: For 2D datasets,
Sub-pixel accuracy in images: In digital image processing, bilinear interpolation is often used to perform tasks such as resizing, zooming, translation, and rotation. It allows us to estimate pixel values at non-integer pixel locations, providing accuracy. It is important when transforming images, as it helps maintain the images' continuity.
Simple and efficient: While more complex methods for interpolation, such as bicubic or spline interpolation, can offer even smoother results, bilinear interpolation strikes a good balance between simplicity, performance, and accuracy. It involves only a few mathematical operations, making it an efficient and suitable method for real-time applications.
The process of bilinear interpolation involves two steps:
Interpolation in the horizontal (
Interpolation in the vertical (
The complete process of finding the interpolated value is given below.
Assume a
Here,
The point
Horizontal interpolation
Note:
is the distance of the point from along the x-axis.
Vertical interpolation
Note:
is the fractional distance of the point from along the y-axis.
The intensity values of the pixels at the corners of the grid are given below.
Let's say that the point
Horizontal interpolation
Interpolation on the bottom row
Interpolation on the top row
Vertical interpolation (interpolation between
For the point