CS 194-26 Project 1

Preetham Gujjula, cs194-26-adt

Overview

In this project, I combined black-and-white glass plate images corresponding to red, green, and blue color channels of an image, to create a colorized version of the image. The major challenge is aligning properly to create a coherent image.

Approach

Aligning small images

I aligned the blue and red images to the green image. First, I cropped 20 pixels off each side of the green image, to get rid of the border, and to make space to shift the blue and red images relative to the green image. Superimposed the blue and red images on top of the green image with every possible offset, from (-20, -20) to (20, 20). Each offset, I used the sum of squared differences (SSD) metric to compute the "score" of each offset. I used the offset with the best score as the final offset.

Aligning the large images

For the large images, I cropped 200 pixels off each side of the green image. This time, the naive method of trying every possible offset is too slow to be feasible. Instead, I used an image pyramid to narrow the search space of offsets dramatically. To align two large images with an image pyramid, I scaled both images to half their original size, and computed the alignment vector for the scaled images (with either a recursive call to the image pyramid algorithm, or with the naive implementation). Then, I doubled the elements of the scaled alignment vector to get an approximation for the alignment vector of the original images. This way, I only needed to try the alignment vectors that were up to 2 pixels away from the approximate vector in the x- and y-directions.

Small Images

nativity
Blue Offset: (3, 1)
Red Offset: (-4, 1)

settlers
Blue Offset: (7, 0)
Read Offset: (-8, 1)

cathedral
Blue Offset: (5, 2)
Read Offset: (-7, -1)

monastery
Blue Offset: (-3, 2)
Read Offset: (-6, -1)

Large Images

emir
Blue Offset: (49, 24)
Read Offset: (-57, -17)

harvesters
Blue Offset: (60, 16)
Read Offset: (-65, 3)

icon
Blue Offset: (41, 17)
Read Offset: (-48, -5)

lady
Blue Offset: (56, 8)
Read Offset: (-62, -4)

self_portrait
Blue Offset: (79, 29)
Read Offset: (-98, -8)

three_generations
Blue Offset: (54, 13)
Read Offset: (-58, 3)

train
Blue Offset: (42, 6)
Read Offset: (-43, -27)

turkmen
Blue Offset: (56, 20)
Read Offset: (-61, -7)

village
Blue Offset: (65, 12)
Read Offset: (-73, -10)

Extra Images

rock
Blue Offset: (37, 23)
Read Offset: (-50, -13)

boat
Blue Offset: (67, -14)
Read Offset: (-135, 15)

dresses
Blue Offset: (25, -18)
Read Offset: (-90, 19)

shed
Blue Offset: (13, -5)
Read Offset: (-120, 6)