CS 143 / Project 1 / Image Filtering and Hybrid Images

My algorithm takes an image and a filter, determines whether the filter is a valid size(i.e. whether it has an obvious center), and then runs the following steps:

  1. Find the size of the padding necessary to account for the filter.
  2. Create a temporary, larger matrix of the correct size and insert the image.
  3. Iterate through dimensions, using .* and sum to calculate the convolution of the subsection of the matrix and the filter, and store the data in the correct location in a result matrix.
  4. Return the result.

To put the images together, I removed the high frequencies from the first image by blurring with a Gaussian filter, and removed the low frequencies from the second by subtracting a blurred image from the original. I then added these two images together. As an aside, my code does not ensure that the two images given are the same dimensions - however, since either chopping the image or resizing it might detract from the effect or make the result uncentered, I felt that it wasn't unreasonable to expect that the user puts together matching pairs of equivalent resolutions.

Results:

I think that the cat and dog combination works quite well. However, in the submarine/fish combination, I felt that the vibrance of colors remaining in the fish image made it more difficult to see the high frequencies of the sub.