CS 194-26 Project #1: Colorization

Yue Zheng


Overview

In this project, we take the digitized Prokudin-Gorskii glass plate images, extract out the three color channel images, align them and lay them on top of each other to produce a single RGB color image. Since the negatives were taken a long time ago, the quality of them are varied, with many blurry or ccorroded on edges. The challenge of this project is to align the three color channel images as precisely as possible to create a clear, color image, and in addition, possibly find ways to deal with the flaws of the aged nevatives to product better outcomes.

Approach

Three color channel images are extracted from the glass plate negative image by splitting it vertically into three parts of equal length. To align the three channels, I calculate the optimal displacements of the channels along the x and y axis.

For small images, this is done simply by exhaustively searching over all possible displacements in the interval of [-15, 15] pixels on each axis, score each one using NCC, and take the displacements with the best score. When calculating the metrics, I discarded 1/8 of the shifted image on each side to rule out noise such as corroded edges and rolled over image parts.

For images larger than 350x350 pixels, I used the image pyramid approach. I recursively resize the image to be half the original size and call the alignment function to get the optimal x, y displacements of the smaller image. Then I double the returned displacements and then search for the best displacements in intervals within 15 pixels of the previous displacements.


Results

Small images

Cathedral

Icon

Green: (2, 5) Red: (3, 12)


Monastery

Monastery

Green: (2, -3) Red: (2, 3)


Nativity

Nativity

Green: (1, 3) Red: (0, 7)


Settlers

Settlers

Green: (0, 7) Red: (-1, 15)


Large Images

Emir

Emir

Green: (23, 45) Red: (-205, 99)


Harvesters

Harvesters

Green: (16, 58) Red: (14, 124)


Icon

Icon

Green: (17, 43) Red: (23, 91)


Lady

Lady

Green: (8, 55) Red: (12, 117)


Self-portrait

Self-portrait

Green: (28, 77) Red: (36, 174)


Three generations

Three generations

Green: (14, 52) Red: (11, 111)


Train

Train

Green: (6, 42) Red: (33, 91)


Turkmen

Turkmen

Green: (21, 55) Red: (28, 114)


Village

Village

Green: (12, 64) Red: (22, 137)


Additional Images

Canoe

Canoe

Green: (-6, 13) Red: (-12, 132)


Raft

Raft

Green: (-22, 49) Red: (-54, 101)


Window

Window

Green: (16, 22) Red: (17, 60)


Failures

My approach worked for most of the images except emir.tif, since the colors of the dress in the three channels are very different.


Bells and Whistles

Edge Detection

To explore different features that can be used to align the three color channels, I used edges as an alternative feature. I used the sobel filter from the skimage library to get images of the edges in the three color channels, than performed optimal displacement searching using NCC on the edge images. Using edge detection, I got a much better alignment for the emir.tif image. The rest of the images produced similar results using the two different features.

Emir: Before

Emir

Emir: After

Emir

Auto-cropping

To automatically crop the colored borders produced by displacements, I eliminated rows and columns near the four sides of an image if for any two color channel image, the average values of that row/column has an absolute difference larger than 0.2. This approach worked for most images, but sometimes cropped off more than desired because of decolorization of color channel images. It also failed to cut off some black boarders, possibly because all of the three color channels had similar black boarders. Below are some examples of successfully auto-cropped images:

Self-portrait: Before

Self-portrait

Self-portrait: After

Self-portrait

Three generations: Before

Three generations

Three generations: After

Three generations

Train: Before

Train

Train: After

Train

Auto-contrasting

To achieve automatic contrasting, I equalize the histogram of an image using the exposure.equalize_hist method from skimage. The auto-contrasting is done on auto-cropped images. This achieved pretty good results for most of the pictures, but I observed that this approach may amplify flaws and noise on the image. Below are some examples of successfully auto-constrasted images:

Canoe: Before

Emir

Canoe: After

Emir

Train: Before

Emir

Train: After

Emir

Turkmen: Before

Emir

Turkmen: After

Emir