Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

ResizeSqrPixel, linear interpolation

Alexey_K_1
Beginner
631 Views

<p>Hello, I'm trying to magnify image with linear interpolation and I get strange results with ResizeSqrPixel.

Eg., transformation of 2x2 to 3x3 (just inset one column and one row) works as expected:

source:

 0.0 10.0

10.0 0.0

destination:

0.0 5.0 10.0

5.0 5.0 5.0

10.0 5.0 0.0

But I get unexpected result with

Source w=3 h= 3

0: 0.0 10.0 0.0

1: 10.0 0.0 10.0

2: 0.0 10.0 0.0

Destinationw=5 h= 5

0: 0.0 4.0 10.0 4.0 0.0

1: 4.0 4.8 6.0 4.8 4.0

2: 10.0 6.0 0.0 6.0 10.0

3: 4.0 4.8 6.0 4.8 4.0

4: 0.0 4.0 10.0 4.0 0.0

IPP version 6.1, code:

int w1, w2, h1, h2;

w1=3; h1=3;

Ipp32f src[3*3] = {0, 10, 0, 10, 0, 10, 0, 10, 0};

// w1=2; h1=2; // Ipp32f src[2*2] = {0, 10, 10, 0};

w2 = 2*w1-1;

h2 = 2*h1-1;

Ipp32f dst[w2*h2];

double dx=double(w2)/double(w1);

double dy=double(h2)/double(h1);

IppiRect srcRect={0,0,w1,h1};

IppiRect dstRect={0,0,w2,h2};

Ipp8u *buf = NULL;

int bufsize; ippiResizeGetBufSize( srcRect, dstRect, 1, IPPI_INTER_LINEAR, &bufsize );

IppiSize srcSize = {w1,h1};

IppiSize dstSize = {w2,h2};

int srcStep = srcSize.width*sizeof(Ipp32f);

int dstStep = dstSize.width*sizeof(Ipp32f);

buf = ippsMalloc_8u( bufsize );

if(buf != NULL) ippiResizeSqrPixel_32f_C1R(src, srcSize, srcStep, srcRect, dst, dstStep, dstRect,dx,dy, 0, 0, IPPI_INTER_LINEAR, buf);

if(buf != NULL) ippsFree( buf );

0 Kudos
1 Reply
Alexey_K_1
Beginner
631 Views
deleted
0 Kudos
Reply