CS 194-26 Project 2: Fun with filters and frequencies

Carolyn Duan

Part 1: Fun with filters

1.1: Finite Difference Operator

We want to compute the gradient magnitude image of this cameraman:

To do that, we’ll first convolve the image with the finite difference operators Dx and Dy, defined below:

Below is the result of the convolution with each difference operator, first with Dx, then with Dy.

We can compute the gradient through this formula: gradient=dx2+dy2

To binarize the gradient and turn this into an edge image, I used a threshold of 0.3.

1.2: Derivative of Gaussian Filter

We want a smoother edge image. We can convolve the cameraman image with a gaussian filter, then repeat the steps above to find the edge image:

The differences I see: the edges are smoothed, which is nice. The gaussian filter has reduced noise.

Instead of convolving the original image with the gaussian, then performing dx and dy convolutions, we can convolve the gaussian with dx and dy instead. Here’s the resulting edge image:

We can see the image is pretty much the same.


Part 2: Fun with frequencies

2.1: Image Sharpening

Here’s the original Taj Mahal and my sharpened version. I used α=2.

I also sharpened this dog picture, again using α=2:

Another dog picture:

I also tried blurring then sharpening an image of my dog, Yugi. Here’s how it turned out. My observations: Sharpening a blurred image doesn’t undo the blurring. This makes sense, since blurring an image is lossy.

2.2: Hybrid Images

We can create a hybrid image of two by peforming a low-pass filter on one image, a high-pass filter on the other, and combining them. From far away, we perceive low frequencies more strongly; from close up, we perceive high frequencies.

Here’s the frequency analyis for the cat-dog hybrid above, in the order of: original dog, original cat, lowpass dog, highpass cat, hybrid

I tried to recreate the somewhat-famous Einstein + Marilyn Monroe blend, but it wasn’t quite successful.

2.3: Gaussian and Laplacian Stacks

I used 5 levels for the stacks. Pictured are levels 0, 2, and 4.








2.4: Multiresolution Blending

Now, for the oraple:

I also blended a husky and a wolf:

As well as Thomas the Train and a train: