Image Warping and Mosaicing

Jacob Huynh
CS 194-26: Image Manipulation and Computational Photography
Professor Alexei Efros

Overview

The goal of this assignment is to get your hands dirty in different aspects of image warping with a “cool” application -- image mosaicing. You will take two or more photographs and create 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 of the assignment are: Shoot and digitize pictures (20 pts) Recover homographies (20 pts) Warp the images (20 pts) [produce at least two examples of rectified images] Blend images into a mosaic (20 pts, 10 of which are for linear blending) [show source images and results for three mosaics.] optional Bells and Whistles (up to 20 pts, combined from Parts A and B)

Shooting the Pictures

I took pictures on my iPhone 8 and digitized them by using scipy.misc.imread(imname). I made sure to overlap my field of view a lot in order for the blending to more seamless. The first set of pictures are for the rectification process. I made sure to take a picture of a rectangular object in a slanted view so that the rectification effect is more pronounced. The other 3 set of pictures are for the mosaics.


Recovering Homographies

In order to find the homography matrix, we use the matrix formula as was seen in lecture. For part A of the project, we defined the correspondences in the images manually. However, in part B we will be defining correspondences automatically.


Warp the Images and Image Rectification

Once we find the the homography matrix H, we utilize the warp function skimage.transform.warp to warp the image into a rectangle as defined by the corners of the image in order to achieve frontal-parallel rectification.


Original

Rectified

Original

Rectified

Blend the Images into a Mosaic

To blend the images into a mosaic, I utilized two different methods of blending: naive blending and alpha blending. For both methods of blending, the first step was to stitch the images together by simply warping the images together, utilizing the very same technique as in the previous section. The distinction in naive blending and alpha blending comes in the way we handle the overlapping pixels in the warped images. For naive blending, got the point by simply averaging the two pixels of the image, while in alpha blending, we use a gradient to feather the blending, to create a more seamless blend.

Naive Blending


Stitched


Original Left

Original Right


Stitched


Original Left

Original Right


Stitched


Original Left

Original Right

Alpha Blending


Stitched


Original Left

Original Right


Stitched


Original Left

Original Right


Stitched


Original Left

Original Right

What I Learned

The coolest thing I learned was image rectification. It's amazing that with just four corresponding points we can completely alter the perspective of an image to reveal completely new information.