Project 3 - Andrew M. Zhang - cs194-26-agx

Part 1.1 - Sharpening

I subtracted a gaussian blur from the image to get the high frequency features.

I scaled the high frequency features by an arbitrary alpha. Here's a turtle:

Old Magneto

Part 1.2 - Hybrid Images

Fourier Analysis:

Here is the fourier analysis. Let us first look at the 2 original images.

Image 1

Old Magneto

Image 2

Young Magneto

Fourier Images

part1-2-fourier

Full Sized Hybrid (not sure which is better)

part1-2-fourier
part1-2-fourier

More hybrid images:

Spy And Pyro

Semifailure:

Frank

Part 1.3

Stacks of Lincoln

Dali

Stacks of Magneto

Dali

Part 1.4

The Oraple

Oraple
Oraple

Sun Moon

Oraple
Oraple

Flying Dutchman - Irregular mask

Ghost Ship
Ghost Ship

The Anakin-Vader

Note: Image was manually aligned
Anikin Vader
Anikin Vader Analysis

Part 2

General Description of Project

This part of the project concerns using Poisson blending to blend 2 images together in a smooth manner. We achieve this by first defining a source image portion that will be moved into the
image unmasked portion to try to get it to keep its gradient features while also trying to match the colors of the background along the edges of the source image portion.

Fortunately this optimization can be expressed as a least squares problem which we solve with a sparse least squares solver.

Part 2.1 - The Toy Problem

The point of this problem is to show that we can reconstruct an image from only its gradients and a single pixel of intensity (grayscale colour).

toys.png

Part 2.2

Good Example

I chose the UFO to the right hand side. The way I did this was I first separated the colors channels. For each channel, I used the Poisson blending algorithm. I found that it was nice to think of the second summation in the HW assignment as (vi - (si - sj + tj)).
I also used a lil-matrix (a type of scipy sparse matrix), and I also wrote a few helper functions to help convert between a single variable represntation of a mask pixel, source image co-ordinate, and target image co-ordinate.

Source img

area51.png

Target img

ufo51.png

Combined

ufo51.png

Good Case 1 - Flying Dutchman

Combined

area51.png

Source img

ufo51.png

Target img

ufo51.png

Bad Case 2 - Vader spline

This failed sicne the darkness of Lord Vader's helmet kind of darkens Anakin's skin too much.
The sizing is off too, but the colour wouldn't have looked good anyways.

area51.png

Part 2.2 - Bells and Whistles

Mixed Gradients - Flying Dutchman

I used mixed gradients to improve the flying dutchman. With these mixed gradients, the clouds extend
through the dutchman's mask a lot more clearly

Without Mixed Gradients

area51.png

With Mixed Gradients

area51.png

Compare with Laplace

We see that in the laplace blending, a lot more of the background bleeds through to the mixed image

It doesn't work well since this bleeding is a gaussian blurred bleed, which just ends up
lightening our source image. Meanwhile poisson blending tries to keep the details sharp while
trading off the bleed between the images.

I beleive that laplace blending works better if you want more smooth bleeding between the images,
such as in the orple case. However if you want a more continous blend, mixed gradients or poisson
blending might be better

With Laplace Blending

area51.png

With Poisson Blending

bad