CS 194: Project 1

Theodora Worledge

Alignment Part 1

I aligned the R, B, and G color channels by performing an exhaustive search (over [-15, ..., 15] in both the horizontal and vertical directions) to identify the offsets that minimized L2 loss between R and B, and G and B.

Alignment Part 2

I implemented the recursive pyramid scheme to identify the offsets that minimized a variant of L2 loss between R and B, and G and B. The same variant of L2 loss as above was used and the same pre-processing step of cropping out the borders was used.


B&W: Implementing and Using Edge Detection

Because the values across the color channels for the Emir of Bukhara image are not of the same brightness, L2 loss is not an accurate indication of alignment, which is why the previous alignment scheme fails. Instead of using the original R, G, and B images as inputs to the pyramid alignment algorithm, I instead pre-processed each color channel by applying an edge detection filter. More specifically, two 3x3 filters were used; one to identify horizontal edges and the other to identify vertical edges.

Filter for horizontal edges:

1 1 1
0 0 0
-1 -1 -1

Filter for vertical edges:

1 0 -1
1 0 -1
1 0 -1

At each location on the image, both filters were applied and their results were added, then scaled. Values greater than a threshold were rounded to 1. The following images for the R, G, and B channels were obtained:

emir r edge detection emir g edge detection emir b edge detection

Using these as inputs for pyramid alignment yields the (after) image on the left, a big improvement from the (before) image on the right :)

Additional Photos

The leftmost image can be correctly aligned using the same preprocessing step of edge detection as used for the Emir of Bukhara image.