< Colorizing the Prokudin-Gorskii Photo Collection

Colorizing the Prokudin-Gorskii Photo Collection

CS194 Project 1
Maya Hammond


Overview

The purpose of this project is ot digitally replicate using Prokudin-Gorskii glass plate images and use image processing techniques to produce. This process will included extracting three color channel images, and place them on top of each other by shifting them until they are aligned so that they form a single RGB color image. First, I diveded the images into three equal parts of R, G, and B. Then, I aligned the R image and G image , than lastly the B image on top. This alignment is found by finding the ideal displacement of all of these images.


Low Resolution Images

First, I slipt my images into the three different color channels of R, G, and B. I then croped each of these images by 20 pixels on each side. In order to align the low resolution image, I used the Sum of Squared Differences(SSD) function, which is sum(sum((image1-image2).^2)), to find the possile displacements over a window of (-15, 15). For each possible displacement I got I shifted the image on both the columns and rows to see if this displacement was smaller, if it was than I updated this as my new best displacement. I was able to do this by creating an align function that returns the best displacement and than a shift function that actually shifts the images into alignment.

"Cathedral Image"
Displacement : GB : [5,2]     RB : [12,3]
"Monastery Image"
Displacement : GB : [-3,2]     RB : [3,2]
"Tobolsk Image"
Displacement : GB : [3,3]     RB : [6,2]

High Resolution Images

Since the tiff images are much larger in order to cut down the runtime we create an image pyrmaid. An image pyrmaid is when you recursion to rescale the size of the image by a rescale factor, the factor I chose was 0.5. In order to stop your recursive function I chose a set number of levels, which was 5. Once the recursive function got to the base case it was able to use the align function that was defined before for the low resolution images. Then after exploring the smallest level it would take the displacement it found then add this to the displacement divided byt the rescale factor. When one adds up these two displacements the previous levels, plus the rescaled displacement it allows the function to search displacement values it did not have access to in the smaller levels. Once the recursive function finihes it is able to find the best displacement for the largest image, based off the displacement of the smaller ones. Then once you use the image pyrmaid function to find the best displacement, you can use the shift function to actually align the images. Here before I started this process, to also help cut down the runtime I cropped each side of the image by 300.

"Castle Image"
Displacement : GB : [49,2]     RB : [98,4]
"Harvesters Image"
Displacement : GB : [62,7]     RB : [123,13]
"Icon Image"
Displacement : GB : [45,11]     RB : [89,23]
"Lady Image"
Displacement : GB : [56,6]     RB : [112,12]
"Melons Image"
Displacement : GB : [89,6]     RB : [178,13]
"Onion Chruch Image"
Displacement : GB : [54,18]     RB : [108,36]
"Self Portrait Image"
Displacement : GB : [88,18]     RB : [176,37]
"Three Generations Image"
Displacement : GB : [56,6]     RB : [111,11]
"Train Image"
Displacement : GB : [44,16]     RB : [87,32]
"Workshop Image"
Displacement : GB : [52,6]     RB : [105,-12]

Extras

"Study Image"
Displacement : GB : [5,1]     RB : [9,2]
"Farm Girl"
Displacement : GB : [1,0]     RB : [7,0]

Problems

One problem that I came across was that the emir image was a failure case because of the different brightness of the colors, for example the b color channnel was very light, whereas the red color channel was very light. Therefore, my SSD function was not a strong enough metric to find the best displacement of these photos and they were misaligned.

"Emir Image"
Displacement : GB : [27,-367]     RB : [54,-735]

Another problem I came across was since, I was running my code on a local server it was running kind of slow, however when you run it on google colab or another server it runs much faster.