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 theinterpolationparameter ofinttype 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 (interpolationcan 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 (passinterpolation=ippNearesttoGetSizefunctions, use the functions with theNearestsuffix, for example,ResizeNearestInitorResizeNearest)
- Linear interpolation (passinterpolation=ippLineartoGetSizefunctions, use the functions with theLinearsuffix, for example,ResizeLinearInitorResizeLinear)
- Interpolation with two-parameter cubic filters (passinterpolation=ippCubictoGetSizefunctions, use the functions with theCubicsuffix, for example,ResizeCubicInitorResizeCubic)
- Supersampling (passinterpolation=ippSupertoGetSizefunctions, use the functions with theSupersuffix, for example,ResizeSuperInitorResizeSuper)
- Interpolation with Lanczos window function (passinterpolation=ippLanczostoGetSizefunctions, use the functions with theLanczossuffix, for example,ResizeLanczosInitorResizeLanczos)
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_EDGETo 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.
Function Base Name
| NN
| Lin
| Cub2P
| Cub
| CR
| La2
| La3
| SS
| AA
| ES
|
---|---|---|---|---|---|---|---|---|---|---|
*) 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.