CS 194-26

Project 2: Fun with Frequencies and Gradients!

Karthik Kadalabalu Matha

Warmup

In this part, images are "sharpened" by using a high-pass filter, which is created by applying a gaussian blur on the image and then subtracting the blurred image from the original, giving us some details taken away by the blurring. These details are then readded to the original image to sharpen the image. For this, I wanted to try and apply this masking to an image that has had a bokeh effect applied to it. With the bokeh effect, the item in the foreground of the image is more pronounced and the background is out of focus and is blurry. With the "sharpening" effect, the leaves seem more pronounced with their colors and details.

original sharpened

1.2 Hybrid Images

Hybrid images are images that look different depending on the viewing distance. The high frequencies are detectable up close, but cannot be detected at large distances. We obtained the low-frequency image by applying a gaussian blur to one image, and the high frequency image by applying the high pass filter from the previous part, producing the details in the higher frequencies and then the hybrid is created by overlaying the two. The hybrid of Trump's side profile and the monkey's side profile is a failure because both images have so many details in the higher frequencies that they compete when up close, and from afar, the monkey is only detectable.

image1 image2 hybrid

Also we can examine what is happening in the frequency domain. The gaussian blurring removes a lot of the high frequency noise, shown by the outer areas of the fourier transform image, while the high frequency filter, removes the lower frequencies, located in the center of the fourier transform. The hybrid image then combines the frequencies of both images.

original 1 original 2
low pass filtered 1 high pass filtered 2 hybrid image

1.3 Gaussian and Laplacian Stacks

One method of blending images together is using Laplacian stacks, which are formed from Gaussian stacks. A stack of gaussians is defined by applying the gaussian filter onto the previous image, starting with the original image. The laplacian stack is formed by taking the difference between two consecutive levels of the Gaussian stack, so that it has lower and lower frequencies.

original Gaussian Level 1 Gaussian Level 2 Gaussian Level 3 Gaussian Level 4 Gaussian Level 5 Gaussian Level 6 Gaussian Level 7
original Laplacian Level 1 Laplacian Level 2 Laplacian Level 3 Laplacian Level 4 Laplacian Level 5 Laplacian Level 6 Laplacian Level 7

2.1 Toy Problem

For this section of the project, we look at gradient domain processing to place images onto a source image while blending the transition between the two. We use loss functions that are then minimized to make the difference between neighboring pixels match the source as closely as possible. For this toy problem in particular, we aim to place the image onto a blank source, covering the whole area. Then we want to fuse the gradient domains to match the output to the source, and we achieve this by solving an overdetermined system of equations: v(x+1, y) - v(x, y) = s(x+1, y) - s(x,y) \\ v(x, y+1) - v(x, y) = s(x, y+1) - s(x,y) \\ v(1,1) = s(1,1) .

input output

As we can see, the input and output are the same which indicates that we were successful in recovering the original image!