[Auto]Stitching Photo Mosaics: CS194-26 Project 5A

By Muhab Abdelgadir

Introduction

This project is transforming images and then stitching them together. We distort planes to match and then their correspondences are found automatically.

Recover Homographies

To recover the homographies, I had to use the following equations:

stuff stuff

With these equations, they are turned into linear systems that are used given N points

stuff stuff stuff

We are able to solve this in python by calling "numpy.lstsq", which approximates the overdetermined system using the least square method. We only need 4 pairs of points to solve these matrices and use the reverse of the matrix and use inverse warping to reconstruct the image from pixels in the original.

Warping Images

After we have the homographies, we apply transformation matrices to them. This image rectification is essentially the process of transforming these images so that certain planes are warped to a point of view. We select a certain amount of points and make them front parallel.

VIEW: stuff

RECTIFIED VIEW: stuff

VIEW: stuff

RECTIFIED VIEW: stuff

Mosaics

Having these warped images, we thus need to blend them together. By generating a canvas large enough to contain both images, both images will be mapped in the same proposed space. I only set my program to blend in the left to right direction utilizing the alpha blending equation.

RESULTS: stuff stuff

For this one, I wanted to try something different and focused my points of warping on half of the image at a time to see if it can reconstrict the image at the same perspective. By focusing all the points on the man, it almost reconstructed perfectly.

stuff stuff stuff stuff stuff stuff stuff stuff stuff

Some images that hold similar angles, do not need to be rectified, thus hold a lower negative space. Some of them have subtle angle differences, which is what I intended and they came out nicely.

What I learned

The most important part was utilizing the matrices in order to solve for the homography matrices. I also realized that there is so much data in images and it can be easily manipulated which is really cool. This is apparent through image rectification. Understanding how we can assign new perspectives with a few parameters for a given image is something I found to be the most interesting.