# How does nearest neighbour, bilinear and cubic interpolation work in images?

More math is appreciated for each of the methods and references are appreciated. I have tried understanding from Wiki and matlab link but don't understand how the translation matrix is being used there.

What I seek is to be able to teach this to someone else. Thanks!

Here is an illustration of bicubic interpolation, which typically needs 4x4 input pixels to calculate one output pixel:

Figure 1. Bicubic interpolation from 4x4 input pixel values to calculate one output pixel value. a) The output pixel must be located in the greyed area with respect to the input pixels (black dots). b) Four intermediate values (red dots) are independently calculated by interpolating horizontally from each row of four input pixels. c) Using the same interpolation method, the output value (blue dot) is interpolated vertically from the column of four intermediate values.

Each interpolation amounts to a weighted sum of four values, with the weights given by cubic polynomials of horizontal or vertical position within the grey square.

Bilinear interpolation works similarly but only has as input the 2x2 pixels at the corners of the grey square, and the polynomials are linear.

Nearest neighbor interpolation has the grey square centered at a pixel, and simply that pixel value is output.

There is all you need to know (both explanations and maths) on their respective wikipedia pages:

Since an image is made of three 2D layer (one for each color), the process is repeated for each layer.