15-463 Project 4

Stitching Panoramas

Eric Trottier

2010-11-02

Part 1

Part 1 was fairly straightforward. I computed the homography with hand-selected points, and then blended the images together using the suggested "bwdist" as the alpha channel. Unfortunately, I can't seem to find my camera. Until I find it, I'm going to have to borrow some un-stitched photos from previous years.

Here are some results:

Rectifying:



Stitching:






And the most useful images ever:


Part 2

In this part of the assignment we attempt to do this stuff automatically. I still can't find my camera but I borrowed a friend's so I could try this baby on my own photos.
We start by finding the corners in an image:

Then find less using adaptive non-maximal suppression:

Then match two images together:

Then use RANSAC to get rid of outliers:

And from here we can use our old code to stitch the images together (images are found here).

The entire process looks like this:

% load images
im1 = loadScaled('me/P1010697s.jpg', 1);
im2 = loadScaled('me/P1010698s.jpg', 1);
im3 = loadScaled('me/P1010689s.jpg', 1);

% compute harris corners (includes ANMS)
pts1 = harris(im1);
pts2 = harris(im2);
pts3 = harris(im3);

% match points together
[r12,r21] = matchPts(im1, im2, pts1, pts2);
[r23,r32] = matchPts(im2, im3, pts2, pts3);

% attach image 1 (left) to image 2 (center)
[pan,shift] = stitch(im1, im2, r12, r21);

% pop the third one in the right spot
[pan2,shift2] = stitch(im3, pan, r32, ptTransform(r23, shift));

% at this point more images can be added,
% however it makes the panorama *huge* and
% MATLAB usually complains about memory
% (or maybe it's because I'm too cheap to buy more memory)

% to do this, one just transforms points in images to the same points
% in `pan2`. I do this above where the only transformation is shifting
% the points
			
In the end, the results were pretty good. Unfortunately I noticed a lot of blurring towards the edge of images. I think this can be attributed to radial distortion and perhaps not standing still (it is also worth noting that RANSAC gets rid of many of the points that are not on center since they can't all fit on one homography). It could probably be somewhat remedied by using seam carving instead of blending for the final stitching, but I actually like how bwdist merges the skies and accounts for some color differences in the photographs. Occasionally there's a giant wedge in the sky, but it's better than a seam in my opinion.

Also perhaps if the sun was higher in the sky, the camera wouldn't blow up the colors in the images so much. They changed drastically depending on where I was pointing. I couldn't figure out how to turn off auto-adjust.




Here's one that didn't work quite so well (I don't think matching the grass works very well)

Here are the images that I did in part 1 manually, but automaticallized: