In this project, I worked on creating image mosaics by registering, projective warping, resampling, and compositing images together. This process included a couple of steps all of which are outlined in detail below including capturing and digitizing the images, recovering homographies, warping images together, and finally blending the images into a single mosaic.
The first part of this project was to capture images. When taking these photos, one of the key considerations was to keep the center of projection identical for sequences of images. I had the opportunity to Hike in Yosemite and decided to take advantage of that and capture series of images for this project. I did not have a digital camera with me while on the trip, the the images I captured at Yosemite were taken on an iPhone7 camera. I did my best to remain still and maintain the camera position as a took photos facing different parts of the scene. I then also decide to try and capture some images during nighttime to see if the effects of the mosaic vary with different lighting conditions, so I captured some images of my roommate on campus at night.
Now that I had my images captured, I turned to creating projective transformations between the images. These transformations are called homographies and they have 8 degrees of freedom which allow us to transform one image into the plane of another image. In order to solve the homographies, I set up a function,
Once the homographies are created, it's time to warp and rectify them. I started by taking a few sample images with some planar surfaces, and warping them so that the plane is frontal-parallel.
For example, I warped this image of a room to the rectangular image frame in the center:
Once I finalized my warping algorithm, I began working on creating mosaics of two or more images. I created mosaics by warping two images at once and then warping the resulting image with the next image. I warped the left and right images of the photos I captures onto the plane of the central image in the photos. I experimented with different types of blending. The best results were obtained by creating linear blending over a central region where the two images are combined. I achieved this by creating a horizontal mask (utilizing some of my project 3 code!), spiting the image into distinct color channel and computing a weighted average across the mask's area. My results are illustrated in detail below:
In the second part of the project, the goal was to implement an algorithm that can automatically stitch images into a mosaic without having to define correspondence point pairs by hand. To achieve this result, I followed this paper. I detected corner features using a Harris feature detector, extracted feature descriptors for each feature point, and used RANSAC to match feature descriptors between images to produce homographies.
The results are showcased below.
I started by detecting interest points using a Harris Interest Point Detector. The Harris points are measured in their corner response strength. To illustrate the process, I will utilize the yellow meadows photos I used in the first part:
After running the Harris detection algorithm on these images, I got these results. Each red dot designates a corner detected by the algorithm.
.
Once I finished implementing the algorithms, I recreated the mosaics I made in part one and also made a couple new mosaics. Scroll down to see more of my results!
I thought it would be fun to try my mosaic algorithm on a bunch of different images at the same time by implementing a panorama recognition algorithm. I did this by running my existing algorithms and doing pair wise comparisons image by image. The key modification thought was that after I ran my feature matching function, I counted how many features (or pairs of corresponding features to be exact) it returned. Naturally, if two images are of the same scene, the feature matching algorithm should return many points, while two completely different images should theoretically not align at all. I set a threshold value on the number of features matches that indicate a likely mosaic and only called RANSAC on pairs of images that exceeded that threshold (which I determined about some experimentation to be 14 points of correspondence or more).
Here are the images I started with: