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

How to access IPP image data ...

discrete_60
Beginner
482 Views
Hi,

I have a very basic question. How do I allocate and access data of an image. I'm failing to see the pStepBytes functionality in allocate functions. I have the following code and I'm having problem.

*******************************************
//Allocate a temp complex image ...
int nStepTempImg (0);
Ipp32fc* pTempImg = r_ippiMalloc_32fc_C1 (nWidth_, nHeight_, &nStepTempImg);

//Now copy the image from input real image into real channel of temp image
int nOutIdx(0), nInIdx(0);
for (int i=0; i < nHeight_; i++)
{
for (int j=0; j < nWidth_; j++)
{
pTempImg[nOutIdx].re = pInImgData[nInIdx];
pTempImg[nOutIdx].im = 0;
nOutIdx ++;
nInIdx++;
}//for (int j=0; j < nWidth; j++)
nOutIdx += nStepTempImg;
nInIdx += nWidthUnwrapped_;
}

*******************************************

Is this how I'm supposed to access the image data ? I've tried other versions too, but I'm getting out of bounds memory access exception. Any help will be much appreciated.

Best,

FAISAL ...
0 Kudos
2 Replies
Vladimir_Dudnik
Employee
482 Views

Hello,

please take a look on IPP Reference Manual, volume 2: Image and Video Processing, Chapter 2 Intel Integrated Performance Primitives Concepts, article Major Operation Models, part Regions of interest in Intel IPP to get a basic understanding what for step parameter is.

You may also find it useful to search through this forum for questions, there is a chance that similar things already have been discussed there.

Look for example, what I was able to catch in a couple minutes:

Resizing image
Definition of plane and step
Remap function
ippiMalloc_32f_C3 Error in steps
Newbie
IPP Newbie

Regards,
Vladimir

0 Kudos
Intel_C_Intel
Employee
482 Views

Hi,

ippiMalloc_ * functions return row step in bytes not in image elements (see doc). So, before the loop you should insert

nStepTempImg/=sizeof(*pTempImg);

Thanks,

Alexander

0 Kudos
Reply