Different Approaches in Intel(R) IPP Resize

ID 659328
Updated 4/16/2018
Version Latest
Public

author-image

By

 

Intel® Integrated Performance Primitive (Intel® IPP) library exists more than 20 years. Together with this long history Resize functionality also continuously changes from release to release: - API became more convenient, scaling approach was changes.

Difference between Resize APIs

Historically there were 3 base Resize API in Intel® IPP library: ippiResizeSqrPixel, ippiResize, ippiResizeLinear (and for other interpolation types similarly).

The main difference was introduced by switching from ippiResize to ippiResizeSqrPixel, when the “pixel-point” approach was changed to the “square-pixel” approach.

ippiResize “point-pixel” approach:

This approach represents an image as a grid with a pixel in each node. Working with such format we operate with grid.

The approach is not natural. For example, consider an image 7x7 pixels. If we assume that distance between neighbor horizontal or vertical pixels is one, then the distance between extreme pixels is six. If we want to double image size, we must double the image grid, the result grid has the distance between extreme pixels is 12. Thus after such resize transformation of 7x7 pixel image we obtain the 13x13 pixel image. Many customers weren’t satisfied with algorithmic difference from popular Adobe® PhotoShop®.

ippiResizeSqrPixel/ippiResize<Interpolation> “square-pixel” approach:

This approach considers pixels as "squares" and resizes a number of such "squares". This model is more natural than previous. Thus after increasing twice the image with size 7x7 pixels we obtain the image with size 14x14 pixels.

ippiResizeSqrPixel and ippiResizeLinear have the same scaling approaches. The difference is in supported border types (ippiResizeSqrPixel supports Replicate borders by default, ippiResizeLinear supports Replicate and InMem border types). Also ippiResizeSqrPixel has a possibility to set real scale factor but ippiResizeLinear supports integer scaling only.

Difference between the coordinate systems used by ipprWarpAffine and ipprResize (2D and 3D cases)

The function ipprResize considers an image as set of cubic pixels. Each pixel is a cube with unit volume (1x1x1). So the function works with center points of pixels. The transformation that maps a source image to the destination one can be expressed by the following formula:

The function ipprWarpAffine considers an image as set of point pixels. Each pixel is a point with zero volume, the distance between neighbor pixels is 1 along each dimension. So the function just works with points. The transformation that maps a source image to the destination one can be expressed by the following formula:

Related Link:

Developer reference: https://software.intel.com/en-us/ipp-dev-reference-resizelinear

Resize Changes in Intel® IPP 7.1