Project 1: Coloring Black and White Images
Melissa Su, cs194-26-aay
Background
As early as 1907, Sergei Mikhailovich Prokudin-Gorskii knew that one day
there would be color photography. He travelled across the Russian Empire
to record images onto a glass plate with a red, green and blue filter.
The goal of this project is to use the full-size glass plate images to produce
the color images Sergei envisioned.
Single Scale Implementation
First I extract the middle of the images. With the cropped images,
I roll one over the other to find the best displacement over a [-15, 15] window by calculating the
SSD (sum of squared differences). The best displacement is the one that has a minimum SSD.
Results
Image Pyramid Implementation
For the larger tif files the single scale implementation does not suffice.
The Image Pyramid Implementation works by recursively scaling the image down
by 1/2, and the base case occurs when the image is a more manageable
size (250x250) and calculates the best displacement by using the SSD as the metric.
This best displacement is passed up to and image twice it's scale, this images
aligns using the best displacement and adjusts it by calculating a new displacement
over a [-2,2] range. We multiply the displacement from the previous level by 2 and
add the new displacement from the current level to return the scaled displacement.
This is the process until we return to the original size image and we return
the scaled displacement.
Challenges
I unfortunately run on a Windows operating system for my personal device.
Running the code would give me 'Memory Errors' and 'Runtime Exceptions' for
who knows what reason. To solve this I would ssh into the school's instructional machines.
Shiry also sent me her blogpost on iPython. I wish I had gone to her office hours earlier;
however, I will use this knowledge for future projects. The village.tiff does not align well.
My theory is that I am aligning the photo on the coarsest level from the center, and the
center of this image is very similar in pixel values and therefore does not displace effectively.
Results
For emir.jpg I aligned against the green channel.
Filename |
Red Displacement |
Green Displacement |
cathedral.jpg |
(3,11) |
(2,4) |
emir.tif |
(18,57) |
blue displacement(-25,-50) |
harvesters.tif |
(15,124) |
(17,60) |
icon.tif |
(23,90) |
(17,42) |
lady.tif |
(7,112) |
(7,49) |
monastery.jpg |
(2,2) |
(2,-4) |
nativity.jpg |
(0,8) |
(0,2) |
self_portrait.tif |
(36,176) |
(30,78) |
settlers.jpg |
(0,14) |
(0,6) |
three_generations.tif |
(13,111) |
(15,49) |
train.tif |
(32,85) |
(5,39) |
turkmen.tif |
(29,115) |
(21,55) |
village.tif |
(-89,0) |
(-11,0) |