Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Precision of linear interpolation

dan_fischer
Beginner
180 Views

Hi,

I am using the functionippiResize to increase the image size in each direction by a factor two. The interpolation method is linear interpolation.

Because the resizing factor is "2", I would expect that the pixel value f_in( x_in , y_in ) in the input image is equal tothe pixelvaluef_out ( 2*x_in , 2* y_in ) in the output image. E.g. something like that:

Input846

Output86456

Unfortunately it is not exactly the same. Because the error is getting worse at the end of the image, Isuspect that the sampling rate is not exactly "2". I attached an example (raw image, 16bit signed).

Here is my code. MaybeI am doing somthing wrong

// resize factors

int InWidth=500;
int InHeight=500;
int OutWidth=1000;
int OutHeight=1000;

double fx = 2.0f;
double fy = 2.0f;

IppiSize s = {InWidth, InHeight};
IppiRect sr = {0,0, InWidth, InHeight};
IppiSize d = {OutWidth, OutHeight};

// resize
IppStatus res=
ippiResize_16u_C1R( pInput,
s,
InWidth*sizeof( short ),
sr,
pOutput,
OutWidth*sizeof( short ),
d,
fx,
fy,
IPPI_INTER_LINEAR);

Thanks

Daniel

0 Kudos
1 Reply
Vladimir_Dudnik
Employee
180 Views

Hello,

you need to replace call of ippiResize with call of new function, ippiResizeSqrPixel

Regards,
Vladimir

0 Kudos
Reply