# CS 194 Project 6: Image Warping and Mosaicing

#### Michelle Ling

##### cs194-26-abk

In this project, we examine how to create a mosaic - or stitch multiple photos together into one picture. This project will involve taking two photographs and create a mosaic by registering, projective warping, resampling and compositing the pictures. In order to do this, we will compute homographies and use them to warp the images to allow for the mosaic to be created.

#### Part 1: Image Rectification

We begin the project by first taking images and rectifying them into a different plane. By doing so we manipulate the images such that it looks as though we are viewing them from a different perspective. We will pick at least four points on the image and match these points with those of a shape that we want these points to look like in the new perspective. After we have these pairs, we want to calculate the parameters of the homography which we will use to transform the image. where p' = H * p. This homography has 8 degrees of freedom which we simpliy into 7 by setting the scaling factor, w, to be 1. We then solve for these 7 unknowns using the 4 pairs of points we defined. We want to solve the H matrix as seen below:

H is the homography, (x, y) are the points on the image that will be warped and the (x', y') are points that we want to warp (x, y) to. w in this case is the scaling factor. We want to solve for a, b, c, d, e, f, g, h in the below matrix. We want to use multiple points to increase the accuracy of the warp and transformation. We plug in these values into our H matrix and use this matrix with inverse warping to map the coordinates p of the image to its p' in the warped image.

Below are rectified images that so that they are front parallel.

#### Part 2: Mosaic Blending

This portion of the project involved using the warp homography transformation that was found in part one in order to warp images with overlap together to create mosaics. By warping these images with the projective transformation so that they are all on the same plane and then stitching these photos all together we create a photo that is able to show much more than a single picture alone. I picked one of my images to be a photo that remained unwarped and then rectified the other photo to match this first one. The points chosen were that of the same object / features in the overlap between the two pictures. These points were used to create the homography and then inverse warping was applied to create the warped image. I ultimately used two different methods to blend, neither gave perfect results. One resulted in faint overlaps/ misalignments while the other with Laplacian blending gave a noticeable seam.

#### Summary

I think the most important thing I learned from this project is that images can be transformed and manipulated in so many different ways. The data that is represented and captured in an image is not static and the fact that one can transform and change the perspective on an image such that it looks like a completely new image is amazing to me.