CS194 - Colorizing the Prokudin-Gorskii Photo Collection

Nathan Yuchi(CS194-26-acl)

Initial Implementation

My first approach was to minimize the sum of squared differences SSD = sum(sum((image1-image2).^2)) when comparing the red and green channels to the blue channel image. I search in the window [[-15, 15], [-15, 15]] and find the minimum SSD when comparing to the blue channel image.

When I initially did this approach, the algorithm was aligning images based on the border of the images. This is because the border is very dark compared to the rest of the image and when aligning the borders, the SSD is minimalized. I cropped the images by about 6% on all four side to remove the borders and then alignment worked.

This method works for the smaller compressed .jpg images because they can be aligned in the [[-15, 15], [-15, 15]] window. The delta required in the large TIFF images would require a much larger window, and exhaustively searching over a large window would significantly affect runtime.

R[1, 7]
G[-2, -5]

R[1, 6]
G[-2, 3]

R[-1, 4]
G[-1, -3]

R[-1, 8]
G[0, -7]

Large Image Alignment

The approach to align the larged .tif images without a very long runtime was to create image pyramids. We do this by scaling the image down by 50% until we reach the base case of about 16x16. We then work our way up from the smallest image to the the largest. We calculate the minimum SSD of of an image, but over a smaller window (I used [-2, 2]) and get the displacement. Then we scale the displacement by 2 for the next image, apply the displacement, and then repeat the process again until we reach the original image.

The results of aligning .tif images using the image pyramid method and the displacements are below.

R[-3, 65]
G[-16, -59]

R[5, 48]
G[-17, -40]

R[3, 62]
G[-9, -48]

R[8, 98]
G[-28, -78]

R[-3, 58]
G[-14, -53]

R[27, 43]
G[-5, -42]

R[7, 60]
G[-21, -56]

R[10, 72]
G[-12, -65]

Emir

While the image pyramid method worked for the other tif images, emir.tif did not align properly. The result of aligning emir.tif to the blue channel are below on the left.

The misalignment in emir.tif is because the image has high itensity of blues in the attire but low itensity of reds. So when we align reds to the blues according to the clothes, the SSD actually increases, creating the wrong alignment. In order to fix this issue, we need to prevent aligning reds and blues. We do this by aligning reds and blues to the green channel instead. When we align against the green channel, emir.tif becomes aligned properly as shown on the right.

Aligning on blue
R[-864, 0]
G[24, 49]

Aligning on green
R[17, 57]
B[-24, -49]

Other Images from Collection

R[23, 98]
G[20, 38]

R[21, 127]
G[18, 60]

R[34, 146]
G[-18, 66]

R[-10, 102]
G[-13, 40]