# Overview of Interpolation Modes

In geometric transformations, the grid of input image pixels is not necessarily mapped onto the grid of pixels in the output image. Therefore, to compute the pixel intensities in the output image, the geometric transform functions need to interpolate the intensity values of several input pixels that are mapped to a certain neighborhood of the output pixel.

Geometric transformations can use various interpolation algorithms. When calling the geometric transform functions of the Intel IPP, the application code specifies the interpolation mode (that is, the type of interpolation algorithm) by using the parameter interpolation. The library supports the following main interpolation modes:

• nearest neighbor interpolation (interpolation = IPPI_INTER_NN, or use the ippiResizeNearest function)

• linear interpolation (interpolation = IPPI_INTER_LINEAR, or use the ippiResizeLinear function)

• cubic interpolation (interpolation = IPPI_INTER_CUBIC)

• supersampling (interpolation = IPPI_INTER_SUPER, or use the ippiResizeSuper function)

• interpolation with Lanczos window function (interpolation = IPPI_INTER_LANCZOS, or use the ippiResizeLanczos function).

• interpolation with two-parameter cubic filters (interpolation can be set to one of the IPPI_INTER_CUBIC2P_BSPLINE, IPPI_INTER_CUBIC2P_CATMULLROM, IPPI_INTER_CUBIC2P_B05C03, or use the ippiResizeCubic function, where parameters B and C can be defined explicitly).

For certain functions, the above main interpolation modes can be combined with additional smoothing of edges to which the borders of the original image are transformed. To use this option, set the parameter interpolation to the bitwise OR of the edge smooting flag and the desired interpolation mode. For example, in order to rotate an image with cubic interpolation and smooth the rotated image edges, pass the following value to ippiRotate():

`interpolation = IPPI_INTER_CUBIC | IPPI_SMOOTH_EDGE`.

Interpolation with edge smoothing option can be used only in those geometric transform functions where this option is explicitly listed in the parameters definition section.

For the function ResizeSqrPixel the listed above modes can be combined with the additional antialiasing option to remove various artefacts of image compression. To use this feature, set the parameter interpolation to the bitwise OR of IPPI_ANTIALIASING and the desired interpolation mode. Antialiasing does not work with supersampling and nearest neighbor interpolation modes.

Table Interpolation Modes Supported by Image Geometric Transform Functions lists the supported interpolation modes for the main geometric transform functions that use interpolation.

Interpolation Modes Supported by Image Geometric Transform Functions
Function Base Name NN Lin Cub CR La2 La3 SS AA ES
ResizeCubic x *) x *)
ResizeLanczos x x
ResizeLinear x
ResizeNearest x
ResizeSqrPixel x x x x **) x x x x ***)
ResizeSuper x
Remap x x x x x n/a n/a x
Rotate x x x x n/a n/a x
RotateCenter x x x x n/a n/a x
Shear x x x x n/a n/a x
WarpAffine x x x x n/a n/a x
WarpAffineBack x x x n/a n/a
WarpAffineQuad x x x n/a n/a x
WarpPerspective x x x n/a n/a x
WarpPerspectiveBack x x x n/a n/a
WarpPerspectiveQuad x x x n/a n/a x
WarpBilinear x x x n/a n/a x
WarpBilinearBack x x x n/a n/a
WarpBilinearQuad x x x n/a n/a x

*) The function ippiResizeCubic supports the interpolation with two-parameter cubic filters, where parameters B and C can be specified explicitly.

**) The function ippiResizeSqrPixel additionally supports two variants of the interpolation with two-parameter cubic filters.

***) The function ippiResizeSqrPixel supports two variants of the edge smoothing (see function description).

Here NN - nearest neighbor interpolation, Lin - linear interpolation, Cub - cubic interpolation, CR - Catmull-Rom spline, La2, La3 - interpolation with the Lanczos window, SS - super sampling interpolation, AA - antialiasing, ES - edge smoothing.

The sections that follow provide more details on each interpolation mode.

For more complete information about compiler optimizations, see our Optimization Notice.