Fun with Filters and Frequencies!

Project Overview

In this project I explore how frequency impacts our perception of images. I used frequency to sharpen a few blurry images, create hybrid images which show different content when viewed form near vs. far, and blended images, where two images are seamlessly blended into one another.

Finite Difference operator

The idea here is to use the finite difference as our filter to extract edges in the x and y directions respectively. I convolved the image twice, once with each partial derivative, x and y. Then I created the gradient magnitude image with the following formula.
\( G = \sqrt{(D_x)^2 + (D_y)^2} \)
Folowing that I tested out a few thresholds to highlight the edges in the image and settled on a threshold of 0.075.

dx

\delta x

dy

\delta y

Gradient

Gradient

Binarized

Binarized

Derivative of Gaussian (DoG) Filter

The results with Finite Difference were bit noisy. I used a Guassian filter to get smoother results. For this I take the outer product of a guassian vector to give me a matrix and then convolve this with the original image to create a blurred image. From there I repeated the above process of convolving this with each partial derivative and finding an appropriate threshold.

dx

∂x

dy

∂y

Gradient

Gradient

Binarized

Binarized

Image sharpening

You can sharpen a blurry image by running a filter to retain only the low frequencies of your image. Then if you subtract these low frequencies form the original image you will be left with only the high frequencies. If you then add the high frequencies back to the original image, therefore emphasizing them you get a "sharpened" image.

dx

Original Image

dy

Blurred Image

dy

Sharpened Image

Hybrid Images

Furthering on the idea of frequnecies we can create hybrid images. Frequencies in the context of images refer to the rate fo change of pixels. For example, where edges appear in pictures are areas of high frequncy; whereas, areas of smooth transition in color or darkenss would be low frequency. The eye picks up on high frequnecies when it is up close to an image and picks up on lower frequencies further away. Using this, I've extracted the high and low frequnecy portions of images and aligned them on top of each other giving the result fo "hybrid" images.

dy

High Frequency Image (prof. Efros)

dy

Low Frequnecy Image

dx

Alexei Lisa? Mona Efros?

dy

Frequency Analysis of Mona Lisa

dy

Frequency Analysis of prof. Efros

dy

Frequency Analysis of filtered Mona Lisa

dy

Frequency Analysis of filtered prof. Efros

dy

Frequency Analysis of Hybrid

dy

Einstein and Spaniel (Failure Case)

dy

Derek and Nutmeg

Laplacian and Gaussian Stacks

The next part of this project involves showing various frequnecies of images using Gaussian and Laplacian stacks. To make a Gaussian stack, I repeatedly used a gaussian filter on the image with an increasing sigma value for 5 levels. To create a laplacians stack you instead take the difference of the result of the current gaussian filter and the previous gaussian filter on the image.

Gaussian Stack of Apple

Image 1
Image 2
Image 3
Image 4
Image 5

Gaussian Stack of Orange

Image 1
Image 2
Image 3
Image 4
Image 5

Laplacian Stack of Apple

Image 1
Image 2
Image 3
Image 4
Image 5

Laplacian Stack of Orange

Image 1
Image 2
Image 3
Image 4
Image 5

Multiresolution Blending

Using Gaussian and Laplacian stacks we can make blended images that have a vertical, horizontal or irregualr seam where two different images merge. The classic example of this is the orapple from this paper. I created my own orapple and recreated figure 3.42 from that paper. I also experiemneted using the moon and earth with a horizontal seam, as well as a random mask with small circles and a bullseye like mask. My goal was to make the craters of the moon look like the earth but the artistic appeal of the images is underwhelming.

Recreating of figure 3.42

Image 1
Image 2
Image 3
Image 1
Image 2
Image 3
Image 1
Image 2
Image 3
Image 1
Image 2
Image 3

Some experimental final products

dy

Orapple

dy

Earth and Moon Vertical

dy

Earth and Moon Bullseye

dy

Earth and Moon Craters

Stacks for EarthMoon

Image 1
Image 2
Image 3
Image 1
Image 2
Image 3
Image 1
Image 2
Image 3
Image 1
Image 2
Image 3