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

ID 790148
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Linear Interpolation

The linear interpolation is slower but more accurate than the nearest neighbor interpolation. On the other hand, it is faster but less accurate than cubic interpolation. The linear interpolation algorithm uses source image intensities at the four pixels (xS0, yS0), (xS1, yS0), (xS0, yS1), (xS1, yS1) that are closest to (xS, yS) in the source image:

xS0 = int(xS), xS1 = xS0 + 1, yS0 = int(yS), yS1 = yS0 + 1.

First, the intensity values are interpolated along the x-axis to produce two intermediate results I0 and I1 (see Figure Linear Interpolation):

I0 = S(xS, yS0) = S(xS0, yS0)*(xS1 - xS) + S(xS1, yS0)*(xS - xS0)

I1 = S(xS, yS1) = S(xS0, yS1)*(xS1 - xS) + S(xS1, yS1)*(xS - xS0).

Then, the sought-for intensity D(xD, yD) is computed by interpolating the intermediate values I0 and I1 along the y-axis:

D(xD, yD) = I0*(yS1 - yS) + I1*(yS - yS0).

To use the linear interpolation, set the interpolation parameter to IPPI_INTER_LINEAR or use the functions with the Linear suffix (pass interpolation=ippLinear to GetSize functions). For images with 8-bit unsigned color channels, the ippiWarpAffine and ippiResizeLinear functions compute the coordinates (xS, yS) with the accuracy 2-16 = 1/65536. For images with 16-bit unsigned color channels, these functions compute the coordinates with floating-point precision.

Linear Interpolation