I am given a collection of 3 black-and-white images, corresponding with pixel-values of RGB of a complete image. In this project, I align the 3 images with one another to produce a colored image. Blurriness in the images indicates poor alignment.
Example of given, RGB-separated image. Top is b, middle is g, bottom is r.
The images were separated into their RGB components in place. Image alignment was done brute force, then with a coarse-to-fine pyramid speedup.
I experimented with Cross Correlation and Euclidean Distance to score image alignments. Normalized Cross Correlation (NCC) produced the most consistent results for me. I measured image alignments in a [-15, 15] window. To create sensible alignments, I cropped a border of 15 pixels width around the image channels before calculating NCC score. The alignment with the highest score was used. I used np.roll to realign two channels to match the third channel (generally, g and r were realigned to match b).
For larger images, I used the same function to find proper alignment as I did in the brute force approach. This time, I applied the alignment in multiple functions. I downsized the images using cv2's resize function. The factor of this resize (downsize) was the first 2^n to bring the image to have vertical dimension below 600. I made a single alignment of the smallest image of my pyramid in the range [-20, 20]. Then, I repeatedly aligned subsequent pyramid images (larger by factors of 2 up to the original image) up to 2 (pseudo-)pixels in the horizontal and vertical directions.
Some of the images shown used alignment on the green channel instead of alignment on the blue channel.