# Image Warping and Mosaicing

## Overview

The goal of the project is to implement a cool application of image warping — image mosaicing. By rotating the camera about the center of lens without shifting and taking two or more photographs with slightly overlapping fields of view, we can create an image mosaic by registering, projective warping, resampling and compositing them. I learned about how to compute homographies and how to use them to warp images and create the panorama.

## Recovering Homographies

The homography transformation has the following form where H is a 3x3 matrix with the last element i = 1 and 8 degrees of freedom.

To recover the homography, it can be shown from algebra that the homography can be solved be solving the following linear equation, where the vector h includes the 8 elements and can be reshaped to our homography matrix.

 Robert Collins, CSE486, Penn State

## Image Rectification

One of the application of homography is image rectification. I chose four corners of the input image and forcing them to be parallel in the new image by selecting the corresponding position of the four corners in the new image. After that, I can compute the homography and warp the original image to the new rectified image. The following are examples of image rectification.

 vitamin.jpg piano.jpg fridge.jpg rectified vitamin rectified piano rectified fridge

## Mosaics

Finally for image mosaics, we can take two or more photographs of the same scene with slightly overlapping field of views by rotating the camera about the center of lens without shifting. To achieve the goal, I selected 15 corresponding points between each of the two images and created a blank background with the center image in the middle of the background.

 img1_points img2_points_1 img2_points_2 img3_points

Then, I compute the homography transformation of the left image so that its corresponding points can be matched with the points in the center image. Finally, I find the overlapping area between the two images and created a linear mask to blend the two images together to produce the mosaics.

 Warped image 1 background with image 2

The following are three examples using the techniques mentioned above to create image mosaics.

### Example 1

 original image 1 original image 2 original image 3
 warped image 1 warped image 3
 complete mosaic
 cropped mosaic

### Example 2

 original image 1 original image 2
 warped image 1 complete mosaic
 cropped mosaic

### Example 3

 original image 1 original image 2
 warped image 1 complete mosaic
 cropped mosaic

## Conclusion

The lesson I’ve Iearned from the project is that linear algebra is powerful in solving the transformation matrix and creating different effects of manipulating images. I’ve also noticed the difficulty when manually selecting the correspondence between images and I’m excited for the next part of the project for automatic alignment.