CS 194-26 Project 1

Project Overview

This project demonstrates Prokudin-Gorskii's method to produced color images, and the images below come from the Prokudin-Gorskii collection. In this project, we are reproducing his methods by taking three exposures of a subject, one in each of the three color filters (red, green, blue) and aligning them.

Approach

For the exhaustive approach, I iterated over a window of [-15, 15] to find the optimal rolling factor, wherein the L2 norm between the blue and green/red image is closest to zero. As many of the staff suggested, I found much better results after cropping my images by 1/8th on each side. I found that the L2 norm was sufficient enough for alignment.
For the pyramid approach, the only difference from the first algorithm is the addition of scaling in iterations. I used a scale factor of 2 for each iteration and 5 levels since those stats produced better results for me. I decided to keep my window of [-15, 15]. However, for each iteration I adjust the search with best alignment thus far by add the temporary roll factor variable to the sliding window each time. The runtime for the pyramid algorithm is much slower than should be. After making some changes to calculation, I was only able to speed it up by one minute. Adjusting variables such as number of levels, scale factors, and calculations had no avail. Overall, my pyramid algorithm is not as accurate and requires some more debugging. When I tested my code, I only used one image, and was satified with the results. I failed to test on multiple examples until it was too late to find a better working solution. That is another thing I learned from this project, in terms of improving coding habits.

Results

As you will see below, the exhaustive approach on jpgs left great results, but my pyramid algorithm's alignment can be improved. My algorithm especially did not do well on the melons, self portrait, and Emir image, possible due to the difference in brightness values in the original three images (as the project spec mentioned for emir.tif). I chose the girl and hut image as my external examples since the former has much more detail than the latter and wanted to compare the difference. I found it interesting that even my exhaustive approach did not do well on the hut image, possible due to the lack of details which makes find the L2 norm after shifting pretty similar between different shift factors. It is probably due to the same reason as mentioned above as well, where the original images have different brightness values.

Exhaustive Approach

Monastery
G's Displacement Vector: (-3, 2) R's Displacement Vector: (2, 2)
Original Monastery Aligned Monastery

Tobolsk
G's Displacement Vector: (3, 3) R's Displacement Vector: (6, 3)
Original Tobolsk Aligned Tobolsk

Cathedral
G's Displacement Vector: (1, 0) R's Displacement Vector: (9, 0)
Original Cathedral Aligned Cathedral

Other Examples From Collection

Girl
G's Displacement Vector: (2, 1) R's Displacement Vector: (4, 2)
Original Girl Aligned Girl

Hut
G's Displacement Vector: (1, 0) R's Displacement Vector: (0, 14)
Original Hut Aligned Hut

Pyramid Approach

Church
G's Displacement Vector: (17, 4) R's Displacement Vector: (17, -14)
Aligned Church

Onion Church
G's Displacement Vector: (17, 17) R's Displacement Vector: (17, 15)
Aligned Onion Church

Melons
G's Displacement Vector: (17, 0) R's Displacement Vector: (17, 0)
Aligned Melons

Lady
G's Displacement Vector: (17, 4) R's Displacement Vector: (17, -19)
Aligned Lady

Three Generation
G's Displacement Vector: (17, 11) R's Displacement Vector: (17, 8)
Aligned Three Generation

Train
G's Displacement Vector: (17, 9) R's Displacement Vector: (17, 0)
Aligned Train

Workshop
G's Displacement Vector: (17, 1) R's Displacement Vector: (17, -9)
Aligned Workshop

Harvesters
G's Displacement Vector: (17, 15) R's Displacement Vector: (17, 13)
Aligned Harvesters

Icon
G's Displacement Vector: (17, 15) R's Displacement Vector: (0, 17)
Aligned Icon

Self Portrait
G's Displacement Vector: (17, 17) R's Displacement Vector: (17, 17)
Aligned Self Portrait

Emir
G's Displacement Vector: (17, 17) R's Displacement Vector: (0, 0)
Aligned Emir

Other Examples From Collection

Girl
G's Displacement Vector: (17, 16) R's Displacement Vector: (15, 17)
Aligned Girl

Hut
G's Displacement Vector: (17, 17) R's Displacement Vector: (0, 0)
Aligned Hut