Project 2 - Owen Gozali

Filters and Frequencies

Introduction

In this project I will be experimenting with differnet image filters and breaking down images into different frequency bands to create some interesting results.

Filters

Finite Difference Operator

We can show the partial derrivative of an image in the x and y directions by convolving them with [[1,-1]] and [[1],[-1]], respectively.

Image 1

Original Image

Image 1

Dx Edge Detector

Image 1

Dy Edge Detector

Image 1

Gradient Magnitude

Image 1

Gradient Magnitude with Threshold

Derrivative of Gaussian (DoG) Filter

Using the finite difference operator directly on the image was quite noisy as it falsely detected background elements as edges. We can try blurring the image first with a Gaussian low-pass filter to get rid of some of this noise and then apply the difference operator.

Image 1

Cameraman Through Low-pass Filter

Image 1

Dx Edge Detector with Gaussian Blur

Image 1

Dy Edge Detector with Gaussian Blur

Image 1

Gradient Magnitude with Gaussian Blur

The edge detection here looks a lot better than our previous attempt, as expected. It removed a lot of the noise that was present in the unfiltered image. Overall it does a better job at detecting edges.

We convolved the image with a gaussian and then a difference operator. Instead of convolving with two filters, we can just convolve with one by combining the two filters we applied. By convolving the Gaussian and difference operators, we can create the Derrivative of Gaussian (DoG) filter. Visualized as follows:

Image 1

DoG for dx

Image 1

DoG for dy

As we can see the result of using the DoG filters vs using the gaussian and then the difference operators yields the same thing.

Image 1

Image Through Gaussian then Difference Operator

Image 1

Image Through DoG Filter

Frequencies

Image Sharpening

We can create a "high pass filter" to only get the high frequencies of an image by subtracting the original image with a low-pass (gaussian) filter. If we then add more of these high frequencies to the original image, we can create the effect of "sharpening" the image.

Image 1

Original Image

Image 1

Original Image Sharpened

We can also do all this in one convolution with the Unsharp Mask filter. Here's a picture of a music festival that we can sharpen.

Image 1

Original Image

Image 1

Original Image Sharpened

As an evaluation, we can take an image and blur it and then apply the sharpening procedure.

Image 1

Blurred Image

Image 1

Blurred Image Sharpened

It looks like the image still looses some of the detail from the original blur but it's still imrpoved by sharpening.

Hybrid Images

If we take the low frequency components of an image A and combine it with the high frequency components of another image B, we can make a hybrid image that looks like image A from afar but looks like image B when nearby.

Image 1

Happy Man

Image 1

Sad Man

Image 1

Emotionally Ambiguous Man (High Freq: Happy, Low Freq: Sad)

To see what's happening here, we can take the fourier transform of some of these images and see what the low pass and high pass filter is doing to these images.

Image 1

Happy Frequency Before High-Pass

Image 1

Happy Frequency After High-Pass

Image 1

Sad Frequency Before Low-Pass

Image 1

Sad Frequency After Low-Pass

We can see that the high passed image has its high frequencies more pronounced and we can see a weakening of the frequencies near the origin. For the low passed image, it seems to be a lot more dampened near the outer regions compared to its original. This is presumebly because a lot of the high frequencies are cut out.

I also tried doing it with color as well and the results look pretty good as well:

Image 1

Happy Man

Image 1

Sad Man

Image 1

Emotionally Ambiguous Man (High Freq: Happy, Low Freq: Sad)

Here are some other hybrid images I made (the one with the cupcake was a bit of a failure)

Image 1

Dog

Image 1

Cat

Image 1

Dog-Cat (High Freq: Dog, Low Freq: Cat)

Image 1

Nutmeg

Image 1

Derek

Image 1

Derek-Nutmeg (High Freq: Nutmeg, Low Freq: Derek)

Image 1

Puppy

Image 1

Muffin

Image 1

Failed Pupcake (High Freq: Puppy, Low Freq: Muffin)

Multiresolution Blending

When blending two images together, we want to ensure the transition is as seemless as possible. Frequencies can help us with this! For an image's high frequencies, we want to ensure the cut is clean because otherwise the image will look ghosty with obvious details fading into the other image. For an images low frequencies, we can make the blending a lot more smooth because we know there aren't any jarring bits. We can break down the images into different frequency bands by constructing a Laplacian stack. A Laplacian stack is made from a Gaussian stack (a stack of progressively more blurry images) and we can take the difference between each level to get a specific band of frequencies. We can see this here with the Oraple:

Image 1

Laplacian Stack of Apple

Image 1

Laplacian Stack of Orange

Once we break it down into its frequencies, we can blend them smoothly with a different mask at each level to create the following:

Image 1

Progression of Apple Blending

Image 1

Progression of Orange Blending

Image 1

Apple

Image 1

Orange

Image 1

Orapple (Orange + Apple)

We can also do this with an irregular mask (where it's not just a straight line down the middle). The first picture is of a toy Tesla I got at a career fair, and the second is a shot of street parking I took from the 8th floor of Berkeley Way West. Using an irregular mask shown in the third picture, I can smoothly blend the toy car as if it were parked right on the street!

Image 1

Tesla Toy

Image 1

Street View from BWW

Image 1

Tesla Mask

Image 1

Blended Tesla Toy into Parking Spot

Here are some other results of the blending:

Image 1

My Dog Mochi (all the way in Indonesia)

Image 1

The floor on BWW

Image 1

Mochi's here!

Image 1

Volleyball

Image 1

Soccerball

Image 1

Socceyball

Image 1

Dish of Potatoes

Image 1

Dish of Brocolli

Image 1

Dish of Brocolly & Potatoes