In this project, I try to align three greyscale pictures denoting color channels and synthesize them into one color picture. I used the following approach to finish this task: I used standard deviation in color intensity to crop the side. If the standard deviation of a row or a column is under a certain value, I assume that that row/column is all black/white and hence remove it. I then used NCC as a criterion to see how much each of the two matrices correspond to each other. Using the blue channel as a base, I searched through a given margin for the best NCC between green/blue and red/blue and adjusted the position accordingly. For TIF images, I used a Gaussian pyramid to speed up the calculation. I used a 4 layer pyramid, where the top layer is the original image and the subsequent layers are 1/2, 1/4, and 1/8 in size compared to the original. The bottom layer would search through a margin of [-20,20] in both vertical and horizontal directions, and the top layer would only search in a [-5,5] margin due to computational complexity, the middle layer used 15 and 10 as margin accordingly. After the alignment, I balanced the color intensity and contrast to improve the final quality.
We could see that most of the images appeared to be okay after my processing. In some of the images the red channel isn't aligned perfectly (there is a small red outline visible), I assume that this is due to the final margin being set too low (-5,5), but I think this is a necessary compromise for efficiency, the TIF images on average take 3 minutes to process, if I extend the margin on the final search, the time would vastly increase. Apart from the quality issue mentioned above, one image turns out to be really bad: the emir.tif, I assume this is due to some angle disimilarity between the three color channels and requires another dimention (angle between channels) during margin search to align perfectly.