CS 194-26: Fall 2020
Project 1: Colorizing the Prokudin-Gorskii photo collection
Avik Sethia

Website Inspiration:Megan Lee

Background

Sergey Prokudin-Gorsky was best known for his pioneering work in color photography and his effort to photographically capture early 20th-century Russian Empire.  Gorsky’s approach involved recording three exposures of each scene onto a glass plate using a red, green, and blue filter. Our project was to combine the result of each of these three filters to produce the most appropriate and sharp colorized image.

Single Scale alignment

I used a naive exhaustive search based approach for low resolution jpeg images to arrive at the optimal alignment. I searched over all possible x,y displacements over the range of (-15,15) of the red and green channels over the blue channels.I chose the optimum displacement based on which displacement had the highest normalized correlation out of the 15^2 possible displacements I was searching over. I then cropped the pictures by a constant factor of 8% to get rid of peculiar looking single colour borders. Here are some before/after pictures with the accompanying offsets corresponding to each channel. I used 3 different image similarity metrics - L2 Norm, Normalized cross-correlation, and Structured similarity(SSIM). Based on a visual check, SSIM and NCC seemed to be performing very similarly but strictty better than the L2 Norm. NCC seemed to be a lot faster which is why I decided to use NCC as my chosen similarity metric. 

 

Problems I ran into with this approach

Pyramid Alignment

With pictures with higher resolution, exhaustive search turned out to be too inefficient an approach. I used a pyramid alignment based approach instead that scales down images till they reach a resolution we can perform exhaustive search on and then use the result of that exhaustive search to approximate the optimal displacement in the much larger, higher resolution image.

Problems I ran into with this approach

 

Results

Displacements are given by (dx, dy)

        Low resolution images

r: (3, 12), g: (2, 5)
r: (3, 6), g: (2, 3)
r: (2, 3), g: (2, -3)

High resolution images
r: (143, 24), g: (79, 31)
r: (191, 47), g: (88, 47)
r: (111,0), g: (47, 0)
r: (191, -12), g: (95, 18)
r: (115, 36), g: (56, 47)
r: (23, 89), g: (17, 40)
r: (111, 32), g: (63, 0)
r: (127, -14), g: (63, -6)
r: (111, -46), g: (63, 3)
r: (63, 31), g: (127, 31)
r: (35, -270), g: (59, 47)

Images of my choice

r: (13, 2), g: (6, 2)
r: (129, -20), g: (46, -4)
r: (11, 3), g: (5, 3)
r: (5, 3), g: (2, 2)

Bells and Whistles

Edge Detection

Some pictures look visibly better than the others because of the pyramid alignment algorithm. In particular melons, emir and self portrait look visibly disalligned. To counter this, I used the Canny edge detection algorithm in the OpenCV library . There seemed to be a very visible improvement in these images!

Before
r: (35, 270), g: (59, 47)
After
r: (109 , 41), g: (50 , 19)
Before
r: (143, 24), g: (79, 31)
After
r: (186 , 12), g: (87 , 7)

Auto Contrast

As a further improvement, I tried implementing an auto contrast function of sorts as well. What my function does is it takes the pixel values at the 8.5 percentile and the 91.5 percentile of the entire 2D array and scales the values in the entire array to the range between the 8.5th percentile value and the 91.5th percentile value. This makes the differences between pixels in this range a lot more pronounced which increases contrast. The cost is the clipped pixel values that fall in the top 8.5th percentile and bottom 8.5th percentile

. This contrast seemed to improve some of these images. Here is an example.

Before
No Contrast
After
Without Contrast