Image Interpolation

Nearest neighbour interpolation

Notes from Cyrill Stachniss.

  • Choose the same colour value as the closest nearby pixel
  • Results in rounding the pixel position

This is basically what I was thinking when it came to rounding values.

I don't understand how this works in practice..?

Think of it this way: for each target pixel in the new grid, identify its corresponding location in the original image. In NN interpolation, the intensity of this target pixel is set to the value of the closest pixel in the original image.

  • So when you think about scaling down, the target image is smaller. Find the closest pixel in the original image that is bigger

What about the other way around (scaling up)?

What if the target image is scaled up? The same thing works. For each pixel on the target image, apply the inverse transform to find the nearest pixel on the original image.

NN Interpolation sucks

Nearest neighbour interpolation is fast but sucks. This is because you are losing information about the neighbouring pixels.