CS194-26 Project 1 Aligning Prokudin-Gorskii Glass Plates

Images of the Russian Empire:

Colorizing the Prokudin-Gorskii photo collection


This project aims to make color images from the digitized Prokudin-Gorskii glass plate images. In order to do so, one has to extract the three color channel images, and with proper techniques, align / modify the channels and stack them together to get the pretty color images. Here is an example of an image that needs to be processed.


You can fine a more detailed explanation of the project here.


An images is processed in following steps,

  1. The given image is divided into 3 images with equal vertical lengths.
  2. 1/15 of left and right, 1/12 of top and bottom of the image are cropped.
  3. The red and green channels are aligned to the blue channel.
    I used normalized cross-correlation as the metric to measure the alignment of two channels. The naive way to align the parts is to exhaustively search over a window of possible displacements (say [-15,15] pixels). However, this method will take too much time when dealing with large images. So instead, image pyramid method is applied for faster alignment. An image pyramid represents the image at multiple scales.
    image pyramid
    image from wikipedia (original image)
    Starting from the image of coarsest scale, we search for the best alignment and on the next less coarse scale, again search for the best alignment but only within the displacements narrowed down in the previous step. I iterated over scales of [0.0625, 0.125, 0.25, 0.5, 1]. This greatly improved the speed of alignment. For instance, when aligning the emir image provided above, the naive alignment takes about 268 seconds whereas the pyramid alignment takes only about 22 seconds.
  4. The aligned images are stacked together to form the colored image.


The following images are the results. The captions indicate the displacements of green and red channels (dx, dy).

castle:g(35, 3), r(98, 4)
cathedral:g(5, 2), r(12, 3)
self_portrait:g(78, 29), r(176, 37)
harvesters:g(59, 16), r(124, 13)
icon:g(40, 17), r(89, 23)
3gen:g(53, 14), r(112, 11)
melons:g(82, 10), r(179, 13)
monastery:g(-3, 2), r(3, 2)
onion_church:g(51, 26), r(108, 36)
train:g(42, 5), r(87, 32)
workshop:g(52, 0), r(104, -12)
tobolsk:g(3, 3), r(6, 3)
emir:g(49, 24), r(99, -205)
lady:g(48, 9), r(112, 11)

The followings are some extra photos downloaded from the Prokudin-Gorskii collection

specimen:g(40, -38), r(108, -81)
poliana:g(36, 12), r(71, 14)
urals:g(40, 33), r(94, 59)

Points of Improvement.

● Notice that while all the other images seem fine, 'emir' is not aligned properly. If brightness values differ considerably along different channels, alignment through the pixel values of rgb channels might not result in proper alignment.

● The result images contain noisy borders. The pictures would look a lot cleaner if we can get rid of them.

Bells & Whistles

Some extra methods were applied to enhance the quality of the images.

Auto Cropping

Cropping of the edges have big influence on image alignment. Instead of manually cropping the edges by predefined proportion, I implement a boder detection method to somewhat detect the useless borders. This is done by turning the image into a grayscale image and then iterating over the rows and columns to detect ones of which more than 75% of pixels are 'too white' (pixel values bigger than 0.85) or 'too dark' (pixel values smaller than 0.25). Note that the iteration starts from the outermost rows/columns and breaks out when non-border row or column is found.

After stacking of rgb channels, I apply the auto cropping once more to get rid of the noisy boundaries.

train without auto-crop
train with auto-crop

Edge Align

Some of the images, especially 'emir.tif' are not aligned well even with exhaustive alignment. According to the project doc, this is because the images to be matched do not actually have the same brightness values. To solve this issue, instead of aligning based on RGB similarity, I tried aligning based on the 'edge images' of the channels using the edge detector provided by skimage.
rgb aligned emir.
edge aligned emir.

Increase Contrast

Although this does not affect the alignment, increasing contrast sometimes result in prettier images.

self_portrait without added contrast
self_portrait with added contrast
specimen without added contrast
specimen with added contrast
melons without added contrast
melons with added contrast