CS 194-26: Computational Photography, Fall 2020

Project 5: Image Warping and Mosaicing

Michelle Fong, CS194-26-ael



Overview

In this project, I am using various computation photography techniques as discussed in lecture in order to stitch together two images of the same scene but taken from different angles. The first part of this project involves computing the homography matrix based off of two sets of correspondence points, warping the images and doing image rectification, and finally blending the images into a mosaic.

Part 1: Shoot the Pictures

Since it is in the middle of the COVID-19 pandemic, instead of exciting outdoor locations I have opted to take pictures of my Berkeley apartment. As described in the spec, I used the AE/AF lock to ensure that my camera settings stayed stagnant between shots, as well as made sure that there was a decent amount of overlap between the pictures. Here are some example pictures below:

My room
My room 2
Living room
Living room 2
Dining area
Dining area 2

Part 2: Recover Homographies

I then wrote the computeH function to construct the homography from two sets of correspondence points. I used Stack Overflow to get the correct rows for my matrix A, which has two rows corresponding to each pair of correspondence points, for a size of 8 x 8 for 4 correspondence points. I also constructed the vector b from the second set of correspondence points, for a size of 8 x 1. I then did least squares on A and b to solve for our homography matrix H (reshaped to 3 x 3).

I tested my computeH function using correspondence points on a picture of my laptop.

Laptop
Corr pts for monitor
Corr pts to warp to
Resulting warp

Part 3: Warp the Images / Part 4: Image Rectification

I am still working on this part. My approach is similar to the methods that we used in Project 3 except here I decided to use forward warping instead of inverse warping. I use a mask defined by the warped bounding box of the original image as my base image. I then call polygon() on these warped corners and use scipy interpolate function on each of the color channels to warp my image. Unfortunately, I am still working to debug the output. Below is what I have currently, with same padding to account for shape error.

Current rectification output