Project 1: Image Filtering and Hybrid Images

This project aims at implementing the built-in function imfilter(A, h) of MATLAB. To do this, I first extracted three color channels from the original image: red, green and blue. Then, for each of them, I performed convolution to get the filtered output. Eventually, I catenated three channels to get the final result. A brief summary of my workflow is listed as below.

  1. Extract red, green and blue channel;
  2. Filter each layer;
  3. Catenate three layers to get the final output.

To implement the convolution function in a 2-D spatial domain, I first padded the input image with zeros to handle boundary issue. Then I looped through each pixel of the input image and computed its value after convolution. Lastly, I removed the padded elements from output.

Contruct hybrid image

To contruct a hybrid image using the my_imfilter() function, I created a "low_frequencies" and a "high_frequencies" image respectively, and combined them together.


% construct hybrid image
low_frequencies = my_imfilter(image1, filter);
high_frequencies = image2 - my_imfilter(image2, filter);
hybrid_image = low_frequencies + high_frequencies;

Results in a table