This project is to align RGB channels. I recursively resize the image to have 1/2 width height, and at each smaller level, search for a best alignment based on SSDs. Then i pass this alignment to the next bigger level, which uses this offset as a starting point, and searches 1/2 as wide as the layer before it. I use SSD of gradient magnitude. Here are my final offsets:
Aligned turkmen.tif in 9.83 seconds, with red offset (24, 125) and green offset (20, 63)
Aligned three_generations.tif in 11.77 seconds, with red offset (9, 122) and green offset (13, 58)
Aligned train.tif in 11.92 seconds, with red offset (31, 94) and green offset (2, 44)
Aligned emir.tif in 11.68 seconds, with red offset (37, 118) and green offset (23, 52)
Aligned harvesters.tif in 11.58 seconds, with red offset (14, 134) and green offset (17, 64)
Aligned cathedral.jpg in 0.21 seconds, with red offset (3, 12) and green offset (2, 5)
Aligned village.tif in 9.39 seconds, with red offset (20, 145) and green offset (10, 73)
Aligned lady.tif in 9.00 seconds, with red offset (12, 129) and green offset (10, 63)
Aligned icon.tif in 12.15 seconds, with red offset (23, 100) and green offset (17, 44)
Aligned self_portrait.tif in 9.48 seconds, with red offset (32, 177) and green offset (26, 89)
The only bell and whistle I used was gradients. I also like to think the way I calculate these is efficient, as I can align in 10 seconds, with room to spare.