Resampling image resolution

Bicubic Interpolation Techniques For Digital Imaging

Vincent T.
High-Definition Pro
5 min readMar 3, 2020

--

Bicubic interpolation is a 2D system of using cubic splines or other polynomial technique for sharpening and enlarging digital images. It is commonly used in computer image editing software, by retouchers and editors when upscaling or resampling an image. When we interpolate an image, we are actually distorting the pixels from one grid to another.

There are 2 common interpolation algorithms, adaptive and non-adaptive. The adaptive methods depends on what they are interpolating, whereas non-adaptive methods treat the pixels equally. Adaptive algorithms are used in many proprietary techniques in specialized professional image editing software like Photozoom Pro and Adobe Photoshop. Non-adaptive algorithms include the following: nearest neighbor, bilinear, bicubic, spline (to name a few). In general bicubic interpolation can be accomplished using Lagrange polynomials, cubic splines or cubic convolution algorithms.

When we interpolate, we are estimating unknown data from known data. If we shot an image with a DSLR at 16 MP, then your known data is that you have 4928 x 3264 pixels (or 3264 x 4928 pixels), depending on the orientation (horizontal vs. vertical). When we want to upscale the image, we are approximating the new values based on that of the surrounding pixels. For example if you want to increase the image size to 24 MP at 6000 x 4000 pixels, you are adding more pixels that were not present before. That is an additional 8 MP.

Since we are adding, not subtracting pixels, details could be lost. In order to preserve the sharpness and details, each pixel has to be approximated with its surrounding pixels in order to get the closest value. It is like duplicating a pixel to fill up the space created in the image by upscaling. Therefore, the values must be approximately similar or the same as its nearest pixel neighbor. You need to add 8 million new pixels to the image to fill up the space when upscaling. They just have to be accurate enough to recreate the details and preserve the sharpness for image clarity.

Consider the following grid.

(Source Wikipedia)

This is a (4,0) x (0,4) square with each square representing a pixel. It has a total of 25 pixels (5 x 5). The black dots represent the data being interpolated, which totals 25 dots. The colors indicate function values, so in this example we see they are not radially symmetric. This allows for smoother resampling with little image artifacts. Bicubic interpolation is often chosen over bilinear or nearest-neighbor interpolation because of this, but it takes more time to process images. If the quality is of concern, then bicubic would be the best choice as well. While bilinear interpolation processes 2x2 (4 pixels) squares, bicubic interpolation processes 4x4 (16 pixels) squares.

Let’s say you were given this function:

(0,0)

(1,0)

(0,1)

(1,1)

These are 4 corners of the unit square. This can be represented as the following:

This requires determining the values of 16 coefficients of p(x,y). There are more steps in the process, but this is the basic formula. This is what creates the interpolated surface of the 2D image. It is all about taking the values of a point at p(x,y) on a grid and interpolating them to approximate the value of its surrounding point.

If you don’t code, you can always use software that have pre-built functions for image editing. When resampling an image in Photoshop, you are given bicubic interpolation techniques. From the menu:

Image -> Image Size 

You will then get a dialogue box from where you can choose the resample option you want. Bilinear and nearest-neighbor are also options if you don’t intend on quality, but faster upscaling or downscaling.

Image resampling size dialogue in Photoshop (Source Adobe Creative Cloud)

You can change the number of pixels, but like all good things there are limitations. Bicubic interpolation works well at high resolution, but when you are going beyond 24 MP super high resolution it may not work out so well. This is because the more pixels you add, the more details you will need to preserve. The algorithm is just not able to preserve everything the way it was from the original image resolution.

Most of the time you are working with JPEG images which are compressed. You may have already lost details if your compression level is higher to conserve space. Otherwise, choose the lowest compression level to preserve more of the images details for upscaling. When downscaling, it is much different. You actually have much more detail and sharpness to work with when reducing pixels than you do when adding pixels. This is because it is harder to recreate detail than it is to simply remove it. With downscaling, the great thing about it is the quality still looks great (e.g. 8K to 2K) since no artificial details are approximated or created to fill up spaces.

Bicubic interpolation is not just used for scaling images, but video display as well. Although they are more superior than other 2D techniques, they do have some drawbacks. Overshoot (haloing), clipping, ringing artifacts and acute sharpness are sometimes not too flattering to the eye. This is why too much upscaling can be horrible with bicubic interpolation. There are now super resolution techniques like SRCNN (Super Resolution Convolutional Neural Networks) or SRGAN (Super Resolution Generative Adversarial Networks) that do a better job at preserving details with sharpness.

--

--

Vincent T.
High-Definition Pro

Blockchain, AI, DevOps, Cybersecurity, Software Development, Engineering, Photography, Technology