Project 3: Image Blending

Jacob Holesinger, cs194-agj

Part 1.1

Warmup:

To get our hands dirty, the very first task of this project was image sharpening. The basic idea goes like this: the sharp parts of our image correspond to the high frequencies. It then follows that a quick way to separate them out of the image is to subtract away all of the lower frequencies. Any low pass filter such as a guassian, will give us an image containing only lower frequencies. So to find our high frequencies, all we have to do is subtract a low pass filtered version of our image from the original. We can then boost our oringal image's high frequency content by adding the result back in giving the sharpening effect we were after.


A Startled Cat
A sharper Startled Cat
Alcove floor in NM
Sharpened Result

Part 1.2

Hybrid Images:

Taking the ideas from image sharpening we now apply them to multiple images simultaneously. In the following hybrid images, the high frequency information and low frequency information have been pulled from two separate images and combined in the same frame.

The bottom left cat blend didn't work out the best because of artifacts in the image background. I did like the eyes though. To visualize this explicitly with the tree example, below are the frequency domain representations of the orignal images, their filtered versions and the composite.


Summer Tree Original Frequency Domain
Winter Tree Original Frequency Domain
Low Pass Filtered Winter Tree
High Pass Filtered Summer Tree
Hybrid Frequency Domain

Part 1.3

Laplacian and Gaussian Stacks

Laplacian and Gaussian stacks are convenient ways of breaking up the frequency content of images into digestible parts. The Gaussian stack is the simpler of the two, consisting of successivly blurrier images. As you move towards the other end of the stack, the range of frequencies you see shrinks closer into the low end of the spectrum. The Laplacian stack represents a band of the frequencies at each level. It is formed by taking the difference between Gaussian stack levels at each of its own levels resulting in the band of frequency that was lost going to the next level of the Gaussian stack. Below are a Laplacian and then Gaussian stack for some images with interesting frequency content as well as one of the hybrid images from part 1.2. Each of these examples is interesting because the character of the image seems to change depending on which part of its frequencies you view.

Part 1.4

One application of Gaussian and Laplacian stacks is multiresolution blending. This way of splicing together images takes advantage of the fact that we can get away with blending and overlaying low frequencies much more than we can with high frequencies. Here we go through each level of our Laplcaian pyramids and feather two images together with a region of interpolation that grows larger farther down the pyramid.


Part 2.1

Toy Problem:

The idea in this part was to demonstrate the ability to reconstruct an image based off the differences in its gradients. We showed that using only a single corner pixel value to get the correct constant of integration, we could minimize the differences in gradient to solve for the pixel values that would give the original image. Below are the before and afters of the image.

Part 2.2

Poisson Blending

Poisson Blending is a very different technique from the ones listed so far. Instead of combining images using their frequency content and feathering, it focusses on copying pixels in a way that trys to remain faithful to the gradients of the original image. The motivation is that if the changes in the image are correct, the colors and appearance of the content isn't as important and can be warped to make a better blend. Formally, this is set up as a system of equations with pixel values as free variables trying to minimize the differences between the original source's gradients and the gradients along the edge of between source and target. Minimizing both simultaneously allows the optimization to keep the original look of the source while making a smooth transition into the target image. Below is an example of the technique.


Source
Target
Source Pixels Pasted
Final Result

I would call the cow hair picture a failure because there is still a hard dark edge against the cow's body and the hair's source background has a hard time blending into the target background. In this case I think the problems are the fact that the target background varies a lot along the edge of the mask and that the hair has a complicated sillouette.

Below is a comparison between Poisson Blending and the Multiresolution blending from before.


Source
Target
Multiresolution Blending
Final Result

For these two images, multiresolution blending seems to do a better job because the details in the kiwi's face and the values in it's legs are still crisp. Poisson Blending has the nice effect of making the kiwi's hair match the fruit in color at the edge. However, the changes to the rest of the kiwi become obscured. In this case the white background and aligned shapes make it so that you don't notice the seam from multiresolution blending. If the two images had a more varryed setting, I think Poisson Blending would have done a better job of combining them. Overall, Multiresolution Blending works well when splicing two objects in the same setting and Poisson Blending is better for more jurastic differences between the images.