CS180 Project 2

Fun with Filters and Frequencies

Kevin Yee

Overview

This project (in our quest to beome friends with each and every single pixel on the screen) essentially filters images to bend them to our perceptual whims, mostly using maths, is probably the most apt description I can give of what is going on.

Part 1: Fun with Filters

Part 1.1

To plagerize quote directly from the project webpage: "We will begin by using the humble finite difference as our filter in the x and y directions."

Difference Operator Image

I do this, followed by calculating the gradient magnitude, the formula being:

Gradient Magnitude Image

With a bit more processing, I "binarize the gradient magnitude image by picking the appropriate threshold" (after taking a few tries), landing on around 0.18 or so (qualitatively assesed)

Part 1.2

For this part, it's pretty similar to the first one, except I basically blur the image before taking the difference and gradient, which should result in a smoother image (which I think it does), and then afterwards, I get the derivative of the gaussian filters, convolve them, followed by grabbing the gradient magnitude.

Part 1 Results:

1.1 Results

To my eyes, the edge image (rightmost), versus the edge image (gaussian blurred) look slightly different, a few more artifacts here and there, but overall really similar and perhaps a bit more distinct on the derivative one.

Here's the derivative of the Gaussian in the x and y directions (respectively)

1.2 Results

Part 2: Fun with Frequencies!

Part 2.1

In Part 2.1, I implemented a low-pass filter by first creating a Gaussian kernel, which smooths the image (like in part 1). Followed by slapping the kernel onto the image with cv2.filter2D. This takes a weighted average of stuff, which basically smooths over high frequencies (like koala brain)

To get the resultant image, I took the images generated from the high pass filter and added the higher frequencies multiplied by a constant to the original image to "sharpen" the original image.

Part 2.1 Results:

Taj Majal Image Golden Gate Image

Part 2.2

For part 2.2, To make a high pass filter, I literally used the inverse of the lowpass filter image - low pass filter, and BAM, combine the two images

Human Cat I was acting, or was I?

Failure image, too much detail/too busy (at least I don't think it looks great)

John Wick or Not

I wrote spagetti code and tried to "bundle in" FFT with the images, and I didn't really feel like disentangling it, so all images have FFT analysis. My favorit one is probably the I was acting, or was I? meme of happy -> mad

Part 2.3-2.4: Multi-resolution Blending and the Oraple journey

Part 2.3 Gaussian & Laplacian Stacks

So background on this one: Gaussian Stack is basically being continually blurred more and more (without downsampling though), while the Laplacian Stack is basically getting fewer and fewer higher frequencies with each "slab" on the stack by constantly doing low pass filter'n.

Part 2.3/4 Results:

Stacks

Part 2.4 MultiResolution Blending

Basically, the stacks are "collapsed" together by adding them, essentially progressively adding together the high frequency details to the lower resolution images.

Part 2.4 Result:

Orapple Kiwi Orange