CS194-26 Project 3

Frequencies and Gradients

by Kimberly Kao

cs194-26-aas

Part 1.1: Unsharp Mask

By using the following formula, we are able to sharpen images. I used a Gaussian kernel to create blurred images.

Images:

Original

Alpha = 5


Alpha = 10

Alpha = 15

Part 1.2: Hybrid Images

A hybrid image is one where we see Image A when we're up close but Image B when we're far away. To create a hybrid image, we low-pass filter Image A, high-pass filter Image B, and add them together. I used a 2D Guassian filter for the low-pass filter. For a high-pass filter, I subtracted the low-pass image from the original.

Derek

Nutmeg

Derek and Nutmeg

Benedict Cumberbatch

Otter

Benedict and Otter

Mark Zuckerberg

Ed Sheeran

Mark and Ed

Fourier Transform of Benedict and Otter:

Original Benedict

Original Otter

Low-pass filtered Benedict

High-pass filtered Otter

Hybrid Image

Part 1.3: Gaussian and Laplacian Stacks

The Gaussian Stack can be made by applying the Gaussian filter at each level. The Laplacian stack can be made from taking the difference between two Gaussian layers, with the exception of the last image which should be the corresponding Gaussian image. I set an arbitrary depth of 5 for my Gaussian and Laplacian stacks.

Gala


Gaussian Stack


Laplacian Stack


Mona Lisa


Gaussian Stack


Laplacian Stack


Benedict Otter

Gaussian Stack


Laplacian Stack

Part 1.4: Multiresolution Blending

Using the following multi resolution blending algorithm, we can produce images which seamlessly blend together.

Orapple

Mars and Venus

Trump with Duck Lips (irregular mask)


Part 2.1: Toy Problem

For this problem, we compute the x and y gradients from the image then use all the gradients, plus one pixel intensity, to reconstruct the original image. We have three constraints: 1) x-gradients of source should be similar to x-gradients of target, 2) y-gradients of source should be similar to y-gradients of target, and 3) the top left corners of the images should be the same color. We can solve these constraints by setting them up as a linear system of equations and finding the least-squares solution.

Original

Reconstructed

Part 2.2: Poisson Blending

For this problem, we attempt to seamlessly blend image s into image v by using the following algorithm:

  1. Select source and target regions. Select the boundaries of a region in the source image and specify a location in the target image where it should be blended. I used Photoshop and Illustrator to create the binary masks
  2. Solve the blending constraints:
    Once again, we can solve these constraints by setting them up as a linear system of equations and finding the least-squares solution.
  3. Copy the solved values v_i values into the target image

Below I show the source and target image, the binary mask, and final blending result (Note that the final result is a little faded because of pixel intensity normalization).

Penguin in Snow



Result


Totoro is a third wheel


Result


Doge appears in rainbow



Result


Failure case:
The image of "doge appears in rainbow" can be considered a failure. The entire bottom border of the doge is not blended well with the rainbow. This could be the result of the original doge image, which features the doge cut off at the neck. Another reason is that the rainbow colors contrast so differently with the plain doge background that the algorithm could not keep the original source pixel intensities.

Comparing multiresolution blending with Poisson blending:
Donald Duck

Using multiresolution blending

Using Poisson blending

For this particular image, the multiresolution blending worked better. A reason is that the boundaries were better blurred using the Gaussian filter, and that the pixel intensities of the duck lips were unchanged during the algorithm.