Project 1: Colorizing the Prokudin-Gorskii photo collection

Sergei Mikhailovich Prokudin-Gorskii (1863-1944) photographed various scenes of the Russian Empire in the early 1900s. He recorded three exposures of every scene onto a glass plate using a red, a green, and a blue filter. At the time, it wasn't possible to capture color images, let alone print them. His RGB glass plate negatives, capturing the last years of the Russian Empire, survived and were purchased in 1948 by the Library of Congress.

Overview

The goal of this assignment is to take the digitized Prokudin-Gorskii glass plate images and, using image processing techniques, automatically produce a color image with as few visual artifacts as possible. In order to do this, you will need to extract the three color channel images, place them on top of each other, and align them so that they form a single RGB color image.

Alignment Algorithm

First, I tried to align the images using a naive approach. I separated the original image into thirds to get the red, green, and blue channels of the image. I then cropped the image channels by 10% on each side and aligned them using normalized cross-correlation. To do this, we search over a displacement window of size 15x15 centered on the center of the image for both the red and blue channels with respect to the green channel, scoring all of the alignments with normalized cross-correlation (every combination of x and y between -15 and 15). I then stacked the aligned channels on top of each other to create a color image. This approach worked well for small images, but for larger images, it was too slow and the results were not very good. I then implemented a more comprehensive alignment algorithm using a multi-scale approach, where we first align the images at a lower resolution with a smaller displacement window and then progressively align the images at higher resolution, making sure to scale up the "best displacement" from the coarser images to the finer images. This tool is also called an "image pyramid". I reduced the search window for coarser images to 75% for the second pyramid level and 50% for the third pyramid level. Otherwise, all methods were the same as the single alignment approach. This approach worked much better for the larger images and was much faster. Both of these algorithms also have an option to use euclidean distance as a scoring metric instead of normalized cross-correlation. In my experience, both of these methods gave me the same image offsets. I decided to use NCC for all of the results below.

Single Align Photo Results

Here are the results of the single alignment algorithm using NCC (Normalized Cross Correlation). For each image, the left shows the unaligned version (original channels simply stacked) and the right shows the aligned result. The offset values are listed below each aligned image.

cathedral unaligned
Unaligned Cathedral
cathedral NCC aligned
NCC Aligned Cathedral, Red Offset: (7, 1), Blue Offset: (-5, -2)
cathedral unaligned
Unaligned Monastery
monastery NCC aligned
NCC Aligned Monastery, Red Offset: (6, 1), Blue Offset: (3, -2)
` tobolsk unaligned
Unaligned Tobolsk
tobolsk NCC aligned
NCC Aligned Tobolsk, Red Offset: (4, 1), Blue Offset: (-3, -3)

Pyramid Align Photo Results

Here are the results of the pyramid alignment algorithm using NCC (Normalized Cross Correlation). A 10% border crop was used before image alignment, and 4 levels of image pyramid were used. The finest image pyramid level used a search window of size 15x15, the second level used a search window of size 11x11, and the last two levels used a search window size of 7x7. For each image, the left shows the unaligned version (original channels simply stacked) and the right shows the aligned result. All tif images were converted to jpg for web display, but the original aligned tif images are avaliable in the website git repository. The offset values are listed below each aligned image.

cathedral unaligned
Unaligned Cathedral
cathedral NCC aligned
NCC Aligned Cathedral, Red Offset: (7, 1), Blue Offset: (-5, -2)
church unaligned
Unaligned Church
church NCC aligned
NCC Aligned Church, Red Offset: (33, -8), Blue Offset: (-25, -4)
emir unaligned
Unaligned Emir
emir NCC aligned
NCC Aligned Emir, Red Offset: (57, 17), Blue Offset: (-49, -24)
harvesters unaligned
Unaligned Harvesters
harvesters NCC aligned
NCC Aligned Harvesters, Red Offset: (65, -3), Blue Offset: (-60, -16)
icon unaligned
Unaligned Icon
icon NCC aligned
NCC Aligned Icon, Red Offset: (48, 5), Blue Offset: (-41, -17)
italil unaligned
Unaligned Italil
italil NCC aligned
NCC Aligned Italil, Red Offset: (38, 15), Blue Offset: (-38, -21)
lastochikino unaligned
Unaligned Lastochikino
lastochikino NCC aligned
NCC Aligned Lastochikino, Red Offset: (78, -7), Blue Offset: (3, 2)
lugano unaligned
Unaligned Lugano
lugano NCC aligned
NCC Aligned Lugano, Red Offset: (52, -13), Blue Offset: (-41, 16)
melons unaligned
Unaligned Melons
melons NCC aligned
NCC Aligned Melons, Red Offset: (96, 4), Blue Offset: (-82, -10)
monastery unaligned
Unaligned Monastery
monastery NCC aligned
NCC Aligned Monastery, Red Offset: (6, 1), Blue Offset: (3, -2)
self_portrait unaligned
Unaligned Self Portrait
self_portrait NCC aligned
NCC Aligned Self Portrait, Red Offset: (98, 8), Blue Offset: (-79, -29)
siren unaligned
Unaligned Siren
siren NCC aligned
NCC Aligned Siren, Red Offset: (47, -18), Blue Offset: (-49, 6)
three_generations unaligned
Unaligned Three Generations
three_generations NCC aligned
NCC Aligned Three Generations, Red Offset: (58, -3), Blue Offset: (-53, -14)
tobolsk unaligned
Unaligned Tobolsk
tobolsk NCC aligned
NCC Aligned Tobolsk, Red Offset: (4, 1), Blue Offset: (-3, -3)

Extra Photo Results

We were also asked to download four more images and align them using the same methods. Here are the results for the images that I chose, again with unaligned and aligned versions. The aligned images were aligned using the same pyramid alignment algorithm as the other images. The offset values are listed below each aligned image.

haystacks unaligned
Unaligned Haystacks
haystacks NCC aligned
NCC Aligned Haystacks, Red Offset: (71, -10), Blue Offset: (-66, 6)
man_and_sacks unaligned
Unaligned Man and Sacks
man_and_sacks NCC aligned
NCC Aligned Man and Sacks, Red Offset: (60, 7), Blue Offset: (-56, -21)
rubble_building unaligned
Unaligned Rubble Building
rubble_building NCC aligned
NCC Aligned Rubble Building, Red Offset: (44, 1), Blue Offset: (-26, -10)
statue unaligned
Unaligned Statue
statue NCC aligned
NCC Aligned Statue, Red Offset: (120, 0), Blue Offset: (-44, -2)