Template Matching and the Russian Empire

Welcome

Welcome to Russia!

In the 190X's, well before the invention of color photography, visionary Russian photographer Sergey Mikhaylovich Prokudin-Gorsky traveled the empire with special equipment taking three-panel glass plate images that capture the subject in three separate color channels. He planned to use plates like these to recover and display fully colored images.

This site is the result of a 15-463 project at Carnegie Mellon University, in which the goal was to automatically combine the parts of images in the collection via template-matching. The entire collection, manually restored, is available at the Library of Congress online; it is as close to a time machine to Czarist Russia as you are like to get. These results came out of a MATLAB program.

It turns out that's sufficient for some very nice results...

Russia!

I love the details on this image. Take a closer look. Remember this predates color photography; no color was added since.

Close-up detail

Small Images and Basic Template Matching

Some images I worked on, such as the one at the top of this page, were provided in compressed jpg format and are being displayed at actual size. The trick is to break the plate image into three images and shift them so that they line up to form the color images. On these small images, I exhaustively searched all relative positions within a specified range (specified at runtime to the program I wrote). I used the Sum of Squared Differences metric to estimate how lined-up images were.

The difficulty here is that one location in the final image will not have the same intensity in each color channel. So, what I actually aligned were the edges present in the images. This was facilitated by convolving the component images with a simple vertical edge detection mask before processing (and thresholding the result, though this is not theoretically important).

This was by and large sufficient to produce images such as

Turn of the century Russia looks good in jpg. Especially that last one which is actually one of Carnegie Mellon's engineering buildings. Have to watch the course staff, they're sneaky. More low-res images can be found here. My program quite handily dealt with them.

Large Images and the Image Pyramid

You may have noticed at least one restored image above with finer detail than the small jpg images. For the project, I also processed several large (very high resolution tif) images. In these cases, exhaustively searching the range of displacements necessary to align the component images was prohibitively expensive. I used an image pyramid to solve this: it the input images were too big, instead align resized (smaller) versions thus giving a starting point for the search in the larger image, reducing the range that mist be searched in that image.

This made the large images feasible (though they still took several minuets each to process). However it was not enough to get ascetically good results. I was able to get them to the level you see now by cropping the border from the original plate image prior to dividing it into three separate images for alignment. Those outside the image edges and pixels were throwing off the search.

Many of these images, which I have stored as high-res jpgs to conserve space, came out well (right-click and "view image" to access the full-sized version):

Unfortunately there were artifacts in some of the large images that I must point out and explain.

I am pretty sure this was thrown off by the noticeable burn/fade in the red component image of the plate.

These both suffer from a slight right-shifting of the blue component. I believe that the plate image is slightly crooked, and that a more precise cropping of the top/bottom plate borders may help, respectively.

But this one came out great:

(I was worried about, e.g., this dress pattern)

All large-scale images are collected here in their full, not-resized-for-your-browser glory.