Exahustive Search

To run exhaustive search, I created a window of possible displacements of [-15, 15]. Across each possible displacement, I computed the SSD as a metric to score how well the alignment matches. The one with the lowest SSD and thus best score was the best alignment for the 2 image channels. To reconstruct the image, I aligned the g image to b and the r image to b using the best scoring displacement vector and then layered them all on top of each other.

The following images were outputted using exhaustive search, listed with their displacement vectors. The first vector is the displacement of g to b. The second vector the displacement of r to b.

[5, 2] [12, 3]
[3, 3] [6, 3]
[-3, 2] [3, 2]

Pyramid Search

For larger images, pyramid search was used. Pyramid search applies exhaustive search on various levels of the image, starting at the smallest one, which I defined to be 1/32 the size of the original image. At each level, it computes a displacement vector, which will then be used at the next level (a larger image) as a starting point and then apply exhaustive search again to update it. This allows for quicker search over a larger possibility of displacements than the initial small window of [-15, 15] applied in basic exhaustive search.

One exception: To reconstruct the images, I aligned the g image to b and the r image to b, and then layered them all on top of each other. In emir.tif I found better results by changing the base layer from b to g and thus the displacement vectors were applied to b and r rather than r and g.

[-60, -10] [64, 2]
[40, 16] [90, 24]
[42, -2] [106, 12]
[56, -6] [120, -16]
[82, 4] [180, 8]
[52, 22] [108, 36]
[52, 4] [114, 8]
[22, -4] [40, -12]
[98, 8] [188, 16]
[52, -2] [100, -14]
[-56, 8] for aligning b to g [56, 12] for aligning r to g
My image picks
[56, 10] [190, 16]
[62, 10] [158, 12]
[60, -6] [138, -26]