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

ResizeSqrPixel

elevenmice
Beginner
448 Views
Hi guys,

I've tried to use ippiResize to resize an image but no matter what interpolation mode i use, the quality is bad, really bad. So I was looking at the archieves in the forum and I saw ippiResizeSqrPixel. I've tried using it, but my application keeps crashing because of and untraceable heap corruption. Below is my code. Am i missing anything?

IppStatus status1, status2;
IppiSize inSize = { bmWidth, bmHeight };
IppiRect inRect = { 0, 0, bmWidth, bmHeight };
IppiSize outSize = { width, height };
IppiRect outRect = { 0, 0, width, height };

double xFactor = width / (double)bmWidth;
double yFactor = height / (double)bmHeight;
double xShift = 0.0;
double yShift = 0.0;
int nChannel = 4;
int* pBufferSize = new int;

status1 = ippiResizeSqrPixelGetBufSize( outSize, nChannel, IPPI_INTER_NN, pBufferSize );

// status1 == ippStsNoErr

status2 = ippiResizeSqrPixel_8u_C4R( ippBm, //contains the input buffer
inSize,
bmWidth * 4,
inRect,
ippOut, //contains the output buffer.
width * 4,
outRect,
&nbs p; xFactor,
yFactor,
xShift,
yShift,
IPPI_INTER_NN,
(Ipp8u*)pBufferSize
);

// status2 == ippStsNoErr


One funny thing. ippiResizeSqrPixelGetBufSize asks for an int pointer to get the buffer size. But ippiResizeSqrPixel requests and Ipp8u pointer as input. Isnt data being lost here. Cos my buffer size is somewhere around 2000 and if I cast it to a one byte buffer, am I not losing data here?

My input image is 400 x 300 and I want my output image to be 320 x 240.


If i comment out the ipp function, my app doesnt crash. Else it does. Please help :(

-chetan
0 Kudos
1 Reply
elevenmice
Beginner
448 Views
Hi Nikolay,

that solves the issue.

tnx. :)

-chetan
0 Kudos
Reply