Project 2

Filters and Frequencies

Mahum Khan



Overview

In this project, we manipulated the different aspects of each image by harnessing the dynamic between high and low frequencies.

Part 1: Filters

The building blocks of this project requires us to understand how to create blurry effect on our images to capture the noise. In order to do this, we must first get a kernel and convolve the image based on that kernel. For the finite difference operators, there is vector defined in the x and y-direction.

Combining the x and y convolution, the gradient magnitude is produced. Then, we can turn it into a edge image by binarizing it. The bottom 2 images show the gradient magnitude which is a technique used in image processing to identify and emphasize edges in an image. It is computed by convolving the image with the horizontal filter and the vertical filter which provides two matrices representing the rate of change in intensity in the x and y directions for each pixel.

In another method, we can use a 1D guassian kernel and take the outer product with its transpose to obtain a 2D filter. After applying the Gaussian smoothing, I repeated the process of finding differences (like calculating gradients and edges). The main observation is that the results are less noisy and cleaner compared to the direct use of the difference operator. Because the process is associative, convolving the Gaussian filter with derivative operators - creating Derivatives of Gaussian filters - and then convolve the original image will produce the same image. This DoG method is more effective as it only requires a single convolution step but both produce the images that are smoother and exhibit less noise.

As you can see, both images are identical despite the different methods to obtain each image.

Part 2: Frequencies

Sharpening Images

To sharpen an image, we need to sharpen the details. Doing this is simply now that we know we can get rid of all the noise by applying the gaussian filtering and subtract that from the image. This will then give an image with just the details and we can amplify those details by multiplying by some factor.

The image is blurred using a guassian filter
The original image is subtracted by the blurry image to show just the details
The image before sharpening
The image after sharpening

It is clear that through this process that the sharpened version of the original image has more definition in the outline of the dome and each brick is much more distinct. Here is another example.

The image is blurred using a guassian filter
The original image is subtracted by the blurry image to show just the details
The image before sharpening
The image after sharpening

Hybrid Images

We can also create an illusion by stacking a high frequencies of one image onto the low frequencies of the other image. The algorithm to do this first requires that the 2 images are aligned. The low frequencies can be generated by simply using a guassian filter. The high frequency image is generated by finding the low frequency and subtracting that from the original image. Then, the images are stacked on top of each other.

Ryan Reynold before his low frequencies are used
Ryan Reynold before his high frequencies are used
The images together
The frequencies of each before combining
The frequencies of each after combining
Trump before his low frequencies are used
Harris before her high frequencies are used
The images together

An example of a failure: This one did not work because the high frequencies of the flag on top blends in with the low frequencies of the American flag so the high frequencies don't properly display the illusion.

American flag before its low frequencies are used
This flag before its high frequencies are used
The images together

Gaussian and Laplacian Stacks

Now we will shift focus to developing a way to blend images. To do this, we need to first create a stack of images with the guassian filter applied to them at increasing intensities. Using the guassian stack, we can also determine the laplacian stack by subtracing the current guassian level with the one after.

The Gaussian Stack of an Apple
The Lapacian Stack of an Apple
The Gaussian Stack of an Orange
The Gaussian Stack of an Orange

Multiresolutional Blending

Using the guassian and laplacian stacks, we can blend 2 images together. After we have the respective stacks, we need to have a guassian stack of the mask. Then, apply the formula: blended = (1 - guassian_mask_stack) * image1 + guassian_mask_stack * image2

Mask for the image below
Oraple!
Mask for the image below
I will finish this project when pigs fly (irregular mask)
Mask for the image below
Hot diggity dog (linear mask)