Project 1: Colorizing the Prokudin-Gorskii Photo Collection

Kachi Onyeador

Overview

The task of this project is to colorize the Prokudin-Gorskii photo collection. His photo collection consists of 3 separate color channel images that appear to the normal eye as gray. Our job was to combine these separate color channel images into one colorized image output.

My Approach to JPG images

First, the 3 color channel images are separated (blue, red, green) and then cropped with my crop function. Then, they are independently aligned (blue aligned onto red and then blue aligned onto green). My alignment function looks through the images over a -20 by 20 range in both the x and y directions. It then chose the displacement that aligned the images the best. I used the Sum of Squared Differences function as the mathematical tool to do the distance alignment. My alignment function returned the best displacement which the images used to align onto each other with (blue aligned onto red and blue aligned onto green). Then, I stacked those new images onto each other (ar, ag, b) and it produced the final colorized image.

My Pyramid Algorithm approach

When approaching larger images, like tiffs, I knew my regular align function would not work because the image would be too high resolution to do this function on. Hence, I created a separate function to handle my tiff images. It was similar to my function that handled my jpg/smaller images, however, the one biggest difference was that instead of calling align on these images, I called a function "pyramid" that I created. Within this pyramid function, it operated recursively. It would first check if my image was small enough (the height of the image was less than 500) or it would check if the image level was equal to 0 (I pass in the images with a level of 10). If the image ticked any of these boxes, then I knew it would be small enough to use my align function on. Otherwise, I would rescale the image to be half the size and subtract a level and recursively call this pyramid function. As I'm recursively calling/breaking down this image, it is additively evaluating the optimal displacement across more numbers then our basic range of -20 to 20. I then return this most optimal displacement I found by recursively breaking down the image and adding up the displacements from that. Then I do what I did before with the jpg images and use this pyramid algorithm displacement to align the images onto each other (blue aligned onto red and blue aligned onto green). Then, I stacked those new images onto each other (ar, ag, b) and it produced the final colorized large tiff image.

Cathedral
green displacement: [5, 2] red displacement: [12, 3].
monastery
green displacement: [-3, 2] red displacement: [3, 2]
tobolsk
tobolsk.jpg green displacement: [3, 3] tobolsk.jpg red displacement: [6, 3]
xtraimage1
extraimage1.jpg green displacement: [4, 1] extraimage1.jpg red displacement: [7, 1]
extraimage2
extraimage2.jpg green displacement: [6, 3] extraimage2.jpg red displacement: [13, 5]
extraimage3
extraimage3.jpg green displacement: [3, -1] extraimage3.jpg red displacement: [11, -2]
castle
castle.tif green displacement: [35, 3] castle.tif red displacement: [98, 4]
workshop
workshop.tif green displacement: [53, 0] workshop.tif red displacement: [105, -12]
train
train.tif green displacement: [42, 5] train.tif red displacement: [87, 32]
three_generations
three_generations.tif green displacement: [53, 14] three_generations.tif red displacement: [112, 11]
self_portrait
self_portrait.tif green displacement: [78, 29] self_portrait.tif red displacement: [176, 37]
onion_church
onion_church.tif green displacement: [51, 26] onion_church.tif red displacement: [108, 36]
melons
melons.tif green displacement: [81, 10] melons.tif red displacement: [178, 13]
lady
lady.tif green displacement: [51, 9] lady.tif red displacement: [111, 12]
harvesters
harvesters.tif green displacement: [59, 16] harvesters.tif red displacement: [124, 13]
icon
icon.tif green displacement: [41, 17] icon.tif red displacement: [89, 23]
emir
emir.tif green displacement: [49, 24] emir.tif red displacement: [102, -195]
Problems

The emir image had difficulty aligning. This is because the nature of the glass plate images. With the way the brightness in each cell differs it does not do well under normal calculations. But the ways I could see this being improved is to either improve the brightness levels or perform the calculations not using the pixels but instead using the gradients

Bells and Whistles

I initially thought my jpg image was super blurry and I was very stuck on what to do. I noticed that I had this weird issue where even though I cropped all the images borders before aligning, when I would try to align the blue onto the red (ar) and the blue onto the green (ag), my ar and ag image would get this random edge problem attached to it. And when I did the final stacking, the image would be a bit blurry, but still colorized. So I wanted to look into something that would help with automatic cropping and edge detection. After looking through the skimage documentation, I found out about a function called roberts that would do the edge detection for me. So, when calling my align function (I still did the manual cropping), I passed in the roberts function being applied to the images instead of just passing in the images to the align function. By doing this, it made my image so much clearer! I was pleasantly surprised that such a simple implementation would make a big difference. (bells and whistles applied on the left image)

Blurry bells and whistles pic Clear bells and whistles pic