Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

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. The library supports the following interpolation modes depending on how the type of interpolation algorithm is specified:

  • Type 1: Application code specifies the interpolation mode by passing the interpolation parameter of int type to a processing function. The following interpolation modes are supported:
    • Nearest neighbor interpolation (interpolation = IPPI_INTER_NN)

    • Linear interpolation (interpolation = IPPI_INTER_LINEAR)

    • Cubic interpolation (interpolation = IPPI_INTER_CUBIC)

    • Interpolation with Lanczos window function (interpolation = IPPI_INTER_LANCZOS)

    • Interpolation with two-parameter cubic filters with the fixed coefficients (interpolation can be set to the following:

      • IPPI_INTER_CUBIC2P_BSPLINE (B=1; C=0)
      • IPPI_INTER_CUBIC2P_CATMULLROM (B=0; C=0.5)
      • IPPI_INTER_CUBIC2P_ B05C03 (B=0.5; C=0.3)

  • Type 2: Interpolation mode is specified explicitly in a function name suffix:
    • Nearest neighbor interpolation (pass interpolation = ippNearest to GetSize functions, use the functions with the Nearest suffix, for example, ResizeNearestInit or ResizeNearest)

    • Linear interpolation (pass interpolation = ippLinear to GetSize functions, use the functions with the Linear suffix, for example, ResizeLinearInit or ResizeLinear)

    • Interpolation with two-parameter cubic filters (pass interpolation = ippCubic to GetSize functions, use the functions with the Cubic suffix, for example, ResizeCubicInit or ResizeCubic)

    • Supersampling (pass interpolation = ippSuper to GetSize functions, use the functions with the Super suffix, for example, ResizeSuperInit or ResizeSuper)

    • Interpolation with Lanczos window function (pass interpolation = ippLanczos to GetSize functions, use the functions with the Lanczos suffix, for example, ResizeLanczosInit or ResizeLanczos)

For certain functions of type 1, the specified interpolation modes can be combined with additional smoothing of edges to which the borders of the original image are transformed. To use this option, for the interpolation parameter, specify the edge smoothing flag and the desired interpolation mode using the bitwise OR operation. 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.

To enable edge smoothing for functions of type 2, pass the special flag to the Init function (if it exists), for example, you can pass this flag to Init functions for WarpAffine and WarpPerspective function groups.

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.

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 Cub2P Cub CR La2 La3 SS AA ES
ResizeCubic     x   x *)          
ResizeLanczos           x x      
ResizeLinear   x                
ResizeNearest x                  
ResizeSuper               x    
WarpAffineCubic     x   x *)          
WarpAffineLinear   x                
WarpAffineNearest x                  
WarpPerspectiveCubic     x   x *)          
WarpPerspectiveLinear   x                
WarpPerspectiveNearest x                  
Remap x x   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.

Here NN - nearest neighbor interpolation, Lin - linear interpolation, Cub2P - interpolation with two-parameter cubic filters, 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.