- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to flip the following buffer upside down. See example source and destination.
source (src):
01 02 03
04 05 06
07 08 09
destination (dst - correct):
07 08 09
04 05 06
01 02 03
The following sample does not rotate the buffer correctly. What am I doing wrong?
unsigned char src [9] = {1,2,3,4,5,6,7,8,9};
IppiSize size = {3,3};
IppiRect roi = {0,0,3,3};
unsigned char dst [9];
int step = 3;
IppStatus status = ippiRotate_8u_C1R(src, size, step, roi, dst, step, roi, 90, 0, 0, IPPI_INTER_LINEAR);
destination (dst - wrong):
01 04 07
00 00 00
00 58 C3
source (src):
01 02 03
04 05 06
07 08 09
destination (dst - correct):
07 08 09
04 05 06
01 02 03
The following sample does not rotate the buffer correctly. What am I doing wrong?
unsigned char src [9] = {1,2,3,4,5,6,7,8,9};
IppiSize size = {3,3};
IppiRect roi = {0,0,3,3};
unsigned char dst [9];
int step = 3;
IppStatus status = ippiRotate_8u_C1R(src, size, step, roi, dst, step, roi, 90, 0, 0, IPPI_INTER_LINEAR);
destination (dst - wrong):
01 04 07
00 00 00
00 58 C3
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
What you want to do is not a rotation. As you said, it's a flip. For this, use the ippiMirror function.
Best Regards,
Matthieu
What you want to do is not a rotation. As you said, it's a flip. For this, use the ippiMirror function.
Best Regards,
Matthieu
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
What you want to do is not a rotation. As you said, it's a flip. For this, use the ippiMirror function.
Best Regards,
Matthieu
What you want to do is not a rotation. As you said, it's a flip. For this, use the ippiMirror function.
Best Regards,
Matthieu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - matthieu.darbois
Hi,
What you want to do is not a rotation. As you said, it's a flip. For this, use the ippiMirror function.
Best Regards,
What you want to do is not a rotation. As you said, it's a flip. For this, use the ippiMirror function.
Best Regards,
For this partically case ( angle == 90) - yes, the Mirror function is the best choise,
but for arbitrary cases - first of all call ippiAddRotateShift(,,,,,) for computing shift values of an images... .
The function helps compute shift values xShift, yShift that should be passed to ippiRotate function for the rotation around (xCenter, yCenter) to take place.
For your cases, it seems to me that shiftY == 2 ...
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead of flipping your buffer, you should just process it backwards (in-place) for better performance.
Suppose you have 500x400 with step/pitch of 512, you should call IPP functions with the following :
pSrc = pBuffer + (height - 1) * step = pBuffer + 399 * 512;
srcRoi = { 500, 400 };
srcStep = -step = -512;
IPP will view the last row as the first, and jump by -512 pixels after every row.
Suppose you have 500x400 with step/pitch of 512, you should call IPP functions with the following :
pSrc = pBuffer + (height - 1) * step = pBuffer + 399 * 512;
srcRoi = { 500, 400 };
srcStep = -step = -512;
IPP will view the last row as the first, and jump by -512 pixels after every row.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page