Hybrid Images by Sam Swarr (sswarr)

CS 143 Fall 2011

Creating Gaussian and Laplacian Pyramids

To construct the Gaussian pyramid for an image, I begin with the original image. This forms the base of the pyramid. I then apply a Gaussian blur filter and downsample, halving its size. The result is the next level of the pyramid. I repeat this process of blurring and downsampling until the desired number of levels have been generated for the pyramid.

By slightly modifying the Gaussian pyramid algorithm, I can produce the Laplacian pyramid simultaneously. After applying a Gaussian blur (but before downsampling) if I subtract the blurred image from the unblurred image, I get the corresponding level of the Laplacian pyramid. Since producing a level of the Laplacian pyramid is an intermediate step when producing the Gaussian pyramid, the Laplacian generally has one less level than its Gaussian counterpart. Below is a Gaussian and Laplacian pyramid for a lovely antelope:

antelope_pyramids

Note that all the levels of the pyramid have been scaled to the same size for ease of viewing. Also, the Laplacian images have been brightened to increase visibility.

Building the Hybrid Image

First, I will describe how to rebuild a regular image from its Gaussian and Laplacian pyramids. Starting with the smallest level of the Gaussian pyramid, upsample it to double its size. Then, add the corresponding level of the Laplacian. The result is identical to the next level of the Gaussian pyramid. By repeating this process using the previous result in the next level of upsampling, the pyramids are "collapsed" and the end result is the original image that the pyramids were constructed from to begin with. This means that given the smallest level of a Gaussian pyramid and the whole Laplacian pyramid, you can reconstruct the original.

I applied this same technique to create a hybrid image. The only difference was that the larger levels of the Laplacian pyramid were from one image and the smaller levels were from another. The image with the larger levels of the Laplacian will dominate the hybrid when viewed up close because the high frequencies are favored. The other image is more apparent when view from a distance because it has been low-pass filtered. In the case of the hybrid image, I use the smallest level of the low-pass filtered image's Gaussian as the starting point for collapsing since we want it to dominate the low frequencies.

Results

Is that a mountain lion? Nope, it's Chuck Testa.

mountain lion? nope, chuck testa

Here are the original images:

mountain lion chuck testa


Llama? Or giraffe?

llamaraffe

Here are the original images:

llama giraffe


Lama? Or Will Smith?

dalai will smith

Here are the original images:

lama will smith

Conclusion

The approach I used made the most sense to me, although I'm not sure if it is the best way to produce a hybrid image. I'm am slightly concerned because we have four pyramids amongst the two pictures, but I do not utilize the Gaussian pyramid for the high frequency image and only use the smallest level of the low frequency image's Gaussian. However, I'm happy with my results, and I can reproduce similar images to the examples.