CS 195-G: Image Alignment
The goal of this project was to align three separate color channels (red, green, and blue) and combine them into one image. All image data is from the Prokudin-Gorskii collection in the Library of Congress.
My algorithm worked with every normal image I tested.
My algorithm worked with all but the most damaged images. I tried to only use edge pixels for comparison (ignoring pixels with values close to the local average) but it didn't improve the extreme cases.
In the extreme case, so much data is missing that the edge comparison test is confused and the image is misaligned.
The black and white images below are the individual color channels (blue at the top, green in the middle, and red at the bottom).
In the extreme case, so much data is missing that the edge comparison test is confused and the image is misaligned. The black and white images below are the individual color channels (blue at the top, green in the middle, and red at the bottom).
This algorithm computes the best alignment between two color channels. First, the edges in each channel are enhanced by subtracting out a blurred version of that channel. Blurring produces a local "average" and subtraction compares each pixel to that average. What is left is how much each pixel differs from the average, which will be large near edges and very small in areas of solid color.
An aligned image with edges enhanced
Afther this, all possible alignments are tried and the best is taken. To compare a given alignment between two color channels, the channels are first cropped to the middle half of the image because the information around the edge is noisy, and can confuse the alignment. The alignment error is the sum of squared differences, so the lowest error is best.
A correctly aligned image
An image pyramid is used to speed up the alignment. Before alignment, the original channels are repeatedly downsized. All possible alignments are only tried on the lowest resolution version, and the best alignment is continually refined back up the pyramid.