Given the red, green, and blue channels, we can overlay them to get the full color image. With small images, it is possible to thoroughly search through a window of displacements and find the best displacement given a certain scoring metrics. I found the best displacement for both the green and red channels when compared to the blue channel. For the following images, I used a window of [-15, 15] pixels and normalized cross correlation to score each displacement.
For larger images, such as the tif files, the basic implementation above would take too long. In order to find the best alignment, I needed to use an image pyramid. I kept scaling down the image by 2 and used the same metric as before to score the displacements. As I scale back up, I use a smaller and smaller window of displacements so when the image is really large, I don't need to compare as many alignments. Also, as I go up, I displace the image before scaling by the displacement vector of the scaled image times two, which improves the image at each iteration. The images below show the tif files that have been aligned using this implementation.
For both implementations, I also cropped the images by 1/15th of the width or length on each side so that borders don't affect the scores. After finding the displacements, and aligning all three channels, I also do a post crop so that the parts that are rolled over to the other side are cut off.
At first, I compared the original channel images to each other to score them. However, I noticed that the channels may have variances in brightness, which makes it harder to accurately score the displacements, so I decided to compare the gradients of the images instead. I computed the absolute value of the gradients in both the x and y direction, then scored them. I added the two scores together to get the new scoring metric. As you can tell below, this really helped improve the emir.tif image.