CS 194-26: Computational Photography, Fall 2020

Project 1: Colorizing the Prokudin-Gorskii photo collection

Michelle Fong, CS194-26-ael


In this project, I used the sum of squared differences (SSD) distance to align and subsequently colorize the digitized glass plate images from the Prokudin-Gorskii photo collection. The starter code conveniently already extracts the three color channel images for me, but it was my job to implement the aligning process. There is a basic aligning function well suited for smaller images (like in .jpg format) and there is a pyramid aligning function that is better suited for larger images.

Basic Alignment

My code uses a simple nested for loop to find the smallest SSD distance between two image matrices over a [-10, 10] pixel range. Initially, I was having difficulty finding the correct offsets, so I crop a 1/16th off of each side of the images before aligning which eliminates noisy input from the dark borders of the images.

"Cathedral" G(5,2) R(9,3)
"Monastery" G(-3,2) R(3,2)
"Tobolsk" G(3,2) R(6,3)

Pyramid Alignment

Pyramid alignment is the process of taking the input image and first finding the correct offset on a much smaller version of the image, so as to narrow down the search space for later iterations. This algorithm is better suited for bigger images so that the overall search time is shorter. The algorithm continually resizes the image larger (usually by a factor of 2) until it reaches the original size. In my code, I resize the image five times, by a factor of 2 each time. The first iteration searches a range of [-10, 10] from the initial displacement of 0 and each iteration thereafter searches a range of [-2, 2] from the previous iteration's scaled-up displacement. The reason behind searching this range [-10, 10] for the first image was trial and error. Originally, I had a smaller range of [-5, 5] which worked well for some images like "Emir" but I found that I needed to increase the range in order to align images like "Self Portrait" correctly.

"Castle" G(35,3) R(99,4)
"Emir" G(42,24) R(106,41)
"Harvesters" G(59,16) R(124,13)
"Icon" G(40,17) R(124,13)
"Lady" G(47,9) R(109,12)
"Melons" G(82,10) R(178,14)
"Onion Church" G(51,26) R(108,36)
"Self Portrait" G(78,28) R(176,36)
"Three Generations" G(53,14) R(111,11)
"Train" G(42,5) R(85,32)
"Workshop" G(52,0) R(104,-11)

Bells and Whistles

I also implemented intermediate alignment in the pyramid alignment algorithm, where I first align the green channel with blue, then align the red channel using the new aligned green matrix. This allowed me to correctly align the red channel on "Emir" and also improved the alignment on other images.

WITHOUT intermediate alignment
WITH intermediate alignment

Some Photos of My Choosing

I downloaded and ran my image processing code on more photos from the collection.

"Siren" G(49,-6) R(96,-24)
"River" G(20,17) R(87,29)
"Dune" G(43,5) R(104,-3)
"Sunset" G(0,-31) R(67,-31)