Project 5: Auto-Stitching Photo Mosaics

Omkar Waingankar - Spring 2020

Overview

In this project, I leveraged my understandings of homographies, transforms, etc. to stitch together many images to create larger composite photographs, similar to the panorama features enabled on many smartphones and apps such as CamScanner today.

Part 1: Image Warping & Mosaicing

In this part of the project, I was responsible for collecting a few images from which to construct my mosaics / rectifications, marking correspondences myself, computing the homographies between photos, and ultimately using those linear transforms & stitching techniques to rectify images and produce mosaics.

Shoot The Pictures

The first part of this programming assignment was simply to take pictures of the images I would eventually use to rectify / test my warping code and to also generate / stitch my final mosaics.

Book (for Rectification)

Map (for Rectification)

Recover Homographies

The second part was to then use CPSELECT to mark correspondences on my original images, and compute the homographies / projective transforms between each of the related sets of images. Since I had more correspondences / sample points than actual variables I need to solve for, I had produced an overconstrainted problem, and was thus able to use least squares to solve for this matrix to minimize the noise resulting from my measurements. The form of the homography matrix is depicted below, and I was able to test its accuracy by comparing it with the homography matrix computed by OpenCV.

Image Rectification

The next part in this project was to use the homography matrix, H, we computed in the previous part to correct the orientations of some objects that we took at an askew angle (pictured below). My process was to first perform a forward warp on the corners of the askew image to the rectified space / plane to draw a bounding box around the final output, and then to translate and perform an inverse warp on all the pixel coordinates inside the transformed corners (using polygon) to extract the appropriate RGB values from the original image's pixels.

Original Book

Rectified Book

Original Map

Rectified Map