CS 194-26 Project 3

Fun with Frequencies and Gradients!


1.1 Warmup

I chose to sharpen this photo of a flower using the unsharp masking technique we covered in class.

Too blurry

In order to sharpen the image, I applied a Gaussian filter to it, then subtracted the result from the original image in order to isolate the high frequencies. I added these high frequencies back to the original image.

Moderate sharpening: sigma = 2

High sharpening: sigma = 8

1.2 Hybrid Images

Nutmeg and Derek

Cat

Man

Catman

Student and Professor

Student

Professor

Prodigy

Snoop and Dachsund (my favorite result)

Dogg

Dog

Dogg Dog

Log magnitude of Fourier transform of Dogg input

Log magnitude of Fourier transform of Dog input

Log magnitude of Fourier transform of filtered Dogg input

Log magnitude of Fourier transform of filtered Dog input

Log magnitude of Fourier transform of hybrid Dogg Dog image

Minion and M&M (failure)

Minion

M&M

Bad hybrid combination

This example is a clear failure. The corresponding features in the two source images don't line up - for instance, the mouth of the M&M is on the minion's chest, and the body proportions of the two are very different. Therefore, this result is not a good hybrid image.

Bells and Whistles: Color Images

Catman in color

Prodigy in color

Dogg Dog in color

To my eyes, the second and third image benefit from adding color. In both of those cases, there are overlapping regions which have similar colors in their original images, so it makes the results a bit more convinving. For instance, in the Dogg Dog image, the dark regions of the dog's nose and ears overlap pretty well with Snoop Dogg's mustache and hair. However, in the first image, the color makes it a bit more obvious that one of the component images is a person, since Derek's face shape and color don't align with what you'd expect from a cat.

1.3 Gaussian and Laplacian Stacks

Gaussian stack of Gala Contemplating the Mediterranean Sea which at Twenty Meters Becomes the Portrait of Abraham Lincoln

Laplacian stack of Gala Contemplating the Mediterranean Sea which at Twenty Meters Becomes the Portrait of Abraham Lincoln

Gaussian stack of Mona Lisa

Laplacian stack of Mona Lisa

Gaussian stack of the two dogs

Laplacian stack of the two dogs

1.4 Multiresolution Blending

Orapple

Apple

Orange

Oraple? Apange?

Pitbull Pineapple

I have a man

I have pineapple

Unh! Pineapple-Man

Fire Sword

Danger

Danger

Irregular mask

Double Danger

Dolphins on a lake (Failure)

Fish

Lake

Irregular mask

Fish in Lake

We can see in this last case, our multiresolution blending approach doesn't produce a convincing result. It wasn't able to match the colors of the different bodies of water together, which makes for a jarring transition between the two images.

2 Gradient Domain Fusion

Description

We want to blend part of some source image into a target image seamlessly. The naive method would be to directly copy and paste this piece of the source image onto the target image. Unfortunately, this will create a very obvious and jarring transition between the two images. Instead, what we do is match the gradient of the source to that of the target, since people often care more about the gradient than they do the intensity. What we do is modify the gradient of the new piece to that of the background and place this new piece onto the background; the background pixels outside of this changed region will not be modified. By using this approach, we attempt to blend the images together as seamlessly as possible.

Toy Problem

Original image

Recovered image

My process worked - the input and output images match.

Poisson Blending

Dolphins on a lake (favorite result)

Source image

Target image

Direct copy/pasted image

Laplacian pyramid blended image

Poisson blended image

We get this result by applying the background gradient to the source dolphin image. We see that the intensity of the dolphin image changes, which is why the dolphins turn red. However, the Poisson blended image clearly blends much better than the direct copy/pasted image.

I had previously attempted to use Laplacian pyramid blending for this image, as shown above. The result of the Laplacian pyramid blend was not very good - you can see that it looks almost like the result of directly copy/pasting the source onto the target. Using Poisson blending works much better for this instance since it's able to match the source to the target more seamlessly.

Hand eye

Source image

Target image

Poisson blended image

Puppy in ocean (failure)

Source image

Target image

Poisson blended image

Clearly, in this last example, Poisson blending didn't give us a good result. Part of the reason could be that the grassy background of the first image could not be matched to the waves of the second. Furthermore, the colors in both images are very different, which could contribute to this less-than-satisfactory result.

Bells and Whistles: Mixed Gradients

In regular Poisson blending, we always use the source gradient as the guide for adjusting our image. However, with mixed gradients, we can use either the source or target gradient depending on which has a larger magnitude.

Original Poisson blended image

Mixed gradient blended image

It's clear that using mixed gradients in this case delivers far bette results. It's much harder to see the grassy border around the dog in the mixed gradient image.