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

Rotating a buffer with ippiRotate_

reportbase
ビギナー
1,183件の閲覧回数
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
0 件の賞賛
1 解決策
matthieu_darbois
新規コントリビューター III
1,183件の閲覧回数
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

元の投稿で解決策を見る

3 返答(返信)
matthieu_darbois
新規コントリビューター III
1,184件の閲覧回数
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

Gennady_F_Intel
モデレーター
1,183件の閲覧回数
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,
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



oxydius
新規コントリビューター I
1,183件の閲覧回数
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.
返信