CS194-26 Proj 1: Image Recolorization

Christine Zhu

The goal of this project is to take the digitized Prokudin-Gorskii glass plate images and generate a fully aligned color image from three color channel images. The main idea for doing this was searching different possible alignments of the three images and choosing the alignment with the least 'difference' in pixel values. The metric used to define this difference was the L2 norm, or the sum of squared differences of pixel values. To avoid an exhaustive search of all possible alignments, a search window of 15 pixels was chosen (left, right, up, down) and an image pyramid was used to avoid long computation time for large image files. The image pyramid involved rescaling the image by a factor of 1/2 until a minimum width of 500 pixels was reached. Then starting with the smallest image, I find the best displacement vector and refine it with each larger image. The displacement (e.g. 3 pixels left, 2 pixels down) is multiplied by a factor of 2 when applied to the larger image (6 pixels left, 4 pixels down) to reflect the difference in scale, and I run another search of 15 pixels in all directions after applying this shift.

As this method still took a little bit too long (more than a minute per image), additional refinements were added to improve image quality and processing speed. Before each image was shifted around to find the best displacement vector, I cropped the image by about 35% on each side so that the 'center' pixels were at the focus of the search and differences in borders / alignments were ignored. Images were also initially cropped 10% for further guarantee. This results produced relatively fast and clear results on all the images. The only exception was emir.tif: since each channel had different brightness values, pixel value difference alone was not a good metric for aligning the channels.

Thus, as added bells and whistles, a sobel filter for edge detection was added to images before alignment on large image files. This helped immensely with the clarity of the emir image and the lady image. Before and after images for those two are displayed below, with the no edge detection version underneath the final version.

castle.jpg

green displacement: [33 2] red displacement: [98 5]

cathedral.jpg

green displacement:[5 2] red displacement:[12 3]

cathedral_nativity.jpg

green displacement: [31 8] red displacement: [77 1]

church.jpg

green displacement: [64 21] red displacement: [135 30]

emir.jpg

green displacement: [49 23] red displacement: [107 41]

green displacement: [48 24] red displacement: [ 24 -13]

harvesters.jpg

green displacement: [59 18] red displacement: [123 15]

icon.jpg

green displacement: [41 18] [90 23] red displacement: [90 23]

lady.jpg

green displacement: [53 7] red displacement: [115 11]

green displacement: [ 0 32] red displacement: [7 72]

melons.jpg

green displacement:[84 10] red displacement: [180 13]

monastery.jpg

green displacement: [-3, 2] red displacement: [3, 2]

onion_church.jpg

green displacement: [50 26] red displacement: [108 37]

self_portrait.jpg

green displacement: [ 49 -17] red displacement: [118 -50]

three_generations.jpg

green displacement: [50 17] red displacement: [108 14]

tobolsk.jpg

green displacement: [3 3] red displacement: [6 3]

train.jpg

green displacement: [42 6] red displacement: [86 32]

turk.jpg

green displacement: [56 22] red displacement: [117 29]

tree.jpg

green displacement: [ 49 -17] red displacement: [118 -50]

green displacement: [53 -1] red displacement: [105 -12]

workshop.jpg