CS 194-26: Project 2 - Fun with Filters and Frequencies!

Tejas Thvar, Fall 2021

Part 1 - Fun with Filters

1.1 - Finite Difference Operators

Original Image

D_x convolution

D_y convolution

Gradient Magnitude

A Note on Gradient Magnitude Computation - Gradient Magnitude was obtained by taking the hypotenuse/sqrt(sum of squares) for both the D_x convolution and the D_y convolution, which gives us the partial derivative with respect to both x and y. Gradient Magnitude Binarized with Threshold 0.19

1.2 - Derivative of Gaussian Filter



Double Convolution

Blurred Image

D_x convolution with Blur

D_y convolution with Blur

Gradient Magnitude

Gradient Magnitude Binarized with Threshold 0.1

What Differences do you see? - We can see that there are much less artifacts in the detected edges of the blurred gradient than just the gradient. We can also tell that detected edges are a lot clearer from the blurred gradient than the regular gradient.

Single Convolution

D_x DoG Filter

D_y DoG Filter

D_x convolution

D_y convolution

Gradient Magnitude

Gradient Magnitude Binarized with Threshold 0.08

We can see that the results are the same from single and double convolution methods.

Part 2: Fun with Frequencies

Part 2.1: Image Sharpening

We performed image sharpening by adding back the high frequencies of the image to the image. For the below results, alpha = 0.7 was used across color channels. A Gaussian Kernel of sigma=3, kernel=9 was used for blurring.



When we blur, and then resharpen an image, we can see the following results displayed below. Although we can see that the sharpen filter did in fact sharpen the blurred eagle, the sharpening operation is insufficient. We can see that the edges around the eagle's head are still blurry, as well as the edges of the eagle's facial features (beak, eyes, brow). However, we can see clearer edges in the scruff of the eagle's neck feathers, as well as general feather definition. This is most likely due to clipped values / high frequency information being lost when blurring.



Part 2.2: Hybrid Images

We hybridized the images by applying a low pass filter to one image, a high pass filter to the other, and combining the results. Before applying this filters, we must align these images to ensure that they line up when adding (used provided script). Below, we can see the hybridized results in grayscale for the sample image, Derek and the cat Nutmeg. Gaussian Kernels of size 20 were used with high sigma = 13 and low sigma = 8.

We can also see the results with color on the low frequency, high frequency, and both below.

We can see that the results are effectively unchanged when applying color to just the high frequency filtered image, and are reasonably colored when applied to both filters or just the low. We choose applying both filters to minimize colorization bias from either high or low frequency.

Below results are shown for 3 hybrid cases.
The first is a failure case, due to very poor alignment between the input images, a cat and dog. However, for both the cases of the hybrid Clintons and hybrid Venus sisters, we can see that the alignment is strong and that the high frequency portion of the image does start to disappear at farther distances. In these cases, kernel size of 10 was used with low sigma at 8 and high sigma at 13.

For the Serenus Case (Serena x Venus Williams), the frequency analysis is shown per image (Log Mag of Venus, Log Mag of Serena, Log Mag of LPF Venus, Log Mag of HPF Serena, Log Mag of Hybrid respectively).

Credits: Eagle - apogeephoto.com, Baby - benotto.org, Dog - tripadvisor.com, Clintons - Forbes/White House Official, Williams' - NYTimes

Part 2.3: Gaussian/Laplacian Stack

Below we can see the recreation of figure 3.42 from the textbook.








Part 2.4: Multiresolution Blending

Below, results are demonstrated for the following set of images. The mask is shown to the right. Figure 3.42 was recreated for the blended cat example.










I have never experimented with photoshop for image blending or hybridization, so this project was an awesome new learning experience. I especially enjoyed learning more about the principles of image hybridization and how it relates to frequency/viewing distance.

Credits: Cats - Dorkycats, House/Winter - Istockphoto