How can I rotate an image around a point that is not the origin of the image using MATLAB?

What is the method used to rotate an image around a point that is not the origin of the image using MATLAB?

+3


source to share


3 answers


Two rotations of the same angle are equal up to shear. This way you can simply rotate around the center and then translate the image to place your own center of rotation in its original position.



+4


source


The 'rotate' help says:



ROTATE Rotate objects in a given direction and direction. ROTATE (H, [THETA PHI], ALPHA) rotates objects using the H grips through the ALPHA angle around the axis described by the 2-element direction vector [THETA PHI] (spherical coordinates).
    All angles are in degrees. The handles in H must be children from the same axes.

...

ROTATE (..., ORIGIN) uses the point ORIGIN = [x0, y0, y0] as the center instead of the center of the plot window.

0


source


To rotate around a point other than the start point, you:

  • Translate the point you want to rotate to the origin. For example, if you want to rotate around (3.5), you translate to (-3, -5).
  • Perform your spin.
  • Cancel the original transfer. So in my example you are now translating to (+ 3, + 5).
0


source







All Articles