The project was to create color images from Prokudin-Gorskii's photocollection (1907) with image processing techniques. Convinced in 1907, that color photography was the wave of the future, he won Tzar's special permission to travel across the vast Russian Empire and take color photographs of everything he saw including the only color portrait of Leo Tolstoy. People, buildings, landscapes, railroads, bridges... thousands of color pictures. The idea was simple: capture three exposures of every scene onto a glass plate using a red, a green, and a blue filter. Never mind that there was no way to print color photographs until much later -- he envisioned special projectors to be installed in "multimedia" classrooms all across Russia where the children would be able to learn about their vast country. Alas, his plans never materialized: he left Russia in 1918, right after the revolution, never to return again. Luckily, his RGB glass plate negatives, capturing the last years of the Russian Empire, survived and were purchased in 1948 by the Library of Congress. The Library of Congress has recently digitized the negatives and made them available online.
1. Color Extraction. Getting color channels (red, green, blue) by splitting an original impage plate into 3 equal parts (equal size of the images). The first part is the blue channel image (B), the second - green channel (G), and the third - red channel (R).
2. Exhaustive Search. If the image is of small size (jpeg), then the algorithm implements a naive approach for proper alignment - exhaustive search alignment. Over a range of possible displacements (=20), we are looking for the most optimal displacement vector [x,y], which is computed by error metrics. In this case I used sum of squared distance metric to minimize the displacement of images' edges. More specifically, it would compare image part of B and the displaced / shifted image G.
3. Image Pyramid Search. If the image is of larger size (tiff), then the algorithm implements a faster procedure of proper alignment - image pyramid search. The process would recursively perform rescaling of the images, area cropping, and compute the error metric on sub-images (from the smallest to the largest) to gradually estimate the most optimal displacement vector at a much smaller scale. This also reduces the runtime. I also have used edge filtering / detection from sklearn library with the purpose for a more accurate image comparisons.
Notes: With the algorithm described above, the majority of results have produced colorized images. The photographs it couldn't properly align was "Cathedral" and "Emir" because of different values in brightness in each of the original images. I experimented with one method of edge detection, however, a potential solution to handle this might be Canny edge detector before alignment. In that case the algorithm would be to selecting Gaussian filter for image smoothing, calculate magnitude and direction of the image gradient, utilize non-maximum suppression and connect edge through the set threshold.