Fun with Filters and Frequencies

Statement

This assignment is about how to use filters and how to use frequencies to analyze data and perform cool operations.

Fun with Filters

In this part we build intuitions about convolutions and filters.

Finite Difference Operators

We generate a sequence of images using the finite difference kernels. Some results are displayed below:
finite difference using \( D_x \) kernel
finite difference using \( D_y \) kernel
Using the above class of difference operators we can define the gradient as \( \nabla I = \sqrt{ (\frac{\partial I}{\partial x})^2 + (\frac{\partial I}{\partial y})^2}\)
Gradient of image
Thresholded gradient of image, using threshold as t=0.1

Derivative of Gaussian Filters

To refine the binarized gradient image, we can use our favourite Gaussian filter, to blur the image and then compute the gradient. Some results are displayed below:
finite difference using \( DoG_x \) kernel
finite difference using \( DoG_y \) kernel
Gradient of image
Thresholded gradient of image, using threshold as t=0.1
We note that for the same thresholding, the binarized image post filtering is sharper and less noisy. Finally, the operation can be collapsed into a single filter, by convolving the Gaussian filter with difference operators. The results are highlighted below:
thresholded image with single filtering operation

Fun with Frequencies

Sharpening images are a common operation in image processing. In this case we use a single operation to combine high-pass filtering and image addition into a single operation. For example, consider sharpening of the Taj Mahal. (hover over the image to see the original image)
Similarly, we can blur the original image, and sharpen it again using the unsharpen filter, which gives us the following result (again, hover to see the original image):
Notably, while sharpened a bit, the resharpened image misses high frequency details from the original image.

Hybrid images

Frequency analysis provides a natural way to combine multiple images to generate a single hybrid image. In particular, by filtering images to have frequencies in different ranges, and combining them, we can generate a hybrid image.
Aligning the images
Hybrid Image after combining the aligned images (i) spatial domain (ii) frequency domain
Original images in frequency domain (i) derek (ii) nutmeg
Images post filtering (i) derek with low-pass filter (ii) nutmeg with high-pass filter

Multi-Resolution Blending

Blending images just with single pass-filters is not enough. We can use multi-resolution blending to generate photorealistic hybrid images. In particular, we generate Laplacian & Gaussian stacks, and perform blending at each level.

Laplacian-Gaussian stacks

Different levels of Laplacian stack with 5layers for Apple
Different levels of Laplacian stack with 5layers for Orange

Multi-Resolution Oraple

Multi-resolution blending of Apple and Orange.
The vertial mask is blurred using Gaussian kernel of \( 29 \times 29 \) size with \(\sigma=10 \)

Additiona Notes

This was a great assignment, I really enjoyed getting a better sense of interplay between frequencies and filters. Implementing an algorithm to blend images from scratch was a lot of fun!