CS 194-26: Project 4a

By Ana Cismaru

Part 1: Acquiring Images and Defining Correspondences

In order to perform warping and blending, we first must shoot some photos and define correspondences between image pairs. I shot photos for both panoramas and simple rectifications.

Carpet (for rectification testing)
Bed (for rectification testing)
A Northside View P1
A Northside View P1
Some Vines P1
Some Vines P1
My Piano P1
My Piano P2

Part 2.1: Padding the Images

Before recovering the homography matrix, we must first pad our images such that our transformed images stay within the frame. To do this, we calculate the mean x and y distance between the correspondences in each image and then shift each image according to those mean values. This will ensure that our transformed image is aligned to the second image and that it's content are in frame. We will then also shift the correspondences for each image so they are aligned to the padded images. Finally we can compute the homography matrix on these new points.

Padded Northside 1
Padded Northside 2
Padded Vines 1
Padded Vine 2
Padded Piano 1
Padded Piano 2

Part 2.2: Recovering Homographies

With our correspondences and padding set up, we can compute the perspective transform/homography matrix to determine how to warp one image into another.

Initial Homography Equation
Initial Homography Equation

The way we do this is by deriving a least squares equation from our initial homography matrix equation. In the least squares equation we have 8 unknowns so we need at least 4 sets of correspondences for each image. We can however expand this equation to support any number of correspondences.

Expanded Least Squares Equation

Part 3: Warp the Images

With our homography matrix prepared, we can then select all the possible (x,y) image pairs and transform then by multiplying against our image matrix and resampling the image to those new coordinates. This will result in a newly warped image.

Warped Northside 1
Warped Vine 1
Warped Piano 1
Warped Carpet
Warped Bed (less smooth because of the undefined corners of the bed)

Part 4: Blend the Images

The last step of our panaroma process is blending the transformed image with the reference image. This can be done via summing the two images together and diving the areas of overlap by 2. We can find the areas of overlap by performing a "logical and" between the two images.

Northside Left Side
Northside Right Side
Northside Blended
Vine Left Side
Vine Right Side
Vine Blended (not as smooth due to change in hill angle as well)
Piano Left Side
Piano Right Side
Piano Blended

Part 5: What I Learned

The most important thing I learned during this project is the importance of padding during transformations. Even with my automatic padding method, I would lose some of the transformed picture as some of its coordinates would fall offscreen. If I had a more accurate method of detecting possible shift between the two images or maybe had a stretching factor included in my padding I would be able to capture the full image when warping.

Part 5: What I Learned

For bells and whistles, I inserted the Harry Potter Puppet Pals in the Opera Garnier as I thought it would be amusing to see that video in such a fancy opera. The main change here was modifying the blending function so that it overlaps the two images instead of blending them.

Opera Garnier
Harry Potter Puppet Pals
Padded Opera
Warped + Padded Harry Potter
Blended Image