CS 143 / Project 1 / Image Filtering and Hybrid Images

Example of a hybrid image. Step back from your computer screen to see the dog.

My first encounter with the hybrid image technique was a while back when I saw the Einstein/Monroe image by Aude Olivia published in Wired Magazine. Since then I was mesmerized by this great trick and yet again after learning how simple is the algorithm. Creating hybrid images consists of three parts:

  1. Removing high frequencies from Image 1.
  2. Removing low frequencies from Image 2.
  3. Merging results from step 1 and 2.

The success of the algorithm consists mainly by the alignment of visual forms in the images and the manipulating filter thresholds.

Algorithm Results

Image 1 (low frequency) and Image 2 (high frequency)

Hybrid image at various sample sizes. As the image shrinks high frequencies are removed revealing the low frequencies.

For image compositing piecewise addition is not recommended as provided by the stencil, instead using a blend function provided better results as seen below.

Useful Matlab Functions

Since the assignment was meant as an introduction to Matlab, I was able to find some useful functions and utilities along the way. Here are some that I found useful for this assignment.

%padding an image
padarray(image, [pad_row pad_col], padding_mode);

%piecewise multiplication
A .* B

%size 
%   returns a vector with size with each element representing the size of the dimension
size(A)

%sum
%   caveat: won't return single value for mutliple dimensional array (wrap sum according to dimensions)
sum(A) 

%functions to explore
gpuArray()

Filter Test Results

Identity, Small Blur, Large Blur, Sobel Filter, Laplacian, High Pass.