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

iplRotate and Rotate_Image

ram200200
Beginner
478 Views

Hi

I am trying to use a Rotate_Image function , which uses the iplRotate function.

However, it seems that iplRotate consumes memory that can't be freed later, when

the function finishes. (iplDeallocate doesn't help either).

1)Do you have an advanced iplRotatetate without that problem?

2)Do you have an Rotate_Image image function which enables the

interpulations options:

IPL_INTER_LINEAR IPL_INTER_NN IPL_INTER_CUBIC

but frees all its used memory when it ends?

Thanks,

Dan

0 Kudos
7 Replies
Rob_Ottenhoff
New Contributor I
478 Views
Quoting - ram200200

Hi

I am trying to use a Rotate_Image function , which uses the iplRotate function.

However, it seems that iplRotate consumes memory that can't be freed later, when

the function finishes. (iplDeallocate doesn't help either).

1)Do you have an advanced iplRotatetate without that problem?

2)Do you have an Rotate_Image image function which enables the

interpulations options:

IPL_INTER_LINEAR IPL_INTER_NN IPL_INTER_CUBIC

but frees all its used memory when it ends?

Thanks,

Dan

Hi Dan,

I don't know the Rotate_Image and iplRotate functions, but I have never experienced any problems with using ippiRotate directly. Perhaps you can check the implementations of Rotate_Image and iplRotate ?

Sorry if this doesn't help.

Regards,

Rob

0 Kudos
ram200200
Beginner
478 Views
Quoting - Rob Ottenhoff

Hi Dan,

I don't know the Rotate_Image and iplRotate functions, but I have never experienced any problems with using ippiRotate directly. Perhaps you can check the implementations of Rotate_Image and iplRotate ?

Sorry if this doesn't help.

Regards,

Rob

Dear Rob

I have tried to rotate an Input_Xsize*Input_Ysize unsigned image, without any ROI .

However, I receive a blank image (in Output_Data).

1)Can you tell me why?

2)Should stride be Input_Xsize or 1?

Thanks, Dan

ippiGetRotateShift(xcenter, ycenter, (double)angle, &xshift, &yshift);

// IppiRect srcROI,dstROI;
srcROI.x=srcROI.y=dstROI.x=dstROI.y=0;
srcROI.width=dstROI.width=Input_Xsize;
srcROI.height=dstROI.height=Input_Ysize;
//IppiSize srcSize,dstSize;
srcSize.width=dstSIZE.width=Input_Xsize;
srcSize.height=dstSIZE.height=Input_Ysize;


ippiRotate_8u_C1R(Input_Data, srcSize,
Input_Xsize, srcROI,
Output_Data, Input_Xsize, dstROI,
(double)angle, (double)xshift+dx, (double)yshift+dy, interpolate);

0 Kudos
Rob_Ottenhoff
New Contributor I
478 Views
Quoting - ram200200

Dear Rob

I have tried to rotate an Input_Xsize*Input_Ysize unsigned image, without any ROI .

However, I receive a blank image (in Output_Data).

1)Can you tell me why?

2)Should stride be Input_Xsize or 1?

Thanks, Dan

ippiGetRotateShift(xcenter, ycenter, (double)angle, &xshift, &yshift);

// IppiRect srcROI,dstROI;
srcROI.x=srcROI.y=dstROI.x=dstROI.y=0;
srcROI.width=dstROI.width=Input_Xsize;
srcROI.height=dstROI.height=Input_Ysize;
//IppiSize srcSize,dstSize;
srcSize.width=dstSIZE.width=Input_Xsize;
srcSize.height=dstSIZE.height=Input_Ysize;


ippiRotate_8u_C1R(Input_Data, srcSize,
Input_Xsize, srcROI,
Output_Data, Input_Xsize, dstROI,
(double)angle, (double)xshift+dx, (double)yshift+dy, interpolate);

Hoi Dan,

I cannot see anything obvious. Some points: you should use the stepsize as stride. Not the width of the images. The stepsize is returned when you create your image. And are you sure the xcenter, ycenter, dx,dy variables are correct ? Here is the code that works for me : it rotates an image around its centerpoint:

.. part of a wrapper class::Rotate(angle, pDest)

{ // I left out some details to handle the case when the source and dest do not have the same resolution

IppiSize roiSize = { GetWidth(), GetHeight() };

IppiRect roiRectSrc = { 0, 0, GetWidth(), GetHeight() };

IppiRect destRect = { 0, 0, pDest->GetWidth(), pDest->GetHeight() };

double xShift, yShift;
ippiGetRotateShift(GetWidth()/2, GetHeight()/2, angle, &xShift, &yShift);

ippiRotate_8u_C1R(m_pImageBuffer, roiSize, m_StepSize, roiRectSrc,
pDest->m_pImageBuffer, pDest->m_StepSize, destRect,
angle, xShift, yShift, IPPI_INTER_CUBIC | IPPI_SMOOTH_EDGE);
}

Hope this helps,

Rob

0 Kudos
ram200200
Beginner
478 Views
Quoting - Rob Ottenhoff

Hoi Dan,

I cannot see anything obvious. Some points: you should use the stepsize as stride. Not the width of the images. The stepsize is returned when you create your image. And are you sure the xcenter, ycenter, dx,dy variables are correct ? Here is the code that works for me : it rotates an image around its centerpoint:

.. part of a wrapper class::Rotate(angle, pDest)

{ // I left out some details to handle the case when the source and dest do not have the same resolution

IppiSize roiSize = { GetWidth(), GetHeight() };

IppiRect roiRectSrc = { 0, 0, GetWidth(), GetHeight() };

IppiRect destRect = { 0, 0, pDest->GetWidth(), pDest->GetHeight() };

double xShift, yShift;
ippiGetRotateShift(GetWidth()/2, GetHeight()/2, angle, &xShift, &yShift);

ippiRotate_8u_C1R(m_pImageBuffer, roiSize, m_StepSize, roiRectSrc,
pDest->m_pImageBuffer, pDest->m_StepSize, destRect,
angle, xShift, yShift, IPPI_INTER_CUBIC | IPPI_SMOOTH_EDGE);
}

Hope this helps,

Rob

Hi Rob

Thanks for your efforts. I found the reason of the error-

Although the stride should have been the Image_SizeX as I thought, my interp value was yielded from the IPL system,

and I simply had to change it to the IPPI constants.

BTW -

Is there a way to avoid the need of adding all the IPPI dlls to wherever I want toput my executable code?

(even at different computers, without the IPPI on them)

all the best

Dan

0 Kudos
Rob_Ottenhoff
New Contributor I
478 Views
Quoting - ram200200

BTW -

Is there a way to avoid the need of adding all the IPPI dlls to wherever I want toput my executable code?

(even at different computers, without the IPPI on them)

all the best

Dan

Hi Dan,

There is a redistributable installer in [IPPDIR]toolsruntimeinstaller

Rob

0 Kudos
ram200200
Beginner
478 Views
Quoting - Rob Ottenhoff

Hi Dan,

There is a redistributable installer in [IPPDIR]toolsruntimeinstaller

Rob


Thanks Rob.

Can you briefly direct me how to use it, or where should I lear about it

(I will use only the ippiRotate_8u_C1R function)

Thanks,

Dan

0 Kudos
Rob_Ottenhoff
New Contributor I
478 Views
Quoting - ram200200


Thanks Rob.

Can you briefly direct me how to use it, or where should I lear about it

(I will use only the ippiRotate_8u_C1R function)

Thanks,

Dan

Hi Dan,

The runtime installer has a readme file.

Regards,

Rob

0 Kudos
Reply