Project 2: Fun with Filters and Frequencies!

Anuja Lohia

Overview

The goal of the project was to get familiar with applying different filters and gaussian filters, as well as sharpening images, making hybrid images and blending images.

Part 1

To get partial derivatives of images, we convolved them with derivative D_x = [1, -1] and D_y = [[1], [-1]], the resulting partial derivatives depict how the image is changing horizontally and vertically. To get a sense of how fast it's changing overall, we computed the gradient magnitude by taking the square root of the sum of the squared partial derivatives.


DoG: The differences are very clear, after applying the gaussian filter, the noise is much lesser and we get a clear outline as is clear in the below binarized picture.


Now, we take the derivatives of the Gaussian filters and get the gradient through a single convolution. Clearly the final result is the same as above since convolution is associative.

Part 2.1 : Unsharp Masking

By blurring the images, we get their low frequencies. We can get the high frequencies by subtracting the low frequencies from the images. By adding these high frequencies to the original image we get the sharpened version of the image. This is the naive implementation. We can also do this using a single convolution by using the unsharp mask filter as described in lecture. Here are the results: Original, blurred, sharpened.


After blurring the image and resharpening it, it seems like the image lost some of its details and became a little pixelated.

Part 2.2: Hybrid Images

Hybrid images look different when viewed at different distances. We see high frequencies at a close range and low frequencies from further away. We blend the high frequencies of one image with the low frequencies of another to create a hybrid.

Derek + Nutmeg


Hilfinger + Tiger


Fourier Analysis

In order: Hilginfer original, Tiger original, Low frequency transform Hilfinger , High frequency transform tiger, Hybrid


Justin Beiber + Cheetah




Thanos + Puppy (Failure Case)


This case failed because Thanos' face has many distinct edges and it dominates the puppy's softer features even at a close distance.


Part 2.3 : Laplacian and Gaussian Stacks

For Gaussian Stacks, we apply Gaussian filters to each level of the stack so we'll have a stack of increasingly low frequency images. For Laplacian Stacks, we take the difference between any consecutive Gaussian layers to calculate Laplacian layers, and the last layer is the same as the last layer of the Gaussian stack so that when we sum up the Laplacian stacks, we get the original image. Top row: Gaussian stack. Bottom row: Laplacian stack.

Apple



Orange


Part 2.4 : Multiresolution Blending
To blend the apple and the orange together, we can create a mask that's half black and half white, and create a Gaussian stack of the mask to smooth out the transition between the two images. Below is the masked Laplacian stacks for apple and orange, and adding them together will give us the blended oraple.





Other examples

Breakfast + Pizza


Moon + Sky - Irregular Circular Mask

a circular mask was used around the moon.

Conclusion: This project taught me some very great image processing skills. Learning the math and the code behind filters and blending and other things used in applications such as photoshop was very rewarding!