Lecture 4: Transforms (36)
ninjab3381

I found the following function on openCV in Python that lets you rotate an image about any arbitrary point so that you don't have to compose different matrices as seen in the slide. it can be seen in this link: https://www.geeksforgeeks.org/python-opencv-getrotationmatrix2d-function/ it also has scaling functionality built in [cos theta, sin theta, (1-cos theta)cx - (sin theta)cy] [-sin theta, cos theta (sin theta)cx + (1-cos theta)cy]

the (1-cos theta)cx part is worth looking into. the 1 "shifts the origin" while the -cx cos theta will subtracted from the x cos theta term to to get how much it rotates. tough to explain without drawing it out!

litony396

I think that a good way to remember this step-by-step process is that you're just translating to pretend that point c is the origin, rotating around the new origin (point c), and then translating again so your origin is at (0,0) again.

yangbright-2001

It is important to know that transformation should be written from right to left. For example, the Translation process T(-c) happens first, then it should be written in the rightmost position of the final matrix. I think I should have learned this in linear algebra

AnikethPrasad

@ninjab3381 Thanks for this article! I found it interesting during lecture that we need to break down a seemingly simple transformation into multiple steps. Nice to see that there are in fact alternative ways to achieve the same result.

You must be enrolled in the course to comment