CS 194-26: Computational Photography, Fall 2017

Project 3: Fun with Frequencies and Gradients!

Tom Cheng, cs194-26-aev



Part 1.1: Warmup

To sharpen the image, I first applied a gaussian filter to the original. Afterwards, I added the result of the last operation to the original.

Unsharpened Lenna
Sharpened Lenna

Part 1.2: Hybrid Images

In this portion, I basically implemented what was proposed by the spec. In addition, I read in the image one color channel at a time, so I was able to easily implement it in color! In my opinion, color does seem to make everything better!

A Failure

A bug that took me forever to resolve was forgetting to adjust the cutoff frequency. I was wondering why I could never get both images to be somewhat prominent.

Sophie
Doggo
Sophie + Doggo

The Results

Derek
Nutmeg
Derek + Nutmeg
Sophie
Doggo
Sophie + Doggo

Me
Doggo
Me + Doggo
Me Fourier
Doggo Fourier
Me + Doggo Fourier

Part 1.3: Gaussian and Laplacian Stacks

In this portion, I implemented the stacks based on what was proposed in the spec. In terms of the sigma passed into the gaussian filter, I did 2^(level + 1) * std to simulate a "downsampling".

Lincoln and Gala

Lincoln/Gala

Gaussian Stacks


Level: 1
Level: 2
Level: 3
Level: 4
Level: 5

Laplacian Stacks


Level: 1
Level: 2
Level: 3
Level: 4
Level: 5

Mona Lisa

Mona Lisa

Gaussian Stacks


Level: 1
Level: 2
Level: 3
Level: 4
Level: 5

Laplacian Stacks


Level: 1
Level: 2
Level: 3
Level: 4
Level: 5

Tom + Doggo

Tom + Doggo

Gaussian Stacks


Level: 1
Level: 2
Level: 3
Level: 4
Level: 5

Laplacian Stacks


Level: 1
Level: 2
Level: 3
Level: 4
Level: 5

Part 1.4: Multiresolution Blending (a.k.a. the oraple!)

Using the previous implementation, I was able to add a few simple additions to the code and achieve multiresolution blending. In addition, I read in the image one color channel at a time, so I was able to easily implement it in color!

NOTE: Sadly, I'm running into this weird bug where everything is SUPER blue intensive. I've double and triple checked my code but couldn't find anything. It doesn't seem like it's affecting the blending that much, so hopefully, it's not too much of a big deal.

Oraple

Orange
Apple
Oraple

Real Duck in Cartoon

Real Duck
Cartoon River
Real Duck in Cartoon River

GanDore

Dumbledore
Gandalf
GanDore
Stacks
Dumbledore
Dumbledore - 1
Dumbledore - 2
Gandalf
Gandalf - 1
Gandalf - 2
Gandalf - 3
Masks



Mask - 1
Mask - 2
Mask - 3
Mask - 4
Mask - 5
Mask - 6
Mask - 7
Mask - 8

Part 2: Gradient Domain Fusion

Rather than preserving a pixel's intensity like we were doing before, let's explore a different solution. In particular, this solution is designed to exploit the human visual system. We learned from class that the human eye perceives relative changes in intensity much more effectively the absolute intensity of a pixel. With this fact in mind, we will alter our approach and instead try to preserve the gradients in the pictures. Given an image, an "object" to augment into image, and mask, we will be implementing the following steps:

Part 2.1 Toy Problem

Recovered Image

Part 2.2 Poisson Blending

My Favorite

Here, we can easily see that the Poisson blending method creates a much more seamless transition from image to image. This is because we're choosing to preserve the gradients, which results in a much smoother transiiton from one photo to the next. This is opposed to just copying the pixels directly, which is pretty much just cropping a photo and pasting it on another photo. I like this photo in particular because this is how I envision what a dynamic "camouflaging" stealth plane would behave like given any environment.


Source Image
Target Image
Pixels Copied Directly
Blended

The Results

The penguins looked okay. However, it was slightly overcropped because I created the mask manually using Photoshop.

Source Image
Mask
Blended

Failure: For some reason, trying to blend three penguins ruins everything. I'm not too sure why. Do the black spots on their heads (3, instead of 1) create too much abrupt contrast that the poisson blending can't handle it robustly?

Source Image
Mask
Blended

A Comparison

I would probably argue that the Laplacian pyramid worked best for this particular purpose. Admittedly, I couldn't have picked a worse combination of photos to blend for the poisson method. The sharp contrast between the white duck and blue river really messed the poisson blending up. Since it's trying to create a fluid transition, it really warped the color of the duck, making it very weird. I believe that the poisson method should be used whenever the boundaries of what we're trying to add matches well (color wise) with where we want the photo to end up at. This will really allow the poisson method to shine because it'll use its gradient preserving property to create a seamless transition between the two photos. In photos with noisy backgrounds, it would probably be better to use the Laplacian pyramid blending to hide the mismatch with noise. Noise amongst more noise would make all the noise seem more "normal".

Source Image
Target Image
Laplacian Pyramid
Pixels Copied Directly
Blended

The End.

Thanks so much for reading!