Colorizing the Prokudin-Gorskii photo collection

Images of the Russian Empire

by Zhimin Cai (cs194-26-ace)

Alignment

We want to find the correct displacement offsets of the green and red channels with the blue channel. We compute the alignments for each pair of channel separately.

We first cut 10~20% of the margins so white & black frame and noisy edges area are removed from the channels.

Then, we search within a specified range (10~20 pixels) for the best possible displacement offset combinations. To decide which x, y rolling combination works better, we use a heuristic based on Sum of Squared Differences (SSD). The lower the ssd value, the better the alignment.

cathedral
Cathedral G[5,2],R[12,3]
monastery
monastery G[-3,2],R[3,2].
tobolsk
tobolsk G[3,3],R[7,3].
iconG/[42, 18], R/[90, 23]
icon_G/[42, 18], R/[90, 23]
ladyG[40, 0], R[109, 8].jpg
lady_G[40, 0], R[109, 8]
harvesters_G[60, 18],R[124,14]
harvesters_G[60, 18],R[124,14]
three_generationsG[52, 17], R[110, 12].jpg
lthree_generations_G[52, 17], R[110, 12]

Most images can be done quit well, but Some images, like self_portrait, emir, melons, need larger offset range to find a better alignment.

I was cropping 10~20% of the pixels from the center of images to do alignment in a faster manner, but some images need to shift the location of this window a bit, since the area's color and brigtness was not good enough for ssd alignment to perform well.

emir_G[50, 28],R[109,44]
emir_G[50, 28],R[109,44]
self_portrait_G[81, 35], R[179, 42]
self_portrait_G[81, 35], R[179, 42]
melonsG/[84, 10], R/[180, 13]
melons_G[84, 10], R[180, 13]

Image Pyramid Processing

For small images, the naive alignment algorithm can search for best displacement vectors in 0.2s. However, with larger .tif images, searching can be very expensive, so we need an image pyramid algorithm to search from coarser (smaller, resized version) image to finer (larger size version) in order to reduce the search range at each level and improve performance.

We resize the image to the half, and recuisively align the new aligned version from coarser level at current level. As a result, we align current level image based on the best result from coarser alignment, so we don't need to research too far to get to same result.

village_G[65, 13], R[137, 23].jpg
village_G[65, 13], R[137, 23]
train_G[44, 7], R[86, 32]
train_G[44, 7], R[86, 32]
workshop_G[54, 0], R[107, -12]
workshop_G[54, 0], R[107, -12]
onion_church_G[51, 27}], R[109, 37]
onion_church_G[51, 27], R[109, 37]

Auto Cropping

Since alignments have rolled the image arround and original black and white outer frame, the output images does not look that good overall. I tried to pick the midder row/ col of the image to detect the boundery of these edges through finding the largest gradient change within 5~10% of the margin.

This produced good results on images. But a few images were over-cropped due to the function getting greatest gradient changes on other place and treating them as borders.

cathedral_cropped
tobolsk_cropped
lady_gamma_corrected2
lady_cropped
Teacher
harvesters_cropped

Contrast Adjustments

I changes the gamma of the explosure to improve contrast of some images. These images has been improved to be less blury, and some of them are more clear on some overexposure part of the image, such as the window area in workshop.tif, and house roof of melons.tif.

onion_church_G[51, 27}], R[109, 37]
onion_church_G[51, 27], R[109, 37]
onion_church_G[51, 27}], R[109, 37]
onion_church adjusted
monastery
monastery
monastery
monastery adjusted
onion_church_G[51, 27}], R[109, 37]
onion_church
onion_church_G[51, 27}], R[109, 37]
onion_church adjusted
workshop_G[54, 0], R[107, -12]
workshop
monastery
workshop adjusted

Extra images

Cathedral2_gamma_corrected2
Cathedral2
Cathedral2_gamma_corrected3
Cathedral3
old man
old man
Crew_steamship_gamma_corrected2
Crew_steamship