CS 143 / Project 1 / Image Filtering and Hybrid Images
Outcome. A typical hybrid image.
Overview
The goal of this project is to use image filtering to make hybrid images. It's based on a 2006 SIGGRAPH paper by Oliva, Torralba, and Schyns. Hybrid images are interesting because one's perception of the objects in the images tends to change when he/she views this image from different distances. Specifically, the process of making this kind of hybrid images are: first filter two images into high and low frequencies respectively, and then concatenate them together to form the hybrid image. This project is coded in Matlab.
Algorithm Go-through
The Specific Process of Making Hybrid Images (Go-through of the Algorithm):
- Extract three different color channels(aka R,G,B)from the original image in order to filter them respectively.
- Pad the array according to the size of the filter, so that edge cases and array bounds are properly handled.
- Use for loop to go through each pixel in the image to apply the filter.
- Concatenate the three color channels together.
- Filter one image to low frequencies and the other to high frequencies and put them together to make the hybrid image.
Design Advantage
- The filtering algorithm is designed so that it could handle filters of any size/dimension. And the edge cases and array bounds are also properly handled to accommodate filters of different dimensions.
- When padding the array to handle the edge cases, the array is padded with mirror reflection to itself. This makes the edges smoother when the image is filtered and makes the image look like the original one as much as possible.
Filtering
Here are some of the results when different filters are applied.
From left to right are:
Cat image with identity filter, small blur filter, large blur filter, oriented filter, high pass filter and high pass alternative filter
Immediate Step to Hybrid Images
Filter one image to high frequencies and the other one to low frequencies.
Here are some pairs of high and low frequencies.
Final Result of the Hybrid Image
The final result of the hybrid image simply combine the high frequencies from one image and low frequencies from another image. The followings are some examples.
Extra Notes
The above hybrid images use the default cutoff frequency of 7. But tuning the cutoff frequency could render different result. For example, in the next example, the first set of images is generated with the cutoff frequency of 7, and the next set of images is generated with cutoff frequency 15 for low frequency and cut off frequency 0 for high frequency. In this case, the motorcycle image is more blurred with the altered cutoff frequency
The hybrid image is sometimes completely different if we switch the image for high frequency and the image for low frequency. Thus the choice for high frequency and low frequency is important. The following is an example.