CS 143 / Project 1 / Image Filtering and Hybrid Images

Purpose

For this assignment, we were asked to write an image filtering function similar to Matlab's built-in imfilter() function. Using our image filtering function, we could then build hybrid images using a simplified approach of the SIGGRAPH 2006 paper by Oliva, Torralba and Schyns.


Approach

Design
In my initial naive approach, I used four for loops which was far from optimal and seemed to take eons in order to execute. After re-reading the handout and using the Matlab help function, I realized that my four for loops could be accomplished in one for loop utilizing the im2col(), transpose() and reshape() functions.

Hybrid Images
Given two input images, we produce a low-pass/blurred version from one input image and a high-pass version of the other. To produce the high-pass version, we merely produce a low-pass of the image and subtract it from the original image. Once we have the low-pass and high-pass images, we can create the hybrid image by taking the sum of the two.


Results

Image Selection
The hybrid image at the top of the page is the result of poorly selecting candidate images. The dimensions of President Obama's face in the low-pass image is quite different from the high-pass image. Additionally, the angle of his body along with the dominating colors of the American flag and oval can also be seen in the hybrid image.

The five pairs of images provided produced much better results since they are aligned with each other. By changing the "cutoff-frequency", I was able to control the results of the low-pass and high-pass images. This allowed some of the images to blend in well and produce decent hybrid images.

Image Filtering
Box FilterLarge BlurSobel OperatorDiscrete Laplacian
Hybrid Images
Image 1Low-passImage 2High-passHybrid ImageHybrid Image Scales