Project 3 - Fun with Frequencies and Gradients!

Brandon Lee, cs194-96-aeo

Part 1.1 Warmup

For part 1.1, I sharpened an image by applying a gaussian filter, and then subtracting from the original image to get a detail image. I then added this to the original image, thus sharpening the edges.

original image
The original image.


The image after a gaussian filter is applied.


The detail image.

Here are some sharpened images, with various alphas

alpha = 1


alpha = 2


alpha = 5

Part 1.2 Hybrid Images

For part 1.2, I combine a low-pass filtered image with a high-pass filtered image, to create a final hybrid image. This image is viewed differently based on distance, because of the mix of high and low frequencies.



Hug Fourier


Hiflinger Fourier


Hug Filtered


Hilfinger Filtered


Pash Hufinger

Here are some more examples of blended images.


And here is a sharkoctopus, that didn’t turn out well because alignment between them was quite hard.


Part 1.3 Gaussian and Laplacian Stack

In part 1.3 we generate a Gaussian stack by repeatedly applying a Gaussian filter to an image without subsampling.





We then create a Laplacian stack by taking the difference between Gaussian stack layers.





Here is the Gaussian and Laplacian pyramids from the hybrid image.










Part 1.4 Multiresolution Blending

In part 1.4, we are going to blend two images with multiresolution, creating a seamless join. We accomplish this by joining together the Laplacian stacks of the two images, and then reassembling the resulting Laplacian stack. We also use a Gaussian Filter on a mask to help create a nicer image.

Apple.


Orange.


Orapple!

Moon.

Sun.


Sun and Moon!


Charmander

Squirtle


Best Starters in Pokemon Gen 1!

Here is an example of a custom mask. The results are only mediocre because the original images aren’t well aligned.

Part 2.1 Toy Example

In this part we practice reconstructing an image just by matching one colors value, and then keeping the same gradients. These gradients are kept the same by minimizing the squared difference, i.e. running least squares.

Here is the original image.

Here is the image reconstructed from only looking at gradients.

Part 2.2 Poisson Blending

For part 2.2, we implement Poisson blending in order to create a smoother blend between two images. We create this blend by looking at the gradients, and trying to minimize the difference between the original and blended gradients. This is solved by finding the solutions to a linear least squares equation. We solve for the variable v in the following equation.

By including the gradient values for every pixel in our blended area, we can create a much smoother blend.

In this image, we attempt to blend an image of a rabbit onto the background of the moon. This is a reference to the ancient chinese folklore and in honor of the recently passed mid-autumn festival.

Here are our two original images:

Here is the source image directly cropped and pasted onto the target image

Here is the source image blended into the target image via Poisson blending. Notice the much nicer color transitions in the blended image.

Here is one with a chicken and a polar bear, the classic duo.

Here is the result:

This blend didn’t turn out very well, the colors of the chicken look too dark. I think this is a result of the background colors not being close enough, and thus shifting the color palette of the source image.


Here is an example where the resulting image doesn’t look very good at all. I think this is because the edge colors are too different, so the blending tries to make it as close as possible but its not close enough.

Here is the Squirtle and Charmander that we blended using Laplacian stacks. The results here are much worse than the Laplacian stacks because the colors aren’t supposed to match up. Poisson blending tries to get colors correct, but in this blend we didn’t actually want the same colors. If color alignment is not our priority, we want to use Laplacian over Poisson blending.