Aligning Prokudin-Gorskii glass plates

Anbo Cao

Overview

The goal of this assignment is to take the digitized Prokudin-Gorskii glass plate images and, using image processing techniques, automatically produce a color image with as few visual artifacts as possible.

Method

Single-scale version

To align the RGB channels, we brutally search all possible offset for G/R channel that aligned with B channel. B/G/R channels are simply sliced from the original image in equal heights using the skeleton code.

To measure the score of the alignment, by deafult it use SSD(or NCC) metrics:

SSD metrics: Compute Sum of Squared Differences (SSD) distance between two images. NCC metrics: Compute the dot product of two normalized images as vectors.

Problems

The edge of the picture caused lots of problem since they are usually all white or black. To avoid this, I crop 1/8 of the image to avoid sharp edge.

Pyramid version

To align larger images, the single-scale version is too slow because searching a large image alignment requires search a very large range of windows, which scales quadratically.

To solve the problem, the new algorithm use a pyramid style search where it scale down images by a factor of 2 until the width or the height of the image is less than 32. Then it use single-scale search for the small image, and use it as the center of searches for the higher level. The search window of the pyramid version can be much smaller, which greatly reduces the computation time.

Problems

The image of emir fails as mentioned in the spec of the project. Also it might fail for some image that has a highly repeated pattern.

Result

No offset Best result
offset: G(53, 0) R(105, -12)
offset: G(49, 24) R(-341, -1622)
offset: G(-3, 2) R(3, 2)
offset: G(53, 14) R(111, 11)
offset: G(81, 10) R(178, 13)
offset: G(51, 27) R(108, 36)
offset: G(42, 6) R(87, 32)
offset: G(3, 3) R(6, 3)
offset: G(41, 17) R(89, 23)
offset: G(5, 2) R(12, 3)
offset: G(65, 12) R(138, 22)
offset: G(78, 29) R(176, 37)
offset: G(59, 17) R(124, 13)
offset: G(55, 9) R(116, 12)

Extra Credit

Auto Contrast

The code has the option to enable auto contrast, making the largest value to be 1 and the smallest to be 0. Therefore a brighter image will not cuase an alignment problem with a image that is darker.

Edge detection

The code also has the option to enable sobel filter, which detect the edge of the picture. Rather than comparing the pixels, the algorithm will use edges to find the maximum similarity

Using above to method will fix the problem of emir.tif

Naive pyramid method EC options enabled
offset: G(49, 24) R(-341, -1622) offset: G(49, 24) R(107, 40)
In [ ]: