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,
The given image is divided into 3 images with equal vertical lengths.
1/15 of left and right, 1/12 of top and bottom of the image are cropped.
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.
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.
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).
The followings are some extra photos downloaded from the Prokudin-Gorskii collection
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.
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.
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.
Although this does not affect the alignment, increasing contrast sometimes result in prettier images.