CS 194-26 Project 2: Fun with Filters and Frequencies!

By Alfredo Santana

Part 1: Fun with Filters

Part 1.1: Finite Difference Operator

I first computed the partial derivatives of cameraman.png, by taking the convolution of the image with the finite difference operators Dx, Dy. Once I had these partials, I calculated the gradient magnitude to detect edges, by squaring both images, summing them together, and then taking the square root of the result.

Dx

Dy

Gradient Magnitude

Edge Image

Part 1.2: Derivative of Gaussian (DoG) Filter

By using a gaussian filter, I was able to blur the edges of our images, so that they result in much smoother edges.

Dx

Dy

Gradient Magnitude

Edge Image

n

Part 2: Fun with Frequencies

Part 2.1: Image "Sharpening"

With the use of the unsharp mask filter (filter ((1 + alpha) e - alpha gaussian2d)), I was able to produce sharper images.

Original Taj

Sharpened Taj

I also went ahead and found an image that was already sharp, and I blurred the image using the Gaussian filter, and then sharpened the image again. As you can see, the image isn't sharper than the original, which can be because of my sigma, kernel size, or alpha values not being correct enough.

Original Eagle

Sharpened Eagle

Part 2.2: Hybrid Images

This was my favorite part of the project because it was cool to see how these optical illusions are made. To create these hybrid images, I took the high frequencies of one image, and the low frequencies of another image, and combine the two. To be more specific, a high pass filter is used to retrieve high frequencies, and a low pass filter is used to get low frequencies. Once we have both frequencies we simply add them together. I realized that the best images were the ones that aligned the best, so alignment of images was something I had to take into account as well. Here are the results of my hybrid images:

Here is an example of a hybrid image that failed

Below are the FFT versions of the lion and tiger images, as well as the FFT of the filtered input, and hybrid image.

Lion Fourier

Tiger Fourier

LowPass Fourier

HighPass Fourier

Hybrid Image Fourier

Part 2.3: Gaussian and Laplacian Stacks

For this part of the project, I created Gaussian and Laplacian stacks in order to be able to use multiresolution blending. I ended up using a sigma of value 4, and a kernel of size 25. Here are my Gaussian and Laplacian stacks.

Gaussian Stack - Apple (GrayScale)

Gaussian Stack - Apple

Gaussian Stack - Orange

Laplacian Stack - Apple

Laplacian Stack - Orange

Part 2.4: Multiresolution Blending (a.k.a. the oraple!)

Once we had the Laplacian stacks of our images, we could use these stacks, as well as a Gaussian stack of a mask, and using the algorithm proposed on page 230 Burts' and Adelson's paper, we can blend two images together into one image.

Mask

Oraple

Bells & Whistles (Extra Points)

For the parts 2.3 and 2.4 I used color to enhance the effect of the Gaussian and Laplacian stacks, and I noticed that the blurring looked a lot better. My favorite part of this project was learning about the different frequencies that images have, and how these frequencies can be manipulated to create super cool images. One of my favorite projects so far at Cal!