Project 1 Writeup

Tim St. Clair (tstclair)
February 5, 2010

Table of Contents

Least Squares The basic multi scale algorithm and results
Edge Enhancement Takes the least squares approach but pre filters with an edge enhancement filter
Gaussian Weighting Applies a weighting to pixels based on location from the center.

Least Squares Pyramid approach

The basic algorithm I employed searches within a neighborhood for the alignment between two images (i.e. translation) which minimizes the difference of squares. However, this approach would be very slow for a large image, therefore I built a gaussian pyramid of the image, with the most coarse level being approximately 40x40 pixels. Before down sampling each layer, I filtered with a gaussian blur filter of standard deviation .5, to reduse aliasing effects. I then searched for the optimal allignment at the most coarse level. Once I found that allignment, I shifted the previous level by twice the shift (due to the change in scale), and then repeated the search in a (-1, 0, +1) neighborhood. The small neighborhood is permissable since a larger neighborhood would be found in the coarser level. In addition, I croped the outer 1/8th of the image (before aligning), to eliminate any effects of the border garbage. Bellow is an illustration of the allignment process:

Alignment Process

Unaligned Image
Coarse Level (before and after alignment)
Next Level (before and after alignment)
Top Level (before and after alignment)
Final Outcome
Here are some additional results:

Results

Unaligned Image Aligned Image

Note the failure in this last case. This actually doesn't occur if
we limit the search neighborhood for the coarsest level (from 15 to 5).

Extensions

Edge Enhancement

I also tried using a sobel edge enhancement filter. However, the results were very poor, most likely due to the over smoothing of details which may have been key to the allignment. Here are the results of the images alligned after being prefiltered with a sobel edge enhancement filter: fspecial('sobel')
Unaligned ImageAligned image with edge enhancement Final Aligned Image

Gaussian Weighting

In this set instead of cropping the images initially, I added a gaussian weighting term to the error function. The differences are weighted according to their distance from the image center according to a gaussian with standard deviation equal to 1/6th of the image size (95% of the image weight will be in the central 2/3rds of the image).
Unaligned Image Aligned Image

I was surprised that this image failed in this case, since
there is so much texture in the center of the image

I suppose this image failed due to the large amount of texture
around the border of the image.