CS 194-26 Fall 2020, Project 1: Colorize Me!

By: Vincent Lyau

Introduction

In this project, glass plate negatives taken by photographer Sergei Mikhailovich Produkin-Gorskii are aligned to create colorized images. Produkin-Gorskii used a three-stack camera, with each camera capturing exposures with a different color filter. Combining these exposures enables us to see the original image in colorized form. The main obstacle to retrieving these colorized form, however, are the small offsets and misalignments in each exposure, preventing a naive stack of the three color layers on top of each other from generating a quality image.

Methodology

The project specification contained many, very helpful hints and tricks. To that end, I initially followed the spec to the letter. The first part of the project involved a single-scale implementation that worked well for the smaller images (.jpg files) included. Here, the primary implementation tasks were coding the heuristics and setting up the exhaustive search. A major decision point here was which heuristic to choose from the two provided in the spec: sum of squared differences or normalized cross correlation. I experimented with both, and realized that for smaller images, they could result in dramatically different results, but one was not necessarily superior.

In fact, I noticed that images were not very clear at all, and so I took the next step of a fixed crop before applying the heuristics. This dramatically improved performance and actually caused both SSD and NCC to return the exact same results for all the small images. I choose to crop 15 off every side of the images, as during the exhaustive search, I followed the project spec's advice to use a [-15, 15] search range.

I then implemented the image pyramid approach in order to tackle the much larger .tif images. The primary technical challenge was figuring out what this meant at all; after following Piazza comments made by students and TAs alike, I grasped the concept. I decided to use a scale factor of 2 and a depth of 5 for my pyramid. This was made upon the observation that with this scale factor and depth, I was achieving good results on the majority of the images. I tried other scale factors, but either saw no realistic improvement or saw substantial slowdown. Increasing depth too much would sometimes cause problems with the way I was still applying the fixed crop. Additionally, at the deepest layer, I chose to use a default search range of [-30, 30], which is larger than the search range from before. This helped with accuracy a good amount at minimal additional time cost.

A very interesting note here is that I was still alternating between using SSD and NCC as my heuristic. However, upon reaching emir.tif, I decided to go with the SSD heuristic. The NCC heuristic would cause the red layer of emir.tif to appear significantly offset from the blue and green layers. As mentioned in the project specification, I believe this is due to the brightness differences of the layers. However, the SSD heuristic performs excellently and has no problems with emir.tif. This is of significant interest to me because I am not entirely sure why SSD would deal with the brightness issues any better. I suspect this is because at the smallest, coarsest version of emir.tif, SSD manages to find the correct range to align emir.tif because the differences here are more coarse, and this naturally has a ripple effect downward through the pyramid in choosing the right displacement. Besides emir.tif, SSD and NCC heuristics performed approximately the same with minor differences.

Algorithm Results: Small Images (.jpg)

cathedral.jpg

aligned_images/cathedral_aligned_SSD.jpg

Displacements: G: [2, 5], R: [3, 12]

monastery.jpg

aligned_images/monastery_aligned_SSD.jpg

Displacements: G: [2, -3], R: [2, 3]

tobolsk.jpg

aligned_images/tobolsk_aligned_SSD.jpg

Displacements: G: [2, 5], R: [3, 12]

Algorithm Results: Large Images (.tif)

castle.tif

aligned_images/castle_aligned_SSD.jpg

Displacements: G: [3, 36], R: [5, 97]

emir.tif

aligned_images/emir_aligned_SSD.jpg

Displacements: G: [24, 48], R: [49, 107]

For an interesting comparison, I also include, below this line, the NCC heuristic version of emir.tif that I got.

aligned_images/emir_aligned_NCC.jpg

Displacements: G: [20, 348], R: [-416, 336]

harvesters.tif

aligned_images/harvesters_aligned_SSD.jpg

Displacements: G: [10, 59], R: [9, 121]

icon.tif

aligned_images/icon_aligned_SSD.jpg

Displacements: G: [16, 41], R: [22, 89]

lady.tif

aligned_images/lady_aligned_SSD.jpg

Displacements: G: [1, 56], R: [1, 107]

melons.tif

aligned_images/melons_aligned_SSD.jpg

Displacements: G: [4, 83], R: [7, 174]

onion_church.tif

aligned_images/onion_church_aligned_SSD.jpg

Displacements: G: [22, 52], R: [35, 108]

self_portrait.tif

aligned_images/self_portrait_aligned_SSD.jpg

Displacements: G: [17, 75], R: [25, 169]

three_generations.tif

aligned_images/three_generations_aligned_SSD.jpg

Displacements: G: [5, 52], R: [7, 110]

train.tif

aligned_images/train_aligned_SSD.jpg

Displacements: G: [-2, 41], R: [25, 89]

workshop.tif

aligned_images/workshop_aligned_SSD.jpg

Displacements: G: [-5, 53], R: [-14, 97]

Algorithm Results: Personally Selected Images (.tif)

fish.tif

aligned_images/fish_aligned_SSD.jpg

Displacements: G: [24, 56], R: [17, 117]

maples.tif

aligned_images/maples_aligned_SSD.jpg

Displacements: G: [23, 57], R: [24, 127]

church.tif

aligned_images/church_aligned_SSD.jpg

Displacements: G: [12, 56], R: [9, 124]]