CS 194-26: Image Manipulation and Computational Photography, Fall 2017

Project 3: Fun with Frequencies and Gradients

Iris Chen, cs194-acy

Part 1: Frequency Domain

Part 1.1: Warmup

In this part of the project, we "sharpened" input images. This was achieved by applying a gassian filter to the image to obtain a "smoothed" image, then subtracting it from the original image to get only the detail that was lost in the the process of smoothing. We then add this fine detail to the original image to achieve a sharper looking image.

Original
Sharpened: alpha=1
Original
Sharpened: alpha=0.75

Part 1.2: Hybrid Images

Here, we created a hybrid of two input images by combining the low frequencies of one image and the high frequences of the other. In this way, the viewer actually see two very different images depending on how near or far they are to the image. At a close distance, the high frequencies dominate the viewer's perception; when standing further away, the low frequencies dominate.

Failure Case

We can also analyze the frequency analysis of this transformation. Here, we examine the Fourier transforms of the elephant and dog.

Input Elephant
Input Dog
Filtered Elephant
Filtered Dog
Hybrid Image

Part 1.3: Gaussian and Laplacian Stacks

Salvador Dali's "Lincoln and Gala"

"Mona Lisa"

Monkey Baby Hybrid (from 1.2)

Part 1.4: Multiresolution Blending

In multiresolution blending, we can create a seamless blend by computing at each band of image frequencies. Here, we construct our Laplacian stack (with 5 levels) in order to blend together an image of a pug and an eagle in flight.

Here are some other blended images.

Part 2: Gradient Domain Fusion

Overview

Now, we can finally move on to an advanced blending technique. Instead of blending each frequency by constructing the Laplacian stack (as in part 1), we can actually formulate the blending constraints as a least squares problem.

What this equation is saying is that we want to solve for the output image v such that the gradients of v match the gradients of the source image within the masked region. For the pixels outside of the masked region, we can simply set the gradients of v to be equal to the gradients of the target image. In this way, while the exact colors of the masked area in v may not be exactly the same as in the source image, since the gradients match (as closely as possible), the image will still be transferred properly.

Part 2.1: Toy Problem

In this problem, we take a short introduction in gradient domain processing by reconstructing an input image. This reconstruction is done by performing a least squares minimization problem. The objectives of our least squares function include:

Original
Reconstructed

Part 2.2: Poisson Blending

Alligator in bowl of milk

milk.jpg
mask.jpg
alligator.jpg
Direct copy
Poisson blended

And... some more results!

Flying penguin

Elephant with butterfly ears

As we can see above, in the first example, the alligator blends in seamlessly into the milk background. However, the butterfly does not blend as well into the elephant. This may be due to the fact that the original butterfly image has a completely white background (thus all the gradients of the background are 0), while the elephants image has a complex green background. It is impossible to match the gradients for these two images in the mask area, thus the poisson blending algorithm fails here.

Multiresolution Blending vs. Poisson Blending

We can see a drastic improvement using poisson blending. The penguin is blended much more seamlessly into the background. Also notice that the masks was much looser in poisson blending, and was easier to create.

Multiresolution blending
Poisson blending