Jeffrey Shen Project 2

This is my submission for CS 194-26 Project 2: Fun with Filters and Frequencies.

Part 1: Fun with Filters

Part 1.1: Finite Difference Operator

First we use the finite difference operators to do partial derivatives on our images. The finite difference operators will be convolved and will calculate the changes from each part of the image with respect to the Dx or Dy direction. We will be using the cameraman image.

By convolving with the Dx and Dy filter respectively, we get the two images that represent the partial derivatives.
Dx: Dy:

Then we binarize the image according to a chosen threshold to get an edge image.
Dx: Dy:

Part 1.2: Derivative of Gaussian (DoG) Filter

We can also first take the gradient of the image in order to reduce the noise in our binary image. We can first create a blurred image and then repeat the process from above to get this new Dx image.
Dx:
Another way we can do this is by using the Derivative of Gaussian Filter which is created by convolving the difference filter with the 2D Gaussian filter, then convolving with the original image. This leads us to the same result:
Dx: Dy:
After blurring the image with a Gaussian filter and convolving with the finite difference filters, we can see that differences is that the image with the gaussian filter has much more clean and connected edge outlines. However in order to get these better outlines, the threshold must be lowered. Without lowering the threshold there are alot less edges detected. The Gaussian is able to make the edges more smooth by reducing high frequencies and smoothing out the values so that the result of the difference operators are less high, however edge changes are alot more smooth.

Part 2: Fun with Frequencies

Part 2.1: Image "Sharpening"

We will "sharpen" and image by applying the unsharp mask filter and see the difference it is able to make. We first try on the given Taj image.
Original: Sharpened:

Original: Sharpened:

Original: Blurred: Sharpened:
We see from blurring the original and attempting to resharpen it that the sharpening definitely makes it better than the blurred, however it cannot get back to the same level of clear detail as the original. However it definitely does make the image feel a bit more clear.

Part 2.2: Hybrid Images

In this section to create Hybrid Images, we use a low pass filter on one image and a high pass filter on another image. This will allow us to view the the low frequency part of the image at far distances but the high frequency part at close distances. For example, we can use this with a Derek and Nutmeg.
Hybrid:

We can also try Hybrid Images with different examples.
Hybrid:

We can also take a look at the fourier transforms of Young Biden, Biden, and the hybrid image.
Young Biden
High Pass Filtered:

Biden
Low Pass Filtered

Hybrid Images

Hybrid:

This last hybrid image with Ironman and Spiderman did not work too well because the images are a bit too small and it is hard to tell the difference between them. It was also hard to align their bodies completely which made it hard to see the difference. Hybrid images works with color images when the colors are similar, however for images with very different color schemes, the color does not work as well. And it works well when there are specific features that distinguish the two images.

Part 2.3: Gaussian and Lapacian Stacks

For the Gaussian and Lapacian Stacks we want to blend together images using different bands to better slice the two images together. We can use a mask to slice to the two images and create a new image with the two images combined together. For example here are the outputs for the oraple.

Part 2.4: Multiresolution Blending

Through Multiresolution Blending we are able to stich two images together and make the border much more natural by blurring at each band of the frequency and combining the layers together. We are able to see the results with the oraple first.
Orange
Apple

Oraple
We are then able to carry out the blending on various other examples and even add custom masks rather than just a vertical split.
Cal TV Mask

Cal TV
Here were the laplacian filters for the Cal TV images:

Here is another example, creating a centaur:
Horse Warrior Mask
Centaur
The Centaur did not turn out as well as I had hoped because it was hard to create a perfect mask that also covered up the horse and it was difficult to find two images of a horse and warrior that perfectly was able to line up. The backgrounds of the images also did not line up and caused there to be a bit of a blur at the end. It was also tough to create a mask to perfectly outline the warrior wihout knowing how it would line up with the horse. However, I enjoyed being able to see how creating a centaur would end up and was an interesting challenge to blend.

Overall, I learned alot about convolution, filters, and the freqency domain. I found it really cool that the hybrid images actually worked so well in that from further away it really became a completely different image. It was interesting to see how our human vision of seeing low frequency at far distances correlated with the frequency domain concepts we discuss in class.