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

Rotate an image

metalmickey
초급자
877 조회수
Hi
I'm trying to rotate a bitmap by 90 degrees, but cannot seem to manage it. My bitmap is 200 * 100 24 bit. In particular it is the roi mapping that I am having difficulty with, I can get 180 degrees to work, but 90 degrees results in a cropped image. Can anyone point me in the right direction, preferably with a code snippet.

Thanks
Chris
0 포인트
3 응답
barehill
초급자
877 조회수
Chris,
Since you have a rectangular image (200x100) the rotation of 90 degrees will crop the image as ithas to since its trying to put 200 pixels in the vertical 100 pixel direction. If you rotate the full 180 then the (upside down) rectangle fits without cropping. To avoid cropping therefore you will need to create a new image and copy the rotated image to it. The new image can be 200 w x 100 h to avoid cropping or 200 x 200 if you don't mind black sides.
Rick
0 포인트
Vladimir_Dudnik
877 조회수
Hi,
there is a piece of code to demonstrate

#define Width 200
#define Height 100

Ipp8u src[Width * Height * 3];
Ipp8u dst[Height * Width * 3];
int srcStep = Width * 3;
int dstStep = Height * 3;
IppiRect srcROI = {0,0, Width, Height};
IppiSize srcSize = {Width, Height};
IppiSize dstROI = {0, 0, Height, Width};

ippiRotate_8u_C1R(src, srcSize, srcStep, srcROI, dst, dstStep, dstROI, 90, 0, Height - 1, IPPI_INTER_NN);

And of course, you cam use ippiMirror function if you need only 90/180/and so on rotation

Regards,
Vladimir

0 포인트
metalmickey
초급자
877 조회수
Thank you, got my head around it now.
0 포인트
응답