How to rotate an image about a point that is not the image's center point using MATLAB?

一笑奈何 提交于 2020-01-13 17:03:28

问题


What is the method to use to rotate an image about a point that is not the image's center point using MATLAB?


回答1:


Two rotations of the same angle are equal up to a translation. So you can just do rotation around the center, and then translate the image to put your own center of rotation at its old position.




回答2:


The help to 'rotate' says:

ROTATE Rotate objects about specified origin and direction. ROTATE(H,[THETA PHI],ALPHA) rotates the objects with handles H through angle ALPHA about an axis described by the 2-element direction vector [THETA PHI] (spherical coordinates).
All the angles are in degrees. The handles in H must be children of the same axes.

...

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




回答3:


To rotate about a point other than the origin you:

  1. Translate the point you want to rotate around to the origin. For example, if you want to rotate around (3,5), you would translate by (-3,-5).
  2. Perform your rotation.
  3. Undo the initial translation. So in my example you would now translate by (+3,+5).


来源:https://stackoverflow.com/questions/10026905/how-to-rotate-an-image-about-a-point-that-is-not-the-images-center-point-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!