Project 1: Hybrid Images

CS 129: Introduction to Computer Vision

Justin Ardini (jardini)

Overview

Hybrid images are static images that change in interpretation as a function of the viewing distance. The basic idea is that high frequency tends to dominate perception when it is available, but, at a distance, only the low frequency (smooth) part of a signal can be seen. By blending the high frequency portion of one image with the low-frequency portion of another, you can create a hybrid image that leads to different interpretations at different distances.


Algorithm

The algorithm for creating hybrid images involves two steps: creating Laplacian pyramids for two images then reconstructing a hybrid image by blending the two pyramids.

The first step is carried out by starting with a grayscale image I then looping the following three steps:

  1. Run a gaussian blur on I, save the result
  2. Subtract the blurred image from I to approximate a Laplacian filter, save the result
  3. Downsample I to half of its previous size

Every iteration of these three steps adds one more level to the Gaussian and Laplacian pyramids.

Original image


Gaussian pyramid (8 levels including original image)


Laplacian pyramid (7 levels)

The second step is to merge the lower N levels of the first image's Laplacian pyramid with the upper M levels of the other images Laplacian pyramid. Conceptually, this is adding a low-pass filtered version of the first image to a high-pass filtered version of the second image. I also add the last level of the Gaussian pyramid for the low-pass filtered image to the sum to include the remaining low frequencies from that image.


Results

For all results, I use a Gaussian blur with half-width=4, sigma=1.33 and use an eight-level Laplacian pyramid. My values of N (the number of levels from the low-pass filtered image) and M (the number of levels from the high-pass filtered image) are given with each result.

Most of the results below fit into the category of "morphing from one object to another". This category of hybrid images works very when the images are aligned and consist of high levels of detail. For example, the polar bear to puppy hybrid image works extremely well. The second-last result is a morph from a calm bear to a roaring bear. This category of hybrid image (a change of expression) is difficult to properly align, but can also be effective. The final image is shows the famous "tank man" in high frequencies, but he dissapears in low frequencies. This hybrid image does not work as well as the others since there are no interesting low frequency features in the location of the man.

You can resize the images by clicking and dragging.

M=3, N=5

M=4, N=5

M=3, N=6

M=3, N=5

M=4, N=5

M=3, N=5

M=2, N=6