# Image interpolation in OpenCV

Some form of image interpolation is always taking place when manipulating digital images — whether it’s resizing them to increase or decrease the total number of pixels, correcting for lens distortion, changing perspective, or rotating an image.

Rephrase Interpolation is an approximation that may result in image degradation each time it’s performed. The image may vary significantly depending on the interpolation algorithm used.

In this post, i will provide an overview of the diffrent interpolation algorithm that OpenCV uses

# Nearest-neighbor interpolation

The nearest neighbour algorithm selects the value of the nearest pixel and does not interpolate between values from other neighbouring pixels. This algorithm does not create any pixel values that doesn’t exist on the original image. This type of interpolation is ideal for scaling images where precise pixel borders must be maintained (such when working with pixel art).

`DisplayImageComparison1x3(original_im,`

ScaleImageByRatio(original_im,2,2,cv2.INTER_LINEAR),

ScaleImageByRatio(original_im,.5,.5,cv2.INTER_LINEAR),

"2x scale",

".5x scale")

DisplayImageComparison1x3(original_px_im…