access pixel data allocated by IppiMalloc?

access pixel data allocated by IppiMalloc?

Is there anyone can tell me that how can I access the pixel data allocated by IppiMalloc.
I just wondering how to use the pStepBytes variable returned by IppiMalloc. If I just want to access a pixel, can I use pStepBytes as the width of the 2d array.
actually, I need to get the max value from a matrix. how should I do that? I attach some codes to illustrate my doubt.

int nImageSqureStep;
float* pImageSquare = ippiMalloc_32f_C1(szImage.width,szImage.height,&nImageSqureStep);

How should I get access the pixel of pImageSqaure , for example
for (int row=0;row {
for (int col=0;col {
if (pImageSquare[row*nImageSqureStep+col]<)

it tell me wrong when it was executed and I gurantee that other part code is correct. So I think the problem is how to acess the pixel. and how to use the width is a problem.

Is there any other good way to get max value from the pImageSquare Array?


4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I just fix that with

But I am still wondering about the correctness of the above access.
will it bring correct result? nImageSquareStep is larger than the true width of the pImageSquare image?

Is there anyone who can help me with that problem?Thanks.

How to access the pixel in IPP

float max = *pImageSquare;

float *pTmp;

for ( int row = 0; row < szImage.height; row++ ) {

pTmp = (float *)( (char *)pImageSquare + nImageSquareStep * row );

for ( int col = 0; col < szImage.width; col++ ) {

if ( pTmp[col] > max ) max = pTmp[col];



but better

float max;

ippiMax_32f_C1R( [ImageSquare, nImageSquareStep, szImage, &max );

Leave a Comment

Please sign in to add a comment. Not a member? Join today