Image warping and mosaicing

Roma Desai | CS -194 Project 5

 

 

OVERVIEW

 

For this project, I shot a couple individual photographs and warped them together using homographic projections to create an image panorama. This technique allows us to take separate photos but create a combined image that shows a much larger field of view.

 

 

PART 1: SHOOT THE PICTURES

 

The first step was to shoot some pictures. To ensure the transformation between each photograph was perspective, I shot from the same point of origin but rotated the camera to capture different angles. I also had to ensure my photographs were taken with the same aperture and exposure settings. I made sure the images overlapped by about 50% so I could later identify common key points between the images. Here are a few I took around my house:

 

A living room filled with furniture and a large window

Description automatically generated

A living room filled with furniture and a rug

Description automatically generated

A close up of a decorated tree in a room

Description automatically generated

A living room filled with furniture and a large window

Description automatically generated

A house with trees in the background

Description automatically generated

A house with trees in the background

Description automatically generated

 

 

PART 2: RECOVER HOMOGRAPHIES + WARP IMAGES + IMAGE RECTIFICATION

 

Next, I wrote a function to calculate the homographic transformation between the first image to the second image. I selected corresponding points and solved for H in the equation p’ = Hp. To give a better result, I used multiple points and turned this into a least squares problem solving for the entries in H.

Next, I wrote a warp function to take the first image and apply the homographic transformation to align it with the second image’s perspective. To test my two functions so far, I took a couple side view photographs and rectified them to show a top view image. Here are some of the results.

 

Original

Rectified

A close up of a door

Description automatically generated

A close up of a tiled floor

Description automatically generated

A picture containing sitting, wooden, table, board

Description automatically generated

A close up of a box

Description automatically generated

A picture containing sitting, suitcase, luggage, small

Description automatically generated

A picture containing calendar

Description automatically generated

 

 

PART 3: BLEND THE IMAGES

 

Finally, I combined the images by warping the first image into the geometry of the second image, and then using a laplacian pyramid to merge the images together. I decided to use laplacian pyramids because it resulted in much less edge artifacts when compared to simply adding the images together. Since I was using my phone camera and the lighting did not stay constant the entire time, I believe some edge artifacts may be as a result of that. I also found it difficult to specify corresponding points in my images that had irregularly shaped objects such as trees and flowers. Because of the squares and straight lines in my first image, I believe it turned out better. Shown below are the warped images as well as the final combined image.

 

Warped

Blended

A living room filled with furniture and a large window

Description automatically generated

A living room filled with furniture and a large window

Description automatically generated

A room filled with furniture and vase of flowers

Description automatically generated

A living room filled with furniture and vase of flowers next to a window

Description automatically generated

A house with trees in the background

Description automatically generated

A house with trees in the background

Description automatically generated

 

 

REFLECTIONS:

 Overall, this was a super cool project that led me to appreciate everyday tools we take for granted such as the panorama creator in iPhones! I think the coolest part of this project was how you can completely change the view at which an image is being displayed just by a single transformation. The fact that you can go from looking at something from the side to looking at something from a top view with no external information is mind blowing! Overall, I really enjoyed this project and can’t wait to explore these concepts further.