Yash Vanvari CS 194-26 Project 1 Images of the russian empire

In this project I found a way to combine images taken with a red, green, and blue filter in an attempt to combine them into one colorized image utilizing image processing. An example of this image transofmration process is found right below this text.

Example

cathedral
Original Image that is passed in with Red, Blue, and Green filters.
Cathedral
Image that is created as a result of aligning and combining.

Low Image Resolution approach

1. Split image into three parts, the red, green, and blue portions by dividing the image into three equal parts based on the image's height.

2. Crop out a small portion of the edges so that any border material that is blurry or simply non-existent doesn't affect the image alignment process. The parameter I used was 1/15 of the image from all sides were taken out.

3. Align the red and green images to the blue image by finding where over range from -15,15 the Sum of Squared Differences of the picuters would be the lowest when shifting the red or greeen filtered image to align with the blue image.

4. Stack all of the aligned images together. Crop out a bit of the border again and display/save the image.

High Image Resolution Approach

1. Follow Steps 1 and 2 from the Low Image Resolution approach.

2. Use the process of an image pyramid to align the images. This works by scaling the image down by 0.5 5 times. If the image has less than a height of 100 then, use the Low Image Resolution Algorithm. In the new rescaled image find the place where the images align best together over a shift range of [-15, 15], this will be the first estimate as to where to align the images. Next, use recursion to keep going up levels until we reach the original sized image, with each level of recursion being upsed to update the estimate for the best alignment by searching the 4 pixels that are produced by scaling the image up by 2, and seeing where the next best estimate would be.

Analysis

These image processing algorithms work great for most of the images, however the algorithm falls short in particular on the emir.tif image. This happens because the pixels in the emir image has different brightness values for all of its different filters and as a result aligning the different vlaues based on pixels isn't nearly as precise as it could be in terms of producing a color picutre. The best way to solve this would have been to crop borders more effectively and by using a different evaluator function that looked at other features besides the value of the pixels in making alignments.

Results From Images Provided in Class

castle
castle.tif | Green Shift (dX, dY) => (0, 32) | Red Shift (dX, dY) => (0, 96)
Cathedral
cathedral.jpg | Green Shift (dX, dY) => (2, 5) | Red Shift (dX, dY) => (3, 12)
Emir
emir.tif | Green Shift (dX, dY) => (24, 48) | Red Shift (dX, dY) => (43, 64)
Harvesters
harvesters.tif | Green Shift (dX, dY) => (16, 56) | Red Shift (dX, dY) => (12, 124)
Icon
icon.tif | Green Shift (dX, dY) => (16, 40) | Red Shift (dX, dY) => (16, 88)
Lady
lady.tif | Green Shift (dX, dY) => (0, 48) | Red Shift (dX, dY) => (8, 112)
Melons
melons.tif | Green Shift (dX, dY) => (8, 80) | Red Shift (dX, dY) => (12, 176)
Monastery
monastery.jpg | Green Shift (dX, dY) => (2, -3) | Red Shift (dX, dY) => (2, 3)
Onion Church
onion_church.tif | Green Shift (dX, dY) => (24, 48) | Red Shift (dX, dY) => (32, 108)
Portrait
self_portrait.tif | Green Shift (dX, dY) => (28, 78) | Red Shift (dX, dY) => (32, 175)
Three Generations
three_generations.tif | Green Shift (dX, dY) => (12, 48) | Red Shift (dX, dY) => (11, 112)
Tobolsk
tobolsk.jpg | Green Shift (dX, dY) => (3, 3) | Red Shift (dX, dY) => (3, 7)
Train
train.tif | Green Shift (dX, dY) => (0, 42) | Red Shift (dX, dY) => (32, 88)
Workshop
workshop.tif | Green Shift (dX, dY) => (0, 48) | Red Shift (dX, dY) => (-16, 96)

Results From Images In Prokudin-Gorskii Collection

Church
new_image1.tif | Green Shift (dX, dY) => (16, 16) | Red Shift (dX, dY) => (28, 48)
Building
new_image2.tif | Green Shift (dX, dY) => (8, 24) | Red Shift (dX, dY) => (16, 62)
Emir
new_image3.tif | Green Shift (dX, dY) => (24, -16) | Red Shift (dX, dY) => (32, 16)