CS194-26 Project 1 - Brian Chin

This webpage contains four sections: Part 1 Results, Part 2 Results, Final Results (via Bells & Whistles), Additional Images

Part 1: Exhaustive Search

The input image is split into three parts using the starter code. The algorithm I used to find the x,y displacements is NCC. Using the green base, I first found the norm across the x-axis for the blue filter and green filter, then applied a rolling window [-20, 20] pixels that rolled the image on the x-axis. I found the maximum dot product of the entire image using the norms aforementioned and saved the x displacement. I then applied the x-displacement, rolled the image, and repeated this process for the y-axis. This is necessary as a two-step process, as the y-displacement is optimized when the x-displacement is already applied to the image. I used the same process for the blue filter with the red filter. This method works great for jpg files, but tiff files are bounded by the small rolling window. The runtime for jpg images are around .30 seconds, while the runtime for tiff images are around 13 seconds. Below is just cathedral.jpg and emir.tif for brevity. Notice that for the large tiff files, the most displacements are cutoff at -20 or 20.

Blue (x,y) displacement: (7, 1), Red (x,y) displacement: (-5, -2)

Blue (x,y) displacement: (20, 14), Red (x,y) displacement: (-15, -18)

Part 2: Image Pyramid

Now that we have the base algorithm ready, we address the issue of large images and the boundaries of the window. I split the image each recursive level and rescale each component by 0.75, until I have a base case rescaled image of height <= 341, the same size as most jpg files. At this level, no more rescaling is needed and I find the x,y displacements. I then propagate these displacements as offsets for the higher resolution levels, making sure to multiple the offset by 1/0.75 (the scaling factor). This proves to work pretty well for most images, however additional optimizations need to be made, specifically to address the misalignment in emir.tf and workshop.tif. Large tif files run at around 30 seconds. Below is emir, workshop, and a subset of the image pool for brevity and to satisfy the 25 MB limit for the upload.

Blue (x,y) displacement: (108, 12), Red (x,y) displacement: (-15, -18)

Blue (x,y) displacement: (13, -13), Red (x,y) displacement: (-54, 3)

Blue (x,y) displacement: (62, -10), Red (x,y) displacement: (-56, -1)

Blue (x,y) displacement: (55, 10), Red (x,y) displacement: (-52, -25)

Blue (x,y) displacement: (47, 25), Red (x,y) displacement: (-42, -3)

Blue (x,y) displacement: (48, 5), Red (x,y) displacement: (-44, -17)

Part 3: Center Cropping

To address the misalignments in Part 2, I decided to use center cropping, by cropping each rgb component on both width and height to 65% then concatenated the components. I then ran the same image processing described above. This resulted in much better results for emir.tif and workshop.tif as well as a lower runtime at around 13 seconds per large image. These are my final outputs. Unfortunately I did not do border cropping, and there are small artifacts within the images (for example splotches of green in the harvester output). However, I believe my image outputs turned out pretty well with no misalignment. Below is the list of final image outputs and displacements.

Blue (x,y) displacement: (7, 1), Red (x,y) displacement: (-5, -2)

Blue (x,y) displacement: (33, -8), Red (x,y) displacement: (-25, -4)

Blue (x,y) displacement: (53, 18), Red (x,y) displacement: (-38, -22)

Blue (x,y) displacement: (65, -3), Red (x,y) displacement: (-58, -17)

Blue (x,y) displacement: (48, 5), Red (x,y) displacement: (-41, -17)

Blue (x,y) displacement: (63, 3), Red (x,y) displacement: (-56, -8)

Blue (x,y) displacement: (96, 3), Red (x,y) displacement: (-83, -11)

Blue (x,y) displacement: (6, 1), Red (x,y) displacement: (3, -2)

Blue (x,y) displacement: (59, 9), Red (x,y) displacement: (-51, -27)

Blue (x,y) displacement: (97, 8), Red (x,y) displacement: (-77, -28)

Blue (x,y) displacement: (58, -3), Red (x,y) displacement: (-51, -14)

Blue (x,y) displacement: (4, 1), Red (x,y) displacement: (-3, -2)

Blue (x,y) displacement: (45, 27), Red (x,y) displacement: (-42, -5)

Blue (x,y) displacement: (52, -11), Red (x,y) displacement: (-54, 1)

Part 4: Additional Images

I have three additional images: Wooden Church, Rafts, and Glass Factory. All are tiff files. I used the final algorithm (with center focus cropping). Below is the list of additional image outputs and displacements.

Blue (x,y) displacement: (100, -31), Red (x,y) displacement: (-90, 18)

Blue (x,y) displacement: (43, -3), Red (x,y) displacement: (-40, -2)

Blue (x,y) displacement: (24, 20), Red (x,y) displacement: (-10, -20)