CS194-26 Project 2: Fun with Filters and Frequencies

Matthew Tang

Part 1.1: Finite Difference Operator

We can use finite difference ([[1, -1]] for Dx and [[1],[-1]] for Dy) as a filter to create partial derivatives. Once we have both partial derivatives, the gradient can be calculated by first squaring each partial, adding them, then taking the square root. The equation is as follows: grad = sqrt(dx^2 + dy^2). Then, we can binarize that into an edge detector.

Partial x

Partial y

Gradient

Edges (binarized)

Part 1.2: Derivative of Gaussian Filter

We can use a DoG filter to create another edge detector by blurring the image first. This edge detector is much smoother and less noisy than that of 1.1. We can also do the single thing with one convolution by convolving the gaussian with D_x and D_y to achieve the same result (or at least, very similar. There are minor differences due to convolution mode="same").

Blurred

Partial x

Partial y

Gradient

Edges (First method)

Edges (Second method)

Part 2.1: Image Sharpening

We can sharpen images by subtracting the blurred (low pass) version from the original image to retain high frequencies, and add that back. This can be done in a single convolution using the following formula. Some examples should be zoomed in to see the differences more clearly.

Taj (Original)

Taj (Sharpened)

Simu (Original)

Simu (Sharpened)

Frog (Original)

Frog (Sharpened)

Penguin (Original)

Penguin (Blurred)

Penguin (Sharpened, unblurred)

Part 2.2: Hybrid Images

We can create hybrid images using the approach described in the SIGGRAPH 2006 paper.

Nutmeg (Original)

Derek (Original)

Nutrek (Hybrid)

Batman (Original)

Christian Bale (Original)

Baleman (Hybrid)


My favorite was a combination of Anant Sahai and Amit Sahai which I am calling the Sahai-brid.

Anant (Original)

Amit (Original)

Sahai-brid (Hybrid)

Anant FFT (Original)

Amit FFT (Original)

Anant FFT (Filtered)

Amit FFT (Filtered)

Sahai-brid FFT (Hybrid)


Unfortunately, not all photos work well with this algorithm. Here is an example that did not work well - Iron Downey Jr. This example does not work well since the face shapes just were not that similar. The pupils line up, but iron man's face is far narrower so it does not overlay well.

Iron Man (Original)

Robert Downey Jr. (Original)

Iron Downey Jr. (Hybrid)

Part 2.3: Multiresolution Blending

We create a gaussian and laplacian stack similar to figure 3.42 from the spec.

Orple (Mask)

Apple (Original)

Orange (Original)

Orple (Hybrid)


Here are the laplacian stacks created:

Laplacian of Apple (LA)

Laplacian of Orange (LB)

Laplacian of Oraple (LS)

Part 2.4: Blending with masks

We can now use a Gaussian and Laplacian stack in addition to a Gaussian stack of a mask to blend photos.

Hobra (Mask)

Horse (Original)

Zebra (Original)

Hobra (Hybrid)


Here are the laplacian stacks created:

Laplacian of Horse (LA)

Laplacian of Zebra (LB)

Laplacian of Hybrid (LS)


These use irregular masks (ellipse shaped)

Cloth (Mask)

Cloud (Original)

Sephiroth (Original)

Cloth (Hybrid)

Simufina (Mask)

Simu (Original)

Awkwafina (Original)

Simufina (Hybrid)