Creating an image mosaic involves combining several images of the same scene. The images should be such that all are shot from the same point of view (keeping the camera in place but rotating it about its optical center) and with overlapping fields of view. We can recover the transformations between each pair of images, which are homographies of the form p' = Hp, if the above constraints are followed.
In order to compute the entries in H, we must select the correspondences between each pair of images. Selecting 4 or more correspondences (points common to the two images) allows us to use least-squares to solve for H. Below, we show how p' = Hp can be rewritten in the form Ah = b to be solved be a least-squares solver.
Solving for h, appending 1, and then reshaping it to a 3x3 matrix gives us the homography H from the set of points (xi',yi') to (xi,yi).
To check that our method of recovering the homographies is correct, we attempt to "rectify" an image. We take an image of a planar surface and warp it so that the plane is frontal-parallel. We define the corresponding set of points (xi,yi) by inferring the frontal-parallel shape of the object.
Finally, we can use homographies to create image mosaics. Below, we compare simply overlaying the images vs. using alpha blending to blend the seams of each pair of images.