CS 194-26 PROJECT 1
Kenan Jiang

1. Overview
In the project, I aligned digitized RGB negatives to form a color image. These negatives are from the photo collection of Russian artist Prokudin-Gorskii, who had token pictures of every scene during the time Russian Empire.
2. Approach
For .jpg images, I first cropped the image from shape (341, 391) to (301, 301). By cropping the image before aligning, I hope to get rid of some borders that may have large effects on my SSD score. Then I define an "align" function. I apply "align" to make red negative to blue negative, and green negative to blue negative. In align function, I shifted the red/green negative by a possible displacement pair (x, y) from all possible window. Then I calculated the Sum of Squared Differences score for this displacement pair. Then I compared all the score and picked the lowest one. The displacement pair for this score is the displacement I need. Then I just moved my red and green negatives according to their displacements and stack g, r, b channel together.
For .tif images, I used pyramid align because .tif image is large. I first decided to use a pyramid with level of 5 and each level we downscale with a factor of 0.5. For example, at a certain layer X of our pyramid (the bottom layer being our original image, top being the smallest), I call my "align" function recursively to get the best displcaement for X-1 layer. Then I multiple this displacement by 2 to get new_displacement, and shift my layer image by this new_displacement, so now my layer is aligned based on the advice from all the layers above it. To pass the alignement information down, I added layer X's displacement by calling "align" function on only a small center of layer image to get current_displacement. Then I add new_displacement and current_displacement and pass it down to layer X+1...
3. Results
4. Failure
As you can see, my emir image is not clearly aligned. I think this is because they do not have the same brightness value on different color channels at same location. So my SSD score is not a good metric becasue the closest brightness value displacement cannot represent the true location of alignment.
5. Bells & Whistles
I did auto cropping. Fronm top, left, right, bottom, I check standard deviration of each row/column. For example, when checking border from top, I iterate through a few rows, find the one with max standard deviration and crop everything above this line. This is because borders usually have smaller std because they are the same color.
The improvement is obvious.