CS 194: Image Manipulation and Computational Photography, Fall 2020

Project 1: Colorizing the Prokudin-Gorskii Photo Collection

Rami Mostafa, cs194-26-abo



Overview

For this project, I made an image alignment algorithm and used it to colorize the images of the Prokudin-Gorskii Photo Collection. Essentially, given an image composed of 3 very similar images taken on 3 different color channels, this algorithm will split the original image and align the 3 images into a single colorized photo.

The general process of this algorithm starts by reading in the image files in the current directory. Here, the images are split based on file type to determine if the image is a high or low resolution image. The low resolution images are then processed using a more exhaustive approach that still runs rather quickly since the images are of low resolution. These images are aligned by first cropping the edges off of the image, and searching over a specified range of shifts in both the x and y direction to find the smallest L2 norm. The shifted images are then stacked to create a single colorized image that will be saved, and the shifts are recorded in a txt file. Finally, the high resolution images are aligned via a similar approach. However, it would be too slow to exhaustively search a range for proper image alignment. Therefore, the high resolution alignment algorithm uses a more approximate approach by scaling down the resolution of the image, and finding the proper alignment of the scaled down versions instead. This is known as an image pyramid, where the shifts found at each level is scaled and applied to the level below, and this process is repeated until the full resolution image at the base level is shifted.

I ran into the problem of not finding a decent alignment of the images in emir.tif. However, I found that using a slightly less optimized approach, I was able to find a, still imperfect, but much better colorized image.

Low Resolution Images


Aligned Cathedral Image
Red Shift: [12, 3]
Green Shift: [5, 2]

Aligned Monastery Image
Red Shift: [3, 2]
Green Shift: [-3, 2]

Aligned Tobolsk Image
Red Shift: [6, 3]
Green Shift: [3, 3]

Low Resolution Images (Chosen by me)

Aligned Trees Image
Red Shift: [11, -7]
Green Shift: [8, -4]

Aligned Vase Image
Red Shift: [11, 1]
Green Shift: [2, 1]

High Resolution Images






Aligned Castle Image
Red Shift: [98, 4]
Green Shift: [34, 2]

Aligned Emir Image
Red Shift: [-58, -162]
Green Shift: [50, 24]

Aligned Harvesters Image
Red Shift: [126, 14]
Green Shift: [60, 16]

Aligned Icon Image
Red Shift: [90, 22]
Green Shift: [40, 16]

Aligned Lady Image
Red Shift: [116, 4]
Green Shift: [54, 0]

Aligned Melons Image
Red Shift: [178, 12]
Green Shift: [82, 8]

Aligned Onion Church Image
Red Shift: [108, 36]
Green Shift: [52, 26]

Aligned Self Portrait Image
Red Shift: [176, 36]
Green Shift: [80, 28]

Aligned Three Generations Image
Red Shift: [112, 10]
Green Shift: [54, 12]

Aligned Train Image
Red Shift: [88, 30]
Green Shift: [42, 2]

Aligned Village Image
Red Shift: [162, -30]
Green Shift: [66, 12]

Aligned Workshop Image
Red Shift: [100, -12]
Green Shift: [52, 0]

High Resolution Images (Chosen by me)

Aligned Flowers Image
Red Shift: [98, -24]
Green Shift: [50, -6]

Aligned Sunset Image
Red Shift: [50, 30]
Green Shift: [16, -14]

I had some issues with aligning the emir.tif image. However, by implementing a slightly less optimized pyramid align algorithm, I was able to produce a much better aligned image of emir in a still reasonable runtime.

Exhaustive Aligned Emir Image
Red Shift: [101, 43]
Green Shift: [57, 33]