Project 1: Color Alignment
 cs195-g: Computational Photography Patrick Doran Spring 2010 pdoran
Directory
Algorithm
Parameters
Parameter values decided to make the algorithm work for as many images as possible.
 Variable Value Explanation S [ 128, 128 ] The smallest size to scale an image in the image pyramid W [ 2 ] The window size such that the offsets examined at each scale are [ -2:2 ] or [ -2,-1,0,-1,-2 ] in horizontal and vertical directions B [ 0.20 ] The percent of the border to ignore such that the examined area is the internal 64% (0.8*0.8) SR [ 0.9 ] The sigma rule such that if a border column/row is 'too far' (mean +/- 0.9*sigma) from the mean value, it is automatically cropped C [ 0.01 ] The percent of values to ignore to create the "high" and "low" thresholds for automatic contrasting (only applied to saturation and value)
Algorithm
High level description of the algorithm.
 1 Load the image and separate the image into it's 3 components by dividing into three even vertical components (that is the way the images are stored). Note that this may cause a division through an image rather than the black border of the negative. 2 Create a gaussian pyramid of each of the images to be aligned. 3 Align the images (align everything to blue): Start at the lowest resolution of the gaussian pyramid and check for the best alignment at [-W,W] pixel range. This pixel range at the next higher resolution image would represent [-(W^2),(W^2)] because it is twice the size of the current resolution. Thus, a shift of 1 at the lowest level can represent W^n where n is the depth of the pyramid. A shift of 1 at the second lowest level represents a shift of W^(n-1) and so on such that the maximum shift representable is the sum from 1 to N of W^(n-i-1). At the next highest resolution, shift the image by twice the current shift (and then update the current shift by doubling it). Then proceed to look for the best alignment Choose the best alignment by looking at some metric between the two image at each of the window location. Better results can be gained by ignoring the borders and looking at the internal pixels only Update the shift by adding it to the current shift (which should have been doubled already because we moved up a scale). 4 Apply automatic cropping 5 Apply automatic white balancing 6 Apply automatic contrasting