Calculate point coordinates after image rotation

243 Views Asked by At

So I have two rectangle pictures with known Resolution

On the first image we have a point on $(900, 300)$ $x,y$ pixel coordinate (guessed number, not exactly).

The second picture is rotated by $15^\circ$. Width and Hight of this picture is increased, because its rotated $15^\circ$.

Is there a way to calculate the same point position on the 2nd image with the known information? If yes, how?

1

There are 1 best solutions below

2
On BEST ANSWER

Because we are rotating about the center of the image, we will use that as our origin. The relative coordinates of the unrotated point are $(900, 300) - (600, 315) = (300, -15)$. Since we are rotating the point clockwise, we can use the rotation matrix

$$\begin{pmatrix} \cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{pmatrix}$$

as the transformation matrix. Note that $(1, 0)$ gets transformed to $(\cos \theta, -\sin \theta)$ as expected. Here, $\theta = 15^\circ$. So, the image is

$$\begin{pmatrix} \cos (15^\circ) & \sin (15^\circ) \\ -\sin (15^\circ) & \cos (15^\circ) \end{pmatrix} \begin{pmatrix} 300 \\ -15 \end{pmatrix} \approx \begin{pmatrix} 294 \\ -74 \end{pmatrix}$$

when rounded to the nearest integers. Relative to the original origin, the coordinates of the image are about $(600, 315) + (294, -74) = \boxed{(894, 241)}$.

EDIT: Update with new information.

It was given that the coordinates of the (untransformed) center relative to the lower-left of the new image are $(661, 440)$. So, relative to the lower-left of the new image, the point is at $(661, 440) + (294, -74) = \boxed{(955, 366)}$.