# CS194-26 Project 1

### Overview

In this project, our task was to create a single colored-image using three images of different color channels that are stacked on to op one another. To complete this task, we utilized techniques and algorithms to translate the images so that the images aligned on top of one another to create a single image combining the three color channels.

### Approach

My approach to aligning the three images was…

1. IF the image is small and compressed (ie. jpg files), use iteration to determine the translation that generates the smallest sum of squared distance(our metric to determine the accuracy of the aligned image)
2. OTHERWISE depending on the size of the image, we determine how many times we downscale an image (by a factor of 2) and use recursion to continue to downsize until we hit the base case. (Image Pyramid)
3. Solve the smallest sum of squared distance for the base case and pass the result up until we have finished the recusion process.
4. In essence we are starting from the top of the pyramid and search for the best displacement and pass that displacement down to the next layer of the pyramid.

### Challenges

While working on this project one challenge that I encountered was my lack of familiarity with both Python and Matlab. Since this was my first major project where I had to use Python, it took quite a while to set up my Python and Jupyter Notebook environment. Also, I spent a lot of time trying to get familiar with the different Python tools at my disposal (such as skimage) and learning how to utilize them effectively. As a result, I spent a lot of time tinkering with the different libraries and using a lot of trial and error.
Another challenge that I encountered was dealing with images that were lighter in tone (ie. melons.tif and workshop.tif). Specifically in the melons.tif image, the image was naturally lighter in comparison with the other example images and this led to the melons being drastically different shades in each of the 3 color channels. I believe that this drastic contrast between the melons in the images led to a higher SSD when aligning the dark melons in the red color-channel image with the naturally dark stand in the blue color-channel image.

### Example Images

To demonstrate the effectiveness of my approach, here are my results on some of the example images that we were given.

cathedral.jpg
G: [3, 0]
R: [9, 2]

tobolsk.jpg
G: [3, 2
R: [7, 4]

castle.tif
G: [32, 2]
R: [97, 4]

emir.tif
G: [-1, 33]
R: [57, 50]

workshop.tif
G: [52, 0]
R: [-43, -38]

train.tif
G: [42, 6]
R: [85, 32]

three_generations.tif
G: [48, 16]
R: [109, 11]

melons.tif
G: [102, 49]
R: [107, 0]

harvester.tif
G: [58, 18]
R: [122, 17]

self_portrait.tif
G: [77, 29]
R: [129, 29]

onion_church.tif
G: [50, 26]
R: [108, 37]

G: [48, 7]
R: [107, 11]

icon.tifG:
G: [48, 18]
R: [96, 23]

lake.tif
G: [38, 14]
R: [73, 14]

rock.tif
G: [37, 33]
R: [92, 58]

wetland.tif
G: [39, -2]
R: [-42, -13]

desert.tif
G: [18, -7]
R: [65, -5]