CS 194-26 Project 1
Images of the Russian Empire:
Colorizing the Prokudin-Gorskii photo collection
Overview:
In this project, our goal was to align images from scans of the Prokudin-Gorskii glass plate image collection, as well as to find ways to make colored images more realistic.
Getting Started:
To run the program, run this command in the terminal
python3 main.py filename [--crop] [--whitebalancing]
For example,
python3 main.py emir.tif True True
gives the aligned, cropped and white-balanced emir.tif
Implementation --- Naive Exhaustive Search:
With the assumption that the window of possible displacement is [-15, 15], we can iteratively test every displacement and find the best alignment. To determine whether an alignment is better, we use SSD (Sum of Squared Differences) or NCC (normalized cross-correlation). In particular, we want to minimize SSD or maximize NCC.
Borong Zhang cs194-26-agb
Implementation --- Image Pyramids:
Although the naive implementation works for small images, with larger images, we not only need to search a larger range of displacements but also need to spend more time on each of them. Therefore, we implement image pyramids to improve the searching time by reducing the search range.
Also, during implementation, I noticed that red channel often does not align with blue and I found that aligning with green generally produces a better result. It's because, according to Taesung, "The costume has high intensity in the blue channel, but low intensity in the red channel."
Results (aligning with green):
Blue: (-41, -18) Red: (49, 5) Time: 5.89s
Blue: (-5, -2) Red: (7, 1) Time: 0.15s
Blue: (3, -2) Red: (6, 1) Time: 0.15s
Blue: (-3, -1) Red: (5, -1) Time: 0.14s
Blue: (-7, 0) Red: (8, -1) Time: 0.15s
Blue: (-48, -24) Red: (57, 17) Time: 5.84s
Blue: (-59, -17) Red: (64, -3) Time: 6.79s
Blue: (-53, -8) Red: (61, 4) Time: 6.31s
Blue: (-78, -29) Red: (98, 8) Time: 6.11s
Blue: (-51, -14) Red: (59, -3) Time: 5.98s
Blue: (-42, -6) Red: (43, 26) Time: 5.92s
Blue: (-56, -22) Red: (60, 7) Time: 6.045s
Blue: (-64, -12) Red: (73, 10) Time: 6.15s
Bells and Whistles --- Automatic cropping:
Noticed that white, black or other color borders only contain few colors and the intensity doesn't change much, we can assume that the variance of color intensity at the border is relatively smaller than that elsewhere. Therefore, we iterate through each row and column to find where the intensity changes drastically and crop the image at the corresponding row or column.
Results:
Bells and Whistles --- Automatic white balance:
In order to make images looking more realistic, we scale and normalize the color intensity of each channel. In particular, we want to the average intensity to be grayish.
Results:
Additional Examples: