CS 194-26 - Project 1

Images of the Russian Empire: Colorizing the Prokudin-Gorskii photo collection 🇷🇺

Andrew Ke

Overview

I used the starter code to divide the image in to three parts (R, G, B), and then individually aligned G with B and R with B. To align the images, I used a recursive function to implement pyramid search (with exhaustive search being the base case). I used a scale factor of two, and a search displacement of [-30,30] on both axes in the base case. The metric I used for scoring the alignment was the L2 norm. On small images, the base case will be triggered immediately, while on large images, the offsets will be calculated and refined over multiple levels of the pyramid.

Example Images

G is the offset of the Green channel and R is the offset of the Red channel.

G=(dx:0,dy:53) R=(dx:-12,dy:104)
G=(dx:2,dy:5) R=(dx:3,dy:12)
G=(dx:4,dy:25) R=(dx:-4,dy:58)
G=(dx:14,dy:53) R=(dx:11,dy:121)
G=(dx:10,dy:82) R=(dx:13,dy:179)
G=(dx:2,dy:-3) R=(dx:2,dy:3)
G=(dx:26,dy:51) R=(dx:36,dy:108)
G=(dx:6,dy:42) R=(dx:32,dy:87)
G=(dx:17,dy:41) R=(dx:23,dy:89)
G=(dx:3,dy:6) R=(dx:3,dy:6)
G=(dx:29,dy:79) R=(dx:36,dy:176)
G=(dx:17,dy:60) R=(dx:13,dy:124)
G=(dx:8,dy:56) R=(dx:11,dy:116)
G=(dx:24,dy:49) R=(dx:54,dy:103)

My algorithm failed to properly align the emir image, probably because of the large differences between the R, G, and B channels that are not as prominent in the other images. This issue is fixed in the Bells and Whistles section later in this page. All the other images work well though.

More Images (from Library of Congress)

G=(dx:31,dy:69) R=(dx:47,dy:172)
G=(dx:15,dy:73) R=(dx:15,dy:169)

Bells and Whistles

Fixing Emir:

By using the G plate as the base plate (instead of the B plate) I was able to achieve good results for emir, shown below.

Displacements: R=(dx:17,dy:57) B=(dx:-24,dy:-49)

Auto-Cropping:

I implemented an auto cropping algorithm that crops off the edges from the images. It works by starting from the edges and removes rows and columns if the average value of any channel (R, G, or B) is > 0.95 or < 0.05. Once the algorithm reaches a row/column that does not meet the condition, it stops cropping along that direction. I think this algorithm strikes a good balance between retaining parts of the image with detail, and deleting the parts that are just colored bars.

Before and After Examples:

Before
After
Before
After