Computer Science 194-26: Image Manipulation and Computational Photography

Project 3: Fun with Frequencies and Gradients!

Ari Pickar

Part 1.1:

In the first part of this project, I were exploring what happens when you play around with the frequencies of an image. To create a hybrid image, I took an image, convolved it with a guassian kernel, and then added the difference between the original image and the convolved image (multiplied by a constant, in this case 7) back to the original.

Original Image:

Sharpened Image:

1.2 Hybrid Images:

For this part, I combined two images in a way that would mix the features from one and apply them to the other image. I did this by applying a low pass filter two one image, meaning that only the low frequencies of one of the images would show. I then applied a high pass filter with a different cutoff to the other image, meaning that there would be no frequencies present in between the frequencies. By combining these images, I could then get one composite image that differs in appearance when viewed close up (and seeing the frequencies from the high pass filter) than when viewed from far away, where you can only see the low frequency images.

Example Image

Derek:

Nutmeg:

Combined:

Combined 2:

Combined 2 frequency plot:

Combined 3:

Combined 3 frequency plot:

Failure :

  • The main reason for failure was that this image didnt have correct parameters for the sigma values, making the backround image off.

1.3 Gaussian and Laplacian Stacks:

For this part, I looked at the differences between images. If you take an image, and apply gaussian kernels with successively larger (by a factor of 2) sigma values, you can see what features are included when you limit the image by a different amount. The list of these images is the Gaussian stack. If you take the difference between every two sets of images, you get the Laplacian stack. If you sum all of the values in the laplacian stack with the last image in the Gaussian stack, you will get the original image.

Gaussian stack:

  • .25
  • .5
  • 1.0
  • 2.0
  • 4.0
  • 8.0
  • 16.0

Laplacian stack:

  • .25
  • .5
  • 1.0
  • 2.0
  • 4.0
  • 8.0

1.4 Multiresolution Blending:

In this part, I blended two images by feathering each element of the gaussian stacks of the two images. This technique was used to minimize the starkness of the seam between the two images, and therefore make the translation more seamless.

Poisson blending

For the second half of the project, I implemented Poisson blending as a way to combine two images. To do this, I had to try and minimize the difference between the images on the borders, ensuring that when you place what you are adding in to the other image, there is a minimal border between images. I can do this by solving the least squares problem:

To solve this, I have to find a vector v, that when it is inside the image matches the original superimposed image, but when on the border matches the border as close as possible. I did this by populating a sparse matrix with the locations of each pixel.

2.1 Toy problem

For this part, I implemented a special case of poisson blending, where there was only 1 image, and I wanted to recreate the image from just one pixel value and the differences between the pixel values.
Source Reconstructed

2.2 Image blending

For this, I had to generalize our implementation of the toy problem for larger images and masks that were irregular. I did this by populating a sparse matrix with the locations of each pixel. It was definitely much more effective at combining the images than the Multichannel blending, which for this image did not seem to blend the image at all.

Combining two animals

Source Target Directly Overlaid
Mask Final Image Attempted Multiresolution blending
Putting oski in "The Creation of Adam"
Source Target
Mask Final Image
Putting a penguin in the sky
Source Target
Mask Final Image
Failures:
For these images, they failed mainly for the same reason. Whereas the image was supposed to be added in, the mask was drawn too close to the outline of what was supposed to be added in. Therefore, I learned to add a buffer area around the image to correctly add it in.
Fail 1 Fail 2 Fail 3
Comparison
This was another example of a comparison between Multiresolution Blending and Poisson Blending. I think that this is a bit better of an example, as the image is much more in line with the color scheme of the target image, whereas the other multiresolution blending image is lighter, leadign to it looking out of place.
Multiresolution Blending Poisson Blending