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

ippiResize_8u_C3R with ROI

davuluri
Beginner
858 Views

Hello,

Iam resizing RGB image by using ippiResize_8u_C3R(). It is working fine, if I resize the whole image.
Butwhenever I try to resize a particular rect from the source image and fill into the destination buffer, theresized rectposition is getting shifting some how. Hereis my function implementation.

bool CReUtils::IPPResizeRGB24(CXMYArray& a_arrInputBuffer,

int a_iSrcWidth, int a_iSrcHeight,

CXMYArray& a_arrOutputBuffer,

int a_iDstWidth, int a_iDstHeight)

{

IppiSize srcSize = { a_iSrcWidth, a_iSrcHeight };

IppiRect srcROI;

srcROI.x = 100 ;

srcROI.y = 100;

srcROI.width = 300;

srcROI.height = 200;

IppiSize dstSize = { a_iDstWidth, a_iDstHeight };

IppStatus status;

double xFactor = (double)a_iDstWidth/(double)a_iSrcWidth;

double yFactor = (double)a_iDstHeight/(double)a_iSrcHeight;

int xFactor_For_BufferOffset = (int)(xFactor * (srcROI.x)) ;

int yFactor_For_BufferOffset = (int)(yFactor * (srcROI.y));

status = ippiResize_8u_C3R(a_arrInputBuffer.getUnsafeArrayPtr(), srcSize, srcSize.width*3, srcROI,

a_arrOutputBuffer.getUnsafeArrayPtr() + (((dstSize.width * 3) * (yFactor_For_BufferOffset)) + (xFactor_For_BufferOffset * 3)),

dstSize.width*3, dstSize, xFactor, yFactor, IPPI_INTER_LINEAR);

return (ippStsNoErr == status) ? true : false;

}

Can someone help me ragarding this??

Am I using the proper function for this purpose??
Am Imissing anything while using thisippiResize_8u_C3R()??

Thanks in advance,
Davuluri.

0 Kudos
1 Reply
pvonkaenel
New Contributor III
858 Views
Hi Davuluri,

I have a couple of suggestions for you:

1) Try using ippiResizeSqrPixel instead of ippiResize - I think the later is deprecated. I use ippiResizeSqrPixel to resize ROIs without problem.

2) Instead of using an actual ROI (x, y), what I tend to do is set the starting pointer to the pixel I'm interested in and properly specify the step size to be the width of the original image. Then you can specify the ROI (x, y) as (0, 0).

Peter
0 Kudos
Reply