Project 1: Images of the Russian Empire

Overview

Sergei Mikhailovich Prokudin-Gorskii took photographs all over the world. He would record three exposures of each image onto a glass plate using red, green, and blue color filters, hoping that somone would be able to take these exposures and produce color photographs. The Library of Congress was able to create color images from his glass plate negatives, and I attempted to do the same in this project with various image processing techniques.

Approach and Details for the Main Project

Naive Single-Scale Implementation

I first seperated the glass plate negatives into three images corresponding to the RGB channels. Then, I had to decide how to best align these three images to correctly produce a final colored image. My first alignment algorithm was one that took the image from the Red or Green channel and searched over a [-15, 15] pixel window of x,y displacement to find the best overlap with the image from the Blue channel. I used the L2 norm or Sum of Squared Differences (SSD) to score how well the red or green image overlapped with the blue one. The SSD method shows a lower score when there is more overlap between two images, so minimizing the SSD's result would determine the best displacements of the red or green image. When calculating the SSD of two images, I ignored pixels within 7.5% of the width from the left and right sides of the images and within 7.5% of the height from the top and bottom of the images. The borders of the images were unreliable, so ignoring pixels near those borders improved the accuracy of SSD. Using the alignment algorithm on the red and green images allowed me to produce a non-blurry colored final photo.

Multiscale Pyramid Implementation

While the naive alignment implementation ran in good time for the smaller jpg images, the tiff images had many more pixels and required a more efficent version of the alignment algorithm. I achieved this by making my naive implementation recursive for a multiscale implementation. I rescaled the size of the red/green image and the blue image by half until the height was less than or equal to 128 pixels. Then, I searched over a [-15, 15] pixel window as in the naive implementation. After finding the best x,y displacement, I would scale up the two images by 2. For these new resized images, I would only search within a range of one pixel less and one pixel more than twice the x,y displacement found in the previous iteration. I would repeat this process until I found a displacment for the original resolution of the red/green image.

Results - Displacment for red and green is listed in the form (y-displacment, x-displacement)

jpg images


Monastery
Red: [3, 2], Green: [-3, 2]

Settlers
Red: [15, -1], Green: [7, 0]

Nativity
Red: [7, 0], Green: [3, 1]

Cathedral
Red: [12, 3], Green: [5, 2]

tiff images


Emir
Red: [103, 55], Green: [49, 24]

Harvesters
Red: [124, 13], Green: [60, 16]

Icon
Red: [89, 23], Green: [41, 17]

Lady
Red: [116, 11], Green: [56, 8]

Three Generations
Red: [112, 11], Green: [53, 14]

Self Portrait
Red: [176, 36], Green: [79, 29]

Village
Red: [138, 22], Green: [65, 12]

Lady
Red: [116, 28], Green: [56, 21]

Train
Red: [87, 32], Green: [42, 6]

Additional Images


Grave of Mother-Superior Evpraksiia
Red: [28, -4], Green: [11, 4]

Ostrechiny
Red: [133, -12], Green: [13, -5]

Icon of the Last Judgement
Red: [113, 20], Green: [50, 13]

Bells and Whistles

Auto Contrasting

For automatic contrasting, I rescaled the image intensities for each channel such that the lowest 5% of intensities were mapped to 0 and the highest 5% of intensities were mapped to 1. This helped images appear more crisp and allowed figures to stand out more from their backgrounds.


Before

After

After automatic contrasting, the cathedral image appears brighter and more clear. The After picture looks less washed out and the cathedral itself looks more defined.


Before

After

After automatic contrasting, the turkmen image appears less faded and more clear. In the After picture, the man and the camel stand out more compared to their background.

Edge Alignment

Instead of aligning on RGB similarity, I also used edges to align the three channels. I used the sobel filter on each channel to produce images that emphasized the edges in the photo. The pixel values were high for edges and low otherwise. I then used the SSD alignment algorithm that I had for the main project but used it to align the images produced by the sobel filter. This method tries to align the images using their edges.


With RGB Similarity
Red: [7, 0], Green: [3, 1]

With Edge Alignment
Red: [7, 0], Green: [3, 1]

With the Nativity image, edge alignment produces the same result as an alignment based on RGB similarity.


With RGB Similarity
Red: [116, 11], Green: [56, 8]

With Edge Alignment
Red: [120, 13], Green: [56, 9]

With the Lady image, the edge alignment result appears slightly more accurate than the RGB similarity, as it appears slightly more crisp.

Automatic Cropping

Since the pixel values of the color channels are usually more different from each other near the borders of each image, I took the mean of the pixel values of each column starting from the left side of the image for each color channel after I had aligned them and found the last column before 1/8 of the width from the left border of the image that had a difference between the means of at least two color channels over a threshold of 0.5. I stopped checking columns at 1/8 of the width from the edge because there was a possibility that my cropping algorithm would chop too much of the image if I checked all the columns. This last column would become the left boundary for cropping. I used the same method on the right edge of the image to find the right boundary. I also used this method with the height of the image instead of width to find the top and bottom boundaries for cropping.


Before

After

With automatic cropping, a lot of the color fringing is removed from the Settlers image, particularily at the top.


Before

After

With automatic cropping, a lot of the color fringing is removed from the top and right of the Lady image.