Andrew Millman, CS194-26 Project 1

This project involved writing a script that takes digitized Prokudin-Gorskii glass plate images and does its best to align and overlay them to create beautiful colorized images. By overlaying the original Red, Green, and Blue images, we can accurately recover the original coloring. In general, while image processing, I used the Sum of Squared Differences to find the best shift / overlap between two plate images, and after shifting an image, I also cropped 15% of each side of the image in order to preserve the validity of the algorithm.

Algorithm

JPG images

For the smaller jpg images, I simply compared two plate images twice (blue and green, blue and red) and found how much I would need to shift the second image in order for it to be aligned with the first. Because these images were already almost aligned, I knew that I didn't need to do an exhaustive search over all possible shifts. For jpg images, an (x, y) shift window of (15px, 15px) in any direction sufficed.
cathedral.jpg
Green shift: (2, 5)
Green shift: (3, 12)
monastery.jpg
Green shift: (2, -3)
Green shift: (2, 3)
nativity.jpg
Green shift: (1, 3)
Green shift: (0, 8)
settlers.jpg
Green shift: (-1, 14)
Green shift: (0, 7)

TIF images

For the larger tif images, I used the recursive image pyramid method, scaling images down 50% at each recursive step. I stopped recursing once any dimension of the compressed image was below 50px. By doing this and relying on the iterative improvement of each recursive call, I was able to use a siginificantly smaller window of (6px, 6px) in any direction to find the optimal shift.
emir.tif
Green shift: (24, 47)
Red shift: (44, 66)
harvesters.tif
Green shift: (17, 59)
Red shift: (13, 124)
icon.tif
Green shift: (17, 41)
Red shift: (23, 89)
lady.tif
Green shift: (9, 55)
Red shift: (12, 116)
self_portrait.tif
Green shift: (29, 78)
Red shift: (37, 176)
three_generations.tif
Green shift: (14, 52)
Red shift: (11, 111)
train.tif
Green shift: (6, 43)
Red shift: (32, 87)
turkmen.tif
Green shift: (21, 56)
Red shift: (28, 116)
village.tif
Green shift: (12, 65)
Red shift: (22, 138)

Select images

church.tif
Green shift: (24, 49)
Red shift: (36, 110)
monument.tif
Green shift: (25, 21)
Red shift: (60, 29)

Challenges / Reflections

The biggest challenge for me was doing the recursive pyramid scale implementation. At first, I essentially just recursed on smaller images, without knowing what to do with the recursive result. After realizing that I needed to use the recursive answer to shift the current image, it was then I realized the true power of the algorithm.
Emir's image is also slightly off. This is most likely due to the fact that there are many different colors in different places going on. This high detail most likely confused the SSD heuristic.