A pioneer in color photography, Sergey Prokudin-Gorskii travelled the Russian Empire, taking three-image color photography of the people and places he saw. The goal of this project was to align the three color channels of Prokudin-Gorskii's work to create a single composite image.
I decided to use the L2 norm to calculate the alignment of 2 color channels, with a small value representing a better alignment. My initial, basic approach was to exhaustively search across a 30px by 30px window of displacements and choose the displacement that gave me the smallest value for the L2 norm. This worked well enough on most images, though some still had issues (monastery.jpg, cathedral.jpg). This was also only feasible for the small .jpg images, because the larger .tif files took too long with exhaustive search.
To optimize the algorithm, I created an image pyramid that allowed me to approximate the offset at lower resolutions (1/8, 1/4, and 1/2 resolution), then combine these offsets to generate the final image. This sped up the alignment algorithm enough so that I could run it on the higher resolution .tif files, but decreased the accuracy of the alignment by a bit, and most images became a bit off-centered as a result.
The final improvement I made to the algorithm was to crop the borders of the images for better alignment, as most images had dark edges whose values would strongly affect the L2 norm result. I cropped 15% off of each side of the image before running each level of alignment. This fixed almost all of of the blurriness and aligned most images perfectly, except for emir.
Emir's alignment required me to align the red layer against the aligned green layer, which didn't affect the alignment of any other images. So now we have the final product!
Cathedral
Green Offset: (4, 2) | Red Offset: (10, 4)
Emir
Green Offset: (48, 24) | Red Offset: (104, 42)
Harvesters
Green Offset: (60, 16) | Red Offset: (124, 14)
Icon
Green Offset: (40, 16) | Red Offset: (88, 22)
Lady
Green Offset: (52, 8) | Red Offset: (112, 12)
Monastery
Green Offset: (-4, 2) | Red Offset: (2, 2)
Nativity
Green Offset: (2, 0) | Red Offset: (6, 0)
Self Portrait
Green Offset: (78, 28) | Red Offset: (176, 36)
Settlers
Green Offset: (8, 0) | Red Offset: (16, 0)
Three Generations
Green Offset: (52, 14) | Red Offset: (110, 12)
Train
Green Offset: (42, 6) | Red Offset: (86, 32)
Turkmen
Green Offset: (56, 20) | Red Offset: (116, 28)
Village
Green Offset: (64, 12) | Red Offset: (136, 22)
Capri, Italy
Green Offset: (2, -2) | Red Offset: (6, -2)
Lugano, Switzerland
Green Offset: (4, -2) | Red Offset: (10, -4)
Napoleon
Green Offset: (6, 0) | Red Offset: (14, 0)
Mannequins of Women
Green Offset: (6, 0) | Red Offset: (12, -2)