CS180 Project #1: Colorizing the Prokudin-Gorskii Photo Collection

Context

Sergei Mikhailovich Prokudin-Gorskii was a pioneer of color photography, capturing the vast Russian Empire before 1918. His unique method involved taking three separate photographs through red, green, and blue filters. This project involves digitally combining these images to recreate the original color scenes.

Main Approach

The primary objective of this project is to align and colorize the Prokudin-Gorskii glass plate negatives through sophisticated image processing techniques. This process involves meticulously separating and then overlaying three filtered images (representing the Blue, Green, and Red channels) to reconstruct the original color photographs with minimal visual distortions.

Data

Each glass plate image will be divided into three equal parts representing the Blue, Green, and Red channels. The program will align the Green and Red segments to the Blue segment and output the (x,y) displacement vectors used for alignment. A predefined margin of 0.05 is cropped off from each side of every channels to avoid the borders affecting the evaluation of alignment metrics, based on the provided cropping function.

Displacement Window Search

The alignment process is driven by an exhaustive search across a defined range of possible displacements. The ideal alignment is identified by selecting the displacement that maximizes Structural Similarity Index (SSIM) , a method that quantifies the visual impact of differences between the compared images. This metric is chosen over Normalized Cross-Correlation (NCC) as it focuses on enhancing structural integrity and reducing discrepancies in color intensity between the channels.

Pyramidal Approach for Alignment

For high-resolution images, exhaustive search becomes computationally expensive. To manage this, an image pyramid approach is employed. The image is processed at multiple scales, beginning from the coarsest scale (smallest image) and progressing to finer scales, refining the alignment at each step at a reduction factor of 0.5. This method allows for rapid convergence to the best alignment with considerable computational efficiency.

Bells & Whistles

Two additional functions are implemented: automatic cropping and automatic contrasting.

Automatic Cropping

The auto_crop function performs automatic cropping on grayscale images, allowing the removal of black and white borders. A outer parts, by default 0.1, of the image are thresholded. This function uses two thresholding operations:

The thresholded images are then combined, leaving the center of the image unprocessed. The largest contour in the thresholded area is found, and a bounding rectangle is drawn around it to crop the image. The predefined cropping is still completed after this to eliminate the effects from not processed borders.

Original Cathedral

Original

Thresh Cathedral

Thresh

Cropped Cathedral

Cropped

Automatic Contrasting

Contrast enhancement is achieved via auto_contrast, which applies Histogram Equalization to each color channel of an image, which modifies the distribution of pixel intensities across each color channel by the mapping based on the Cumulative Distribution Function (CDF) from the histogram. This method ensures that the dynamic range of the tones is fully utilized, improving the overall visual perception of the image.

Outputs

Displacements are based on cropped images.

Outputs after Automatic Cropping and Contrasting

Displacements are based on cropped images.