CS 143 / Project 1 / Image Filtering and Hybrid Images

Overview

The goal of this project is to implement an image filtering function my_imfilter and create hybrid images.

Algorithm

The idea of hybrid images is to merge the low-pass version of one image with the high-pass version of another image. The first step is to implement the image filtering function my_imfilter:

  1. Pad the image with 0's using MATLAB function padarray()
  2. Convert each sliding M-by-N (filter's size) block of the image to an array using MATLAB function im2col
  3. Apply the filter (element-wise multiple) to each M-by-N block and calculate the sum as the result of the centroid.

The we can generate a hybrid image by three steps as below:

  1. Generate a Gaussian filter using fspecial(), and apply on one image to generate a low frequency version.
  2. Remove the low frequencies from the other image by subtracting a burred version for the original one.
  3. Merge the low and high frequencies to generate the hybrid image.

Results

Filter Results

Six filtering examples: identity, blur, large blur, high pass, laplacian and sobel:


Hybrid Images