Aligning Color Channel Images with Kevin

Problem

We are given three color channel images and we need to align them such that they create a color image. Consider the example below:

Let us just overlay the three color channel images on top of each other with no effort to align them.

That kinda sucks so let's try to solve this alignment problem.

Solution

The general approach used was to align images based on a similarity score. The similarlity score we used here was normalized cross correlation, which is just a dot product of the two normalized two-dimensional matrices representing two color channel images. We shift the overlay channel in the x and y direction until we have maximized the NCF value.

Now one of the issues with this solution is we get an O(s^2) runtime, where s is the amount we shift in the x and y direction, and we are checking over each combination of x and y for a given max shift s. Thus, to improve performance for some of our larger images, we use the concept of image pyramids. In the algorithm, we reduce the image size to 1/32 of the original size, approximate a shift on this reduced image, and then move up the period to 1/16 the original size. We use the shift calculated in the previous step and search the neighborhood for an even more precise shift, until we reach the original sized image, in which case we only have to search a small region.

Results

Here are the small images. Note that the numbers indicating shifts are in the following format. Blue is the base layer. The first tuple is of the format (green vertical shift, green horizontal shift) and the second tuple is of the format (red vertical shift, red horizontal shift).

Let's look at some of the larger images.

Let's look at some other larger images picked from the collection.