CS 194-26: Fall 2020

Project 1: Colorizing Prokudin-Gorskii

Candace Chiang, 3032706562

Overview

In this project, we synthesized color images from the Prokudin-Gorskii collection by aligning and combining their red, blue, and green color channels.

Approach

For the base align function, the implementation attempts every combination of the row and column offsets, rolling the image and scoring it against the reference image using SSD to find the best one. The default window I used for both row and column was [-20, 20]. Before using it, I also cropped borders of 20 pixels on all sides for the jpg images to make them look nicer.

For pyramid alignments, it recursively scales both the image and reference by half for the given number of times (I used 8) before calling my base align function to find the best displacement for the heavily scaled image. It then recurses back up, using the scaled down displacement as a reference to reduce the number of searches required. This heavily cuts down the number of combinations that need to be tried, but at a sacrifice of image quality, so it doesn't work as well on jpg images as the base align function does. Additionally, I cropped borders of 100 pixels on all sides for the tif images to make them look nicer.

Bells and Whistles

By improving the alignment using Canny edge detection, I got the emir.tif image to look much nicer. I do this by running the images through the canny algorithm provided by skimage and converting the results into 0s and 1s. I then use these to calculate the ideal displacements, and this works much better because it's much easier to align black/white than colored images, where the edges are decimals and aren't nearly as obvious from one another. These displacements are used to roll the original images before stacking them together.

Results

I ran the base align function on the jpg images, and the pyramid align function on the tif images.

cathedral.jpg - green offset (5, 2), red offset (12, 3)
monastery.jpg - green offset (-3, 2), red offset (3, 2)
tobolsk.jpg - green offset (3, 3), red offset (6, 3)
castle.jpg - green offset (-3014, -3548), red offset (-2952, -3547)
emir.jpg - green offset (-2960, -3478), red offset (-2962, -4832)
harvesters.jpg - green offset (-2958, -3467), red offset (-2898, -3470)
icon.jpg - green offset (-3004, -3524), red offset (-2955, -3519)
self_portrait.jpg - green offset (-2971, -3611), red offset (-2881, -3613)
three_generations.jpg - green offset (-2955, -3502), red offset (-2898, -3505)
lady.jpg - green offset (-2957, -3561), red offset (-2875, -3578)
melons.jpg - green offset (-2959, -3566), red offset (-2863, -3558)
onion_church.jpg - green offset (-2963, -3556), red offset (-2907, -3545)
train.jpg - green offset (-2995, -3539), red offset (-2951, -3512)
workshop.jpg - green offset (-2956, -3542), red offset (-2908, -3554)
river.jpg - green offset (-2957, -3552), red offset (-2920, -3552)
sunset.jpg - green offset (-3057, -3589), red offset (-2876, -3625)
forest.jpg - green offset (-3035, -3565), red offset (-3035, -3561)

Bells and Whistles Results

You can see how the Canny edge detection greatly improves the alignment on emir.jpg.
emir.jpg - green offset (-2960, -3478), red offset (-2962, -4832)
emir_new.jpg - green offset (-2960, -3479), red offset (-2902, -3462)