CS 143 / Project 1: Hybrid Images / Andrew Ayer <andrew>

Algorithm

The algorithm is simple, and implemented as described in the project handout.

Step 1: Image Pyramids

First, calculate N levels of the Gaussian and LaPlacian pyramids for each image. Starting with the initial image, apply a Gaussian filter. Save the result as the ith level of the Gaussian pyramid. Next, subtract the result from the initial image, and save the difference as the ith level of the LaPlacian pyramid. Finally, subsample the image by one-half. Repeat N times, and on successive iterations apply the process to the previously subsampled image.

Rather than use Matlab's imresize, I chose to implement my own subsampling by taking every other pixel in the image. I made this choice because imresize may do its own interpolation that could have unintended effects on the process. Taking every other pixel is all that is needed anyways.

Step 2: Construct Hybrid Image

Using the image pyramids for each image, reconstruct each image by doing step 1 in reverse. In general, start with the lowest level of the Gaussian pyramid, add the lowest level of the LaPlacian pyramid, upsample by two times, blur with the Gaussian filter, and repeat N times. On successive iterations, add the ith LaPlacian pyramid to the resulting image from the previous iteration. However, for image one, start with an empty image instead of the Gaussian pyramid, and only add in the bottom C levels of the LaPlacian pyramid. For image two, start with the bottom Gaussian image, but only add in the top C levels of the LaPlacian pyramid.

Finally, sum together the two reconstructed images to produce the hybrid image.

Results

For the most part, the algorithm works. By taking separate parts of the LaPlacian pyramids, we get the low frequency parts of image one, and the high frequency parts of image two. Since high frequency dominates human perception close up, image two is more prominent up close and fades away when you step back.

The one shortcoming of the algorithm is that it seems to blur the images quite a bit and give them a "ghost"-like appearance. The images from the paper are much nicer-looking in comparison.

I tried extensive tweaking of the parameters (number of pyramid levels, cut-off level), but 8 levels with a cut-off around 3 proved the best in most cases.

Ballmer's Tongue

Up close, Steve is frowning. Step back, and he sticks his tongue out at you. Source images: One Two

Number of pyramid levels: 8; Cut off: 3

Time Lapse: Oakland-San Francisco Bay Bridge S Curve Construction

Up close, the Bay Bridge follows its original route. Step back, and traffic has been routed onto the S Curve. Source images: One Two

Number of pyramid levels: 8; Cut off: 2

Tower-Tree

Up close, it's the Eiffel Tower. Step back, and it's replaced by a potted pine tree. Source images: One Two

Number of pyramid levels: 7; Cut off: 3

The Eiffel Tower, having many high-frequency sharp edges, disappears quite nicely far away. Unfortunately, the tree is fairly visible at all distances. This was a rare case where having one fewer pyramid level made a noticeable difference.

Derek-Cat

Up close, Derek likes to say "meow." Step back, and he looks normal. Source images: One Two

Like the Eiffel Tower, the cat has a lot of high-frequency sharp edges, so it disappears quite nicely at a distance. Like the tree above, Derek is visible close up, though that provides a nice effect for this image.

Number of pyramid levels: 8; Cut off: 3

Marilyn Einstein

Source images: One Two

Number of pyramid levels: 8; Cut off: 3

These images provided the best result by far.

Cat Dog

Source images: One Two

Number of pyramid levels: 8; Cut off: 3