I'm having trouble getting an image to rotate in some code I'm working on. This is the problem I'm having:
1. I have a source image. It has a size (w, h) which is not necessarily square.
2. It is going to be rotated by angle a.
3. I've calculated the output size required to fit an image of size (w, h) rotated by angle a using a bit 'o trig. This size is (dw, dh), and I can verify on paper it is being computed correctly.
I cannot get ippiRotate to center the rotated image in the destination image. It's always off center.
My best guess for what xShift and yShift should be is the following:
xShift = (dw / 2.0) - (w / 2.0)
yShift = (dh / 2.0) - (h / 2.0)
But this doesn't work, and I'm not sure what else to do to calculate xShift and yShift.I've attempted to use ippiGetRotateShift to calculate xShift and yShift, again, to no avail.
I originally tried this, thinking that it would center my rotated image in the destination image:
ippiGetRotateShift(dw / 2.0, dh / 2.0, a, &xShift, &yShift);
But it doesn't it's very much off center. If I do this:
ippiGetRotateShift(w / 2.0, h / 2.0, a, &xShift, &yShift);
It's not as off center, but it's still off.
I'm at the end of my rope here, I need to get this working ASAP, I'd really appreciate any help I can get.