This is a class project for CSCI 4527/6527 Computer Vision at George Washington University.
Here is the code.
1. Overview
In this project, we explore hybrid images, which is high-frequency of one overlaid on the low-frequency of another images. 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 the signal can be seen. By blending the high-frequency portion of one image with the low-frequency portion of another, you get a hybrid image that leads to different interpretations at different distances. We used the approach described in the SIGGRAPH 2006 paper by Oliva, Torralba, and Schyns.
2. How It Works
Before constructing the hybrid, we first align the images together. Then, we convolve the two images with custom-tuned Gaussian filters. Every pair of images may require different parameters. We calculate the Laplacian of the second image by subtracting the Gaussian-filtered image from the original. The hybrid image is constructed by averaging the first's Gaussian-filtered image with the second's Laplacian image.
The main parameter to tune is the cutoff frequency \sigma_{f}: In order to extract the low frequencies in an image, we convolve the input image with a Gaussian function, which effectively serves as a low-pass filter. Likewise, we extract the high frequencies from an image using a Laplace filter, which I obtained by taking the difference of the input image and the input convolved with a Gaussian.
2.1 Procedure
Align the images. The framework code provided a utility method which would rotate, rescale, and align two images based on two points, typically points of focus to anchor the images.
Apply low-pass filter. Convolve the first input image with a Gaussian filter with sigma chosen based on the desired cutoff frequency as explained above.
Apply high-pass filter. Convolve the second input image with a Laplacian filter with sigma chosen based on the desired cutoff frequency.
Add the results together. This takes the two images and combines them into a single image with the different frequencies.
DerekCat:
image1 = DerekPicture.jpg, image2 = nutmeg.jpg,
sigma1 = 12, sigma2 = 12
Original
Filtered
Hybrid
3. Favorite Result With Analysis
Here is my favorite result where I combined earth with a basketball. You should see basketball looking at close distance and earth when looking from a far distance. I found that sigma = 2 for earth picture and sigma = 12 for basketball picture works the best. Here is the result:
Earth and basketball original images, and their filtered versions, and the hybrid images along with their FFT:
4. Bells and Whistles
I tried few images with black and white, but I don't feel it produces a satisfactory hybrid image. The reason might be as both input images are blurred, having colors helps visualization. Then I try using color to enhance the effect:
Tutankhamun+Zeus: Combine a low-pass-filtered Tutankhamun with a high-pass-filtered Zeus.