- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
링크가 복사됨
3 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
