Ask Your Question

How does rotation in OpenCV work

asked 2012-10-28 17:57:37 -0600

dzvrt gravatar image

updated 2012-10-28 17:58:09 -0600

How does rotation in OpenCV work? I have a ROI in the image that I would like to rotate for a certain angle, and I move it to the top left corner of the image as a center of rotation. Then I move ROI back to the old position to see its new position. But the result I get is ROI under some strange angle. Can someone explain me how the rotation works?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-10-29 03:13:09 -0600

Kirill Kornyakov gravatar image

Are you familiar with these functions:

  1. getRotationMatrix2D
  2. getAffineTransform
  3. Find more about geometric transformations

And this tutorial: Affine Transformations?

I hope this stuff will help you.

edit flag offensive delete link more


I am familiar with them, but the problem is that I have an object on the image (my ROI) that I want to rotate. If I rotate the image using the above mentioned functions, the object on the rotated image is rotated as well for some strange angle, and not the desired one. This happens because because I'm rotating the image, but how can I achieve to rotate the object for a specific angle? I guess not by rotating the entire image?

dzvrt gravatar imagedzvrt ( 2012-10-29 12:18:53 -0600 )edit

Question Tools


Asked: 2012-10-28 17:57:37 -0600

Seen: 823 times

Last updated: Oct 29 '12