CS 143: Hybrid Images
The goal of this project was to create hybrid images using a modification of the algorithm in the paper Hybrid Images, by Oliva, Torralba, and Schyns. A hybrid image actually contains two images, one that appears when the viewer is close and another that appears when the viewer is far away. The human visual system mostly uses high-frequency visual information for recognition. However, high-frequencies are only visible when the viewer is close to the image. Hybrid images combine the high-frequency components of one image with the low-frequency components of another image to get an image which is perceived differently at different distances.
Algorithm
A hybrid image is created by building two Gaussian and Laplacian pyramids (one for each input image), creating a merged pyramid using the top of one and the bottom of the other, and reconstructing the hybrid image from the merged pyramid. A Gaussian and Laplacian pyramid is a multi-scale representation of an image that separates components of the image by frequency.
An example Gaussian and Laplacian pyramid
Gaussian pyramids are usually generated by repeatedly downscaling the original image by a factor of 2 with a small constant-radius Gaussian blur before each downscale. However, for this assignment it made more sense to just blur the original image using a Gaussian blur with a radius that doubled after each pyramid level. This is essentially equivalent but is easier to work with since the images are all the same size (otherwise the images would need to be upscaled during reconstruction).
The Laplacian pyramid was created by taking the difference of successive Gaussian pyramid levels. Levels from the Laplacian pyramid are visualized in the image above by adding 0.5, so light grey colors are positive values and dark gray colors are negative values. Each level from the Laplacian pyramid is a band-pass filter, which extracts components of the image from a narrow frequency range.
The hybrid pyramid was created by choosing a cutoff level in both pyramids, and then using everything before the cutoff from the first pyramid and everything after the cutoff from the second pyramid. To reconstruct the hybrid image from the hybrid pyramid, I summed all levels in the Laplacian pyramid with the most blurry image in the Gaussian pyramid.
Two source images and the resulting hybrid image
Results
![]() The close image |
![]() The far image |
![]() The hybrid image |
![]() The close image |
![]() The far image |
![]() The hybrid image |
![]() The close image |
![]() The far image |
![]() The hybrid image |
![]() The close image |
![]() The far image |
![]() The hybrid image |
![]() The close image |
![]() The far image |
![]() The hybrid image |
![]() The close image |
![]() The far image |
![]() The hybrid image |
![]() The close image |
![]() The far image |
![]() The hybrid image |