Project 1: Image Filtering and Hybrid Images

Example of a hybrid image pair shown over multiple magnifications.

This project is implemented in two segments:

  1. Image Filtering using my_imfilter.m
  2. Hybrid Image using proj1.m

Image Filtering.

Image filtering (or convolution) is a fundamental image processing tool. Here, we implement a my_imfilter() function that satisfies the following constraints: (1) supports grayscale and colored images (2) support arbitrary shaped odd dimensional filters (3) Padding the input image with reflected data (4) return a filtered image with same resolution as input image

Hybrid Images.

A hybrid image is the sum of a low-pass filtered version of the one image and a high-pass filtered version of a second image. There is a free parameter, which can be tuned for each image pair, which controls how much high frequency to remove from the second image and how much low frequency to leave in the first image. This is called the "cutoff-frequency". Here, we use standard deviation of the Gaussian bluring filter in constructing the hybrid images. In the SIGGRAPH paper it is recommended to use two cutoff frequencies (one tuned for each image)

Example of code to implement hybrid images

image1 = im2single(imread('../data/dog.bmp'));
image2 = im2single(imread('../data/cat.bmp'));
filter = fspecial('Gaussian', cutoff_frequency*4+1, cutoff_frequency);
low_frequencies = my_imfilter(image1, filter);
high_frequencies = image2 - my_imfilter(image2, filter);
hybrid_image = low_frequencies + high_frequencies;

Results in a Table

Example 1: Hybrid image of DOG and CAT. Shows the original images along with hybrid image.
Example 2: Hybrid image of CYCLE and BIKE. Shows the low frequency and high frequency respective images along with hybrid image
Example 2: Hybrid image of Hillary Clinton and Donald Trump. Here slightly mis-alligned images produce a diminished yet characteristic hybrid image effect

Takeaways: Interesting introduction to image filtering and perspective viewing of images.