# Project 1 Writeup: Color Alignment

## Basia Korel (bkorel)

February 5, 2010

##

This project entailed implementing an automatic color aligning algorithm using the Prokudin-Gorskii photo collection. I implemented both a sincle-scale and multi-scale alignment using an image pyramid. Only an x,y translation model was applied to determine the best alignment, and the sum of squared difference metric was used to measure how well images match. The multi-scale pyramid scheme was used on all the photos below using a user-specified window of displacements I found to be most appropriate.
In implementing my algorithm, I first cropped the image such that alignment algorithm would only use roughly 70% of the interior of the image. This decission was made because computing the metric on the internal pixels made for a better alignment. For multi-scale alignment, and image pyramid is built; the number of "layers" in the pyramid is log base 2 of the image height over a min threshold of image height. Thus the smallest image in the pyramid will not have a height smaller than this threshold. For building the image pyramid, three pyramids are stored; one of each color channel. The first level is the cropped image matrix itself. The matrix is then blurred using a gaussian filter and resized by half; the resulting matrix is what is stored at the next level of the pyramid. For multi-scale alignment, the algorithm first starts with the coarsest image and descends down the pyramid. A translation is computed for the best alignment at this level, and this shift multiplied by 2 is applied to actually translate the image stored at the next lower level in the pyramid; this process continues iteratively. Two variables must be stored and continually updated during this process; the green and red shift. This last step before concatinating and storing the output image is to translate the original green and red image matrix by the shift values. (I cannot just use the image stored at the base of the pyramid since this image was naively cropped).
In terms of computing the alignment, I set the size of window of displacements based on what I felt most appropriate based on my results. This window size varies based on the height of the current image that the alignment metric is being computed on. In general, the images at the top and the bottom of the pyramid have a relatively small window size; the images in the middle have a larger window size. Finally, I use a sum of squared differences for the alignment metric.
# Results Images