CS 194-26 Project 2: Fun with Frequencies and Gradients!

Nanxi Wang


Project Overview

Part 1 of this Project involved dissecting images into their various frequencies and using this to manipulate and combine them.

The first task was to "sharpen" an image using the unsharp mask technique. This involves making a blurred version of the image, subtracting that from the original, and adding back the difference. The end result is that the high-frequency details will be amplified, thus "sharpening" the image.

The next few tasks involved separating out and combining the high/low frequencies of various images to create interesting composites. Adding the high frequences of one image to the low frequencies of another allows us to create a hybrid that looks different depending on your distance from the image. Separating and blending different "channels" of frequencies creates composites with transitions that look much more smooth and natural.

Part 2 of this project was focused on exploring what we could do by looking at the gradients of an image, rather than the exact values. In 2.1, I reconstruct an image using only the gradient values and a single pixel intensity by setting up a least-squares system of equations. This was expanded on in Part 2.2, where I use the same technique to piece together composite images that look (somewhat) seamlessly blended. By minimizing the difference between the gradients of the target and source and disregarding exact pixel values, we create edges that connect smoothly and color values that mesh well.



Part 1.1: Warmup

Unsharpened Images



Sharpened Images

In order to sharpen these images, I used the "unsharp" masking technique we covered in class. In order to sharpen details, I used a guassian kernel with a small size and small sigma. You can see how Derek's facial features and hair are more defined, and the bumps on the little toad are more visible.




Part 1.2: Hybrid Images

Hybrid 1: Derek and Nutmeg

This hybrid of Derek and Nutmeg was the most successful of the 3 I tried. Below are the fourier representations of Derek, Nutmeg, and their hybrid. You can clearly see that the hybrid fft contains elements of both Derek and Nutmeg's fft.



Hybrid 2: Michelle and Barack Obama

This hybrid of Michelle (high pass) and Barack (low pass) was also pretty successful! However, Michelle's dark eye makeup stands out very much even at a distance.



Hybrid 3: Pug and Samoyed

This hybrid of 2 of my favorite dog breeds, pugs and samoyeds, did not turn out very well. There was too much variation in the two dog breeds' face shapes, so they did not line up very well.




Part 1.3: Gaussian and Laplacian Stacks

Derek/Nutmeg Stacks

These are the stacks generated for the Derek Nutmeg hybrid image.



Lincoln Stacks

These are the stacks generated for Dali's Lincoln in Dalivision.




Part 1.4: Multiresolution Blending

Orange/Apple

From left to right: apple, orange, and half apple/half orange with a vertical split mask.



Painting/Statue

A painting and statue of a woman blended together with an irregular mask.



Mountains/Beach

A mountain range and beach blended together with a horizontal split mask.




Part 2.1: Toy Problem

The image on the right is a reconstruction of the image on the left based on the image's gradients.

Part 2.2: Poisson Blending

Blend 1: Nutmeg's eyes onto Derek

Above shows the process of attempting to blend Nutmeg's eyes onto Derek's face. The first two are the original images, while the third shows Nutmeg's eyes transposed onto Derek's face without any blending. The last image shows the blended result, which has lost most of its sharp edges, though still looks a bit funny because of Nutmeg's fur. Choosing 2 images that don't have such drastically different gradients would make the blend look more natural.



Blend 2: Penguin onto snow

Above are two attempts at blending penguins of different sizes onto this snowy background. The first didn't turn out too great, especially the area that overlaps with the tree and mountains in the background. Again, the gradients of the two images are too different, so the end result still looks jarring. The smaller penguin turned out quite well though.



Blend 3: Annie onto Chris Pine and Gal Gadot

My friend Annie thinks Chris Pine is really hot, so I tried to blend her in place of Gal Gadot's face so she could be in some photos with him. I think the actual blending turned out pretty well! However, her face shape isn't very similar to Gal's face shape, so the forehead/chin proportions look off. Annie as Chris Pine also looks a bit weird.