To find the homography matrix, we have: [wx', wy', w] = [[a,b,c], [d,e,f], [g,h,1]] [x, y, 1]
Which gives us the equations:
ax + by + c = wx'
dx + ey + f = wy'
gx + hy + 1 = w
Since this is a projective transformation and there are 8 unknowns, we need 4 points to create the 8 equations. Solve for the homographic matrix using least squares regression.
Apply homography to the first image to warp to the coordinates of the second image.
Warped Image1
Check if homography calculations are correct by rectifying images. The Normandy Village building is rectified so that the top-right window
is frontal-parallel. The Reading Room image is rectified so that the left windows should be frontal parallel (I think my coordinate calculations
were a bit off for this one).
Source Images
Warped Images
Resulting Mosaic