One theme in this class is that we can extend the physical limitations of cameras with computational techniques. In this project, you'll extend the field of view of a camera by forming a mosaic from multiple photographs.
When taken from a single viewpoint where there is no parallax between images, two overlapping images can be aligned using a homography. To estimate the homography, you'll need 4 pairs of corresponding points in the overlap region. You'll find them automatically.
The following directory contains the source images for the two examples shown above:
The first image in each example provided is the central image. It's simplest to construct a mosaic from a central image and a set of peripheral images, since we then need to find just one homography for each peripheral image.
Find the SIFT feature points on the images. Use RANSAC to find the homography from each peripheral image to the center image. A RANSAC sample code using sift features is provided to you. Download the sample code here. Run the code "ransac.m" to see the example result. The function "geth" computes the homography. However, the code does not refine the H after it finds all the matches.
Use the central image's coordinate system for the final mosaic. You need to figure out the min and max pixel coordinates when the peripheral images are mapped into the central image's coordinate system. Simply apply your homographies to the peripheral images' corner points to find the extent of the final mosaic.
Now generate a meshgrid of points to cover the mosaic, send these points through each homography in turn, and use interp2 to extract pixel values from the source images. For each input image, this produces an image the size of the final mosaic; map the 4 corners of each peripheral image to the mosaic and use roipoly to obtain a mask for each image before merging them.
Finally, assemble the mosaic from the remapped source images. The simplest method is to sequentially assign masked warped peripheral images and center image to the mosaic. In this way, at each point of the mosaic, the pixel comes from only one source image.
The usual things.