Project 3: Fun with Gradients and Frequencies

Ashley Chen

Part 1.1: Sharpening Images

To sharpen an image, I ran the image through a gaussian filter, then subtracted that result from the original image. This left only the high frequencies of the image. To create the sharpened image, I added back these high frequencies to the original image.

Doges original Doges grayscale Doges sharpened
Lillian original Lillian grayscale Lillian sharpened

Part 1.2: Hybrid Images

For hybrid images, I added together the low pass filter of one image with the high pass filter of another. This results in an image which looks like one thing from far away, and another from close up. Here are several examples of the results:

Derek and Nutmeg

Derek Nutmeg Hybrid

Elephant and my cat Mika

Elephant Mika Hybrid

Failure: Elephant and Hippo with babies (due to them not matching up well and bad frequency cutoffs)

Elephant with baby Hippo with baby Hybrid

Favorite Result: Pug and Kitten

Pug Kitten Hybrid

Here is the fourier analysis of these pictures

Pug High pass of pug
Cat Low pass of cat
Hybrid fourier transform

Part 1.3: Gaussian and Laplacian Stacks

In this portion, I created gaussian and laplacian stacks and applied them to images with interesting frequency makeups. Since each layer of the laplacian stack is like a bandpass filter, it breaks down the frequencies of the picture. This has an interesting effect on hybrid images, where it shows the levels of just the high frequencies or just the low ones, displaying a different image at different levels.

Mona Lisa

Gaussian stack

Laplacian stack

Salvadore Dali's Gala Gala Contemplating the Mediterranean Sea which at Twenty Meters Becomes the Portrait of Abraham Lincoln-Homage to Rothko (Second Version)

Gaussian stack

Laplacian stack

My pug-cat hybrid image

Gaussian stack

Laplacian stack

Multiresolution Blending

To blend two images together more seamlessly, I used multiresolution blending. For each picture, I created the laplacian stacks for them. The masks for these images look like (in the simplest case), an image that is half white and half black. Then, I applied the corresponding mask (run through a Gaussian filter) to each image through an elementwise multiplication. One gets the normal mask, and the other gets the inverse of that. Then, I combine the levels of the stack back together to reconstruct the blended image.

Laplacian stacks for each image to be blended

Other Images

Part 2.1: Toy Problem

The purpose of this toy example was to solve an optimization as a least squares problem to reconstruct the original image. The bulk of the work went into constructing the system of linear equations, using the x gradient constraints, the y gradient constraints, and the constraint of the top left pixel. Then, by using a least squares solver you can solve for your new pixel values and use those to reconstruct the image.

Before After

Part 2.2: Poisson Blending

This part was very similar to part 2.1, but instead we used the gradients of each neighboring pixel for each pixel to create the blended image. Our goal here was to copy the source gradients over to the target while making it as similar to the target's gradients at that location for the most even blending. To do this, I modeled an equation Ax = b and solved for the new pixel values x. If the pixel is within the mask, I use the gradients to solve for the pixel value, and if it is outside the mask, I simply set it to the value of that pixel in the target image. It works much better than the multiresolution blending we did in part 1 because it changes the colors of the whole image rather than just blending at the seam.

Source Mask Target Multiresolution seam blending Poisson blending
Source Mask Target Poisson blending
Source Mask Target Poisson blending

Failure case: This is due to backgrounds being too different in texture. The gradients from the grass are so different from those of the moon's surface that it is very difficult to make these seamlessly blend together.

Source Mask Target Poisson blending

Comparing the two blending techniques, the poisson blending is generally better because it will "adjust the lighting" and allows you to create a sloppy mask including some of the background of the source image. However, in the case of the oraple, I think the Laplacian pyramid blending works better because the seam is very smooth and the lighting and style of both pictures already match.