Project 1: Color Alignment

Username: dkendall

Algorithm

Alignment is done keeping the blue channel's location constant and aligning the red and green channels to it. Alignment attempts to find the minimum sum of squared differences within the given alignment window.

All images are aligned using a multiscale search. The images is first cropped by removing borders so that alignment is only done on the central part of the image. The cropping is not done in a principled manner, just a percentage of the edge is removed. The image is then resized down until the short edge is 60 pixels long or less. The starting search window is 60x60 (on most images this allows the algorithm to first search over the entire image for the best match). The image size is then doubled for each iteration (more specifically, the image is shrunk by 50% less each iteration) and the search window decresed by 10 on each axis (to a minimum of a 10x10 search). At each iteration the sum of squared differences is first calculated with no shift, and then only updated if a smaller difference is found by shifting a color channel.

The algorithm was verified on 11 additional images downloade from the Library of Congress website. All of the extra images downloaded were in JPG format due to limitations on disk space usage by undergraduates. The algorithm was seen to work correctly on high-resolution TIFFs with the images provided for the class.

Extra Credit

Automatic white balacing is performed. The algorithm used assumes that the brightest color in the image is white and the darkest black. The average of these two values should be neutral gray, and the image's color mix is adjusted if necessary. As with most AWB algorithms, this is far from perfect. Many images end up with a slightly reddish cast, especially in cases where they are dominated by a single color without a high amount of constrant. However, this results in less of a red cast in these cases than they gray world assumption creates.

Results

This algorithm results in very good alignment in nearly all cases. All images except one align nearly perfectly.

Some samples of succesful alignment are shown below. The slight reddish cast from the AWB algorithm is visible in the 2nd image. Note that it is missing from the other images whicih balance much more cleanly.

The one image which fails to align does so spectacularly, with one color channel being completely misplaced. Since all images are aligned with the same metric the only explination for this must be a flaw in one of the images, however, some of the other images have missing chunks / flaws so I'm not entirely sure why this one is special. This image is shown below.