CS194-26 Project 1: Coloring the Prokudin-Gorskii photo collection

Joseph Jiang

Background

Sergei Mikhailovich Prokudin-Gorskii photographed many "colored" pictures by taking pictures of every scene in three different exposure. However, there was no way for Sergei to display or print the color photos at that time. The purpose of this project is to align the images, with the help of modern computers, to display these colored images.

JPG Images: Naive Algorithms

The naive solution to this problem is to vertically and horizontally align the Blue, Green, Red channels through brute forcing different displacement combinations and testing it aganist Sum of Square Differences (minimum = optimal).

This naive solution only works for smaller JPG images

Cathedral

green = (5, 2), red = (12, 3)

Monastery

green = (-3, 2), red = (3, 2)

Nativity

green = (3, 1), (8, 0)

Settlers

green = (7, 0), red = (15, -1)

Tif Images: Image Pyramid

The naive algorithm was only good for smaller JPG images so when it comes to dealing with larger .tif, we need to use a recursive alogrithm, image pyramid, to optimize the search.

Implementation

The algorithm essentially reduces the resolution of the picture by (1/2), (1/4), (1/8), (1/16), and finally (1/32). At (1/32) resolution, we run a naive search and find the best shift in a 20 pixel shift limit. From there, we return up to the next frame (1/16) and multiply the shift value by two. On this level and beyond, the algorithm finds the best shift in a 4 pixel limit until it is scaled back to the full-sized level.

Self Portrait

green = (77, 27), red = (174, 36)

Harvesters

green = (59, 16), red = (89, 86)

Icon

green = (40, 17), red = (90,22)

Lady

green = (50, 8), red = (123, 10)

Three Generations

green = (52, 12), red = (110, 10)

Train

green = (42, 4), red = (87, 31)

Turkmen

green = (56, 20), red = (115, 27)

Village

green = (65, 11), red = (137, 22)

Emir

Emir didn't align well when I tried to align Green and Red to the blue channel, so instead I aligned Red and Blue to the Green channel and was able to get a much better result.

green = (-49, -24), red = (57, 17)

Image Alignment By Using Edge Detection

For Emir, the alignment didn't work well when I tried to align red and green to the blue channel. This is because the images may have different brightness values. So to remedy this, we can use the color channels filtered through the canny edge detection filter. Below is a good exmaple of edge detection aligning an image well (Emir)

Emir

Emir before canny filter

Emir

Emir after canny filter

Automatic Contrast

Contrast is the difference between luminance and color to make certain parts of the image pop out. Since some images don't have enough contrast, its difficult to visualize differences. So to fix this, we rescale the image so pixels that are the darkest are 0 and the pixels that are the brightest are 1

Below is a before and after again with Emir as the example

Emir

Emir

Emir after canny filter