CS 194-26 Project 1

Reini Lin

Overview

The purpose of the project is produce a single colorized image from the Prokudin-Gorskii glass plate images. As the red, green, and blue plates were taken from slightly different locations, stacking the images will not produce an accurate image; rather, we must accommodate for translations. The glass plate images are in a file containing the red, green, and blue plates, so it is necessary to extract the three separate color images, overlay them, and adapt to accommodate translations.

Approach

The naive implementation uses a brute-force algorithm to minimize the sum of squared differences (SSD) between two plates. SSD is calculated as sum(image_a - image_b).^2, where the difference between each corresponding pixel in image_a and image_b is squared, and these differences are summed over the entire image. Since green is between blue and red in the color spectrum, green was used as the standard onto which the blue and red plates were aligned. Since each plate had inconsistently-sized borders, only the inner pixels (center 80% of the height and center 80% of the width) were used in the calculations.

This algorithm works for .jpg files, where the dimensions of the image are on the order of hundreds of pixels. However, for the high-resolution .tif files, the dimensions are on the order of thousands of pixels; this makes the time to produce a single output file from the input .tif file using the naive implementation prohibitively expensive.

To reduce runtime for the .tif files, image pyramids are created. At each level of the pyramid, the image is resized by a factor of two, and search for the the optimal displacement for every image is optimized using the displacement passed up recursively for the next-smallest image. In order to prevent excessive resizing, the base case is the largest resized image for which the height or width is below 300px. The naive algorithm is applied to this base case, and the results are passed up recursively until reaching the largest image, which is the un-resized .tif file.

Results: Example Images

1. cathedral.jpg

Displacement [x, y]

Red Shift: [1,7]. Blue Shift: [-2,-4].

Resulting Image

2. emir.tif

Displacement [x, y]

Red Shift: [18,57]. Blue Shift: [-24,-48].

Resulting Image

3. harvesters.tif

Displacement [x, y]

Red Shift: [0,65]. Blue Shift: [-16,-56].

Resulting Image

4. icon.tif

Displacement [x, y]

Red Shift: [8,48]. Blue Shift: [-16,-40].

Resulting Image

5. lady.tif

Displacement [x, y]

Red Shift: [4,64]. Blue Shift: [-8,-48].

Resulting Image

6. melons.tif

Displacement [x, y]

Red Shift: [4,96]. Blue Shift: [-8,-80].

Resulting Image

7. monastery.jpg

Displacement [x, y]

Red Shift: [1,6]. Blue Shift: [-2,3].

Resulting Image

8. onion_church.tif

Displacement [x, y]

Red Shift: [16,64]. Blue Shift: [-24,-48].

Resulting Image

9. self_portrait.tif

Displacement [x, y]

Red Shift: [8,98]. Blue Shift: [-28,-78].

Resulting Image

10. three_generations.tif

Displacement [x, y]

Red Shift: [0,64]. Blue Shift: [-12,-48].

Resulting Image

11. tobolsk.jpg

Displacement [x, y]

Red Shift: [1,4]. Blue Shift: [-2,-2].

Resulting Image

12. train.tif

Displacement [x, y]

Red Shift: [32,48]. Blue Shift: [0,-40].

Resulting Image

13. village.tif

Displacement [x, y]

Red Shift: [16,80]. Blue Shift: [-12,-64].

Resulting Image

14. workshop.tif

Displacement [x, y]

Red Shift: [-8,56]. Blue Shift: [0,-48].

Resulting Image

Results: Extra Images

1. naziya.tif

Displacement [x, y]

Red Shift: [0,0]. Blue Shift: [0,0].

Resulting Image

2. cross.tif

Displacement [x, y]

Red Shift: [0,0]. Blue Shift: [0,0].

Resulting Image