CS 766 Homework 2 - Panorama Stitching
Sarah Gilland and Alper Sarikaya
Overview
For this assignment, we again decided to use MATLAB because of its ease of use.
We ended up taking photos early on in our iteration process, and as such, only used our images to test. We've tried to make the code as general as possible, but the results may not look as good as our images!
Our MATLAB code consists of five files. The script is called by calling makeMosaic. This function automatically grabs all JPEG images in the Rotated folder, in alphabetical order, and uses those images for the panorama. Change the ls command to grab other images. The MATLAB files and their descriptions are as follows:
- makeMosaic.m - This is the main script that executes the entire procedure. By default, it grabs all JPEG files in the Rotated folder, and converts them to cylindrical projection, calculates the translational shift via RANSAC using SIFT feature detection, and assembles the panorama. To ensure a 360 degree view, we duplicate the image and grab the middle half. The script outputs a file called finalImg.jpg in the current directory.
- getPanIm.m - Reads in the image files. Used to do some cool stuff here, but now this is essentially a one-line function!
- convToCyl2.m - Converts a matrix of images to cylindrical coordinates. We do this by going directly from source pixels to cylindrical projection pixels. This entails losing some specificity in data as we essentially take the floor of the computed coordinate to get to the nearest integer coordinate. We started doing interpolation, but ended up abandoning it as we couldn't get interp2 to work the way we wanted it to.
- calcShift.m - For a pair of images, this function calculates the coordinate shift from image1 to image2. It does this by implementing a RANSAC loop (100 iterations) over SIFT feature detection. The best translation picked will have the most matching SIFT features between the two images.
- stitch4.m - Given all cylindrical projections and shifts between images, assembles the images into a panorama. We implemented a simple cross-blending function to help soften artifacts that arose with a buffer of 5px.
Image Output
With the outputted image, we imported into Photoshop CS 5.1, cropped the top and bottom (approx 7px each side), and performed some adjustments (contrast, saturation). No modifications to the pixel positions were performed post-MATLAB.
For our images, we ended up on the roof of the Computer Sciences building, which gave a unique perspective on the surrounding environment. Ghosting of moving objects was not a problem as the resolution of objects on the ground was minimal. The panoramic tripod performed fantastically and gave us good images for our panorama stitching program.
Our final panorama
Our images were taken at 1/100s at the widest angle possible with our camera (Canon SX100 IS, tag 6418204024, f=676.21154).
Teamwork
Both of us participated in partner programming, each taking equal turns to drive. Sarah made the panorama look better in Photoshop, and Alper made the README.
Sarah Gilland - segill@cs.wisc.edu
Alper Sarikaya - sarikaya@cs.wisc.edu