# Project 1: Colorizing the Prokudin-Gorskii Photo Collection

## Overview

In this assignment, I learned to colorized Prokudin-Gorskii glass plate images by placing three color channel images on top of each other correctly with some image processing skills. I started with implementing the Sum of Squared Differences (SSD) distance and search exhaustively over a range of possible offsets (I use ±15). This works alright with low-res images but for hi-res ones, we have to use much larger pixel offsets in order to find a reasonable alignment, which would take a long time. Therefore, I also implemented the image pyramid technique to process the image from smaller scales. For more accurate results, I cropped 5% of all the borders so that they won't affect the SSD comparison values.

## Results

ag: displacement values for green channel over blue channel

ar: displacement values for red channel over blue channel

 ag = [54, 12], ar = [111, 9] ag = [3, 2], ar = [6, 3] ag = [51, 26], ar = [108, 36] ag = [82, 9], ar = [178, 11] ag = [52, -1], ar = [104, -13] ag = [41, 17], ar = [89, 23] ag = [51, 9], ar = [111, 12] ag = [78, 28], ar = [176, 36] ag = [43, 5], ar = [87, 31] ag = [60, 16], ar = [124, 13] ag = [-3, 2], ar = [3, 2] ag = [35, 3], ar = [98, 3] ag = [5, 2], ar = [12, 3] ag = [49, 24], ar = [93, -305] - will be explained**

### More Images from the Prokudin-Gorskii Collection

 ag = [42, -2], ar = [96, 9] ag = [25, -4], ar = [101, -10]

### Failed Alignment: Emir and Sunset

Emir's picture did not work well since the blue channel is significantly brighter than the red one because of Emir's bright blue clothing as shown from the glass plate image below. On the contrary, this sunset image has a very dark blue channel compare to the red's (the filter order from top to bottom is B-G-R):

To accomodate with this scenario, we could instead align the red and blue channels to the green one with the same algorithm:

 Emir: align G and R to B Emir: align B and R to G
 Sunset: align G and R to B Sunset: align B and R to G