Recover Affine Transform
Using control points from 2 images
--
Recently, I wrote code for the following:
Allow the user to mark n corresponding points on two images and recover the best affine transform using these control points.
Functions
click_event
It basically stores the coordinates of points clicked by the user for the first image.
click_event2
It basically stores the coordinates of points clicked by the user for the second image.
After getting the coordinates, X = np.dot(np.inv(A),B) is performed to get the required six values, followed by applying the recovered matrix to the original image.
Transformations
I have tested 3 transformations namely rotation, translation and scaling.
The sequence of output images is as follows:
1. original input image.
2. transformed input image.
3. output of applying recovered matrix using corresponding points on the original input image.
Rotation
Translation
Scaling
Code can be accessed using this repository.