Fun with Filters and Frequencies

Part 1.1

I convolved the cameraman image with the finite difference operators to get the partial x and y derivatives of the image.

xderivative

Dx Image

yderivative

Dy Image

I then computed the gradient magnitude image, by taking the square root of the summed squares of the two partial derivaties. I found a threshold of 0.19 to be best when binarizing the gradient magnitude, striking a good balance of showing the outline of the man while reducing noise.

gradient_magnitude

Gradient Magnitude Image

binarized

Binarized Graident Magnitude

Part 1.2

I blurred the cameraman image by convolving it with a 2D Gaussian kernel.

cameraman

Orignal

blurred-cameraman

Blurred

The image on the right is more blurred than the original. It is not extremely blurry because I used a small kernel with a small sigma value (<10).

Below are the results of the derivatives and gradient magnitude images with the new, smoothed cameraman image.

smoothed_xderivative

Smoothed Dx

smoothed_yderivative

Smoothed Dy

smoothed_gradient_magnitude

Smoothed Gradient Magnitude

smoothed_binarized

Smoothed Binarized Graident Magnitude

Part 2.1: Image "Sharpening"

In order to sharpen the Taj Mahal image, I isolated the higher frequencies by subtracting the original image and a blurred, low-frequency version of the image (created by convolving with a Gaussian kernel). I added different amounts of the high frequencies back to the original image to produce different levels of "sharpness"

taj

Original

taj1

α = 1

taj2

α = 2

taj5

α = 5

taj10

α = 10

Although not gaining any data, the images appear sharper because of the added high frequencies.

More Examples

bird

Original

bird1

α = 1

bird2

α = 2

bird5

α = 5

bird10

α = 10

Resharpening a Blurred Image

The image was blurred in the same way described previously, by convolving with a Gaussian kernel. When we added higher frequencies back to the image, it provides some "resharpening", which you can see in the petals of the succulent.

succulent

Original

blurred_succulent

Blurred

resharpened_succulent

Resharpened (α = 3)

Part 2.2: Hybrid Images

These hybrid images were created by adding the low frequencies of one image to the high frequencies of another. From close by, one should be able to perceive the image as the high-frequency object, and from far away, it should appear as the low frequency object.

Instructor-provided code was also used to align the images based on 2 points before combining them.

derek

Low Frequency Image

cat

High Frequency Image

catderek

Hybrid

Frequency Analysis

Below are the log magnitudes of the Fourier transforms of the two input images, the filtered images, and finally the new hybrid image.

fftderek

Derek

fftcat

Nutmeg

fftlowderek

Derek (Low Frequency)

ffthighcat

Nutmeg (High Frequency)

ffthybrid

Hybrid

More Examples

obama

Low Frequency Image

kamala

High Frequency Image

flowerpizza

Hybrid

Failure

flower

Low Frequency Image

pizza

High Frequency Image

flowerpizza

Hybrid

This combination of images failed, I think because the pizza was too detailed of an image with widely contrasting colors. Although you can see the flower structure from far away, the detail in the pizza's cheese still sticks out, and so the "illusion" doesn't hold as well.

Part 2.3: Gaussian/Laplacian Stacks

Apple

applestacks

Orange

orangestacks

Part 2.4: Multiresolution Blending

apple

Apple

orange

Orange

vertical_mask

Mask

oraple
 
young

Young

old

Old

vertical_mask

Mask

youngold
 
washington

Washington

eyes

Googly Eyes

eyesmask

Mask

googlywash
 

Laplacian Stacks

wash_laplacian2 wash_laplacian4 wash_laplacian8