Hybrid Images using Image Pyramids

Implemented by Andrew Scheff (ajscheff) for CSCI1431, Fall 2011

"If you see in your wine the reflection of a person not in your range of vision, don't drink it."
                                                 -Chinese Proverb

In this assignment, we were given the task of building hybrid images using an image pyramid technique similar to the one described in Oliva, Torralba, and Schyns paper here. The technique essentially works as follows: remove all high frequencies in image A by blurring, remove all low frequencies in image B by subtracting a blurred version from the original image. Composite the two images to get the hybrid image result. The hybrid image will look like image B from up close, where the viewer can easily recognize the high frequencies. From far away, where only the low frequencies are visible, the hybrid image will look like image A. Below are two examples of hybrid images I produced. The first a hybrid of celebrity heiress Paris Hilton and McDonald's classic mascot Ronald McDonald. The second a hybrid of drawn portraits of two 19th century American presidents, Ulysses Grant and James Garfield.

The Algorithm

In order to represent many different frequencies in the input image and selectively choose which frequencies we want to include in our composite, we build image pyramids for each input. For each input, we build a Gaussian pyramid which represents a range of low frequencies in the input image, and a laplacian pyramid which represents a range of high frequencies. Image pyramids are essentially sequences of a repeated image at different scales. In the Gaussian pyramid, the images capture lower and lower frequencies as they get smaller. In the laplacian pyramid, the images represent higher and higher frequencies as the images get larger. Pseudocode for creating image pyramids of height N is given below:

pyramids(image, N):

Once the image pyramids described above are created for both input images, a cutoff parameter c that is between 1 and N is selected. This cutoff determines which of the low frequency versions of image A will be used as a cutoff and which high frequency versions of image B will be added in. Specifically, we take the cth largest low frequency image, and then successively add on and scale up the high frequency images (that came from the other input image) above it. This gives us all frequencies at and below a certain frequency from image A, and all the frequencies above that frequency from image B. Pseudocode for the hybrid image compositing algorithm I used is given below:

hybrid(gaussianA, laplacianB, c):

More Results

Varying the cutoff parameter used for the same hybrid image is useful in observing the behavior of the algorithm. Below are 3 different hybrid images of the left and right faces (part of street artist JR's "Face2Face" project: face2faceproject.com) at the top of this document. Notice how the high frequency image becomes more and more prominent as we increase the cutoff parameter, taking a lower frequency as the base image and compositing with more of the high frequency images.

Another interesting, and somewhat experimental, result I found was by taking the hybrid image of two hybrid images. I joked with a classmate: "Here's an image that when viewed up close is a hybrid image of Einstein and Marilyn Monroe, but when viewed from far away is a hybrid image of Derek and Nutmeg the cat." I quickly realized that the result could not possibly be what I described. When viewed from up close, the Einstein-Marilyn hybrid will look just like Einstein; from far away, the Derek-Nutmeg image will look just like Derek. Thus, what I actually ended up with was an Einstein-Derek hybrid with little to no trace of Marilyn or Nutmeg! Check it out below: