Project 6 - Image Warping and Mosaicing

# Overview.

The goal of this assignment is to get your hands dirty in different aspects of image warping with a “cool” application -- image mosaicing. The process involves taking two or more photographs and creating an image mosaic by registering, projective warping, resampling, and compositing them. Along the way, you will learn how to compute homographies, and how to use them to warp images.

The steps include:

1. The steps of the assignment are:

1. Shoot and digitize pictures

2. Recover homographies

3. Warp the images [produce at least two examples of rectified images]

4. Blend images into a mosaic

5. optional Bells and Whistles

# Recover Homographies

This first step is achieved by choosing 4 corresponding points on each image as the homography matrix needs at least fout points to be solved.

The homographic vector is achieved by solving this linear equation:

After plugging the 4 points into the `matrix, numpy.linalg.lstsq(A, b)` can be used to solve for the vector h which includes 8 elements. Vector h is then shaped into a 3x3 matrix with the very last element (scaling factor) as 1.

# Rectification

The Homography matrix is then used to transform any points to the shape of interest. This is especially useful in image recovering where the parts are hard to see or recognize.

By choosing the portion I want to see, and then choosing the destination shape of rectangle, the results are shown below.

# Mosaicing

After the homography matrices are found, each for every single image in the previous step by shaping all other images towards the central one, function `skimage.transform.warp(image, inverse_homo_matrix)` is used to warp the images accordingly so the pre-selected points line up with each other.

Below are some demonstrations:

# What I Have Learned

The project taught me how a simple idea like the homography matrix can be a game changer in many aspects such as image recovering and panoramic photography. Just by a few clicks we can see patterns that were almost impossible to recognize in Renaissance paintings or even recover a crime scene from some tricky camera angles. The matrix makes the transformation from one picture to another become much easier and hence the stiching process enables us to capture a wide angle of scences which human eyes can never capture. Part 2 of the project should optimize and enhance the precision of points recognition and make the parnoramic images more seamless.