CS 194-26 Project 2

Part 1: Fun with Filters

Part 1.1: Finite Difference Operator

Starting with cameraman.png, I convolved with the finite difference operators Dx, Dy, producing the following output partials:

cameraman

cameraman_dx

cameraman_dy

I simply took the sum of squares of the partials to get the gradient magnitude, which was easily converted to an edge image by thresholding the gradient magnitude:

cameraman_gradmag

cameraman_edge

Part 1.2: Derivative of Gaussian (DoG) Filter

Using the DoG filter results in a less noisy gradient magnitude and thus clearer edge image. Convolving with a single DoG filter (created by convolving a gaussian with Dx, Dy) produces identical output since convolutions are commutative:

cameraman_DoG

cameraman_DoG_singleconv

Part 2: Fun with Frequencies

Part 2.1: Image "Sharpening"

Using an unsharp mask filter, I was able to produce sharpened images, visualized below. I've included resharpened website_images to demonstrate the effect created by "sharpening" an already-sharp image.

taj

taj_sharpened

taj_resharpened

footstep

footstep_sharpened

footstep_resharpened

grass

grass_sharpened

grass_resharpened

Part 2.2: Hybrid Images

By applying a low-pass filter to one image and a high-pass to another, we are able to create a hybrid image, which looks like one thing up close and another from afar, by simply adding weighted versions of these filtered images to each other.

derek

nutmeg

derek_nutmeg_hybrid

marx

bernie

marx_bernie_hybrid

putin

trump

putin_trump_hybrid

This effect didn't always work, as illustrated by the hybrid of woman.jpg and wolf.jpg:

wolf

woman

Interestingly, neither way works any better for producing a believable hybrid:

wolf_woman_hybrid

woman_wolf_hybrid

For the putin_trump_hybrid, I have visualized the log fourier transform of both input images, both filtered images as well as the hybrid image:

putin-fourier-log-mag

trump-fourier-log-mag

putin-filtered-fourier-log-mag

trump-filtered-fourier-log-mag

hybrid-fourier-log-mag

Part 2.3: Gaussian and Laplacian Stacks

I implemented both gaussian and laplacian stacks, visualized below for two example images:

woman-gaussian-stack

woman-laplacian-stack

alley-gaussian-stack

alley-laplacian-stack

I then utilized these stacks to recreate Figure 3.42:

Figure 3.42

Part 2.4: Multiresolution Blending

After implementing the algorithm proposed in the paper, utilizing the gaussian stack of a mask image to weight the laplacian stacks of both blended images, I was able to recreate the oraple:

oraple

Next, I utilized another simple mask to create a ocean-space blended image, and finally used an irregular mask to blend a man wondering in front of a waterfall with a desert highway:

ocean image

space image

image mask

ocean-space blended

waterfall image

highway image

image mask

waterfall-highway blended