Project 1: Image Filtering and Hybrid Images

The filtering algorithm I used was a reflection-based padding algorithm. I first determined the size of the padding by dividing the filter dimensions in half, and I zero-padded the original image along all of the sides. I then reflected the image over the padding adjacent to each of the four sides, while leaving the unreflected corners as zeroes. I then applied the filter to the padded image by replacing the original image values with their scalar dot products with the filter.

To test the algorithm, I used a motorcycle as the original image.

Gaussian-blurred motorcycle

Original motorcycle

Edge filters

The main two edge filters tested were Sobel filters and Laplacian filters. Their corresponding filter matrices are found below. The Sobel filter is more responsive to horizontal edges, whereas the Laplacian filter looks for pixel-by-pixel edges across the vertical and horizontal. In the images below, we can see that the laplacian filetered image has much thinner lines compared to the Sobel filter.


sobel_filter = [-1 0 1; -2 0 2; -1 0 1];

laplacian_filter = [0 1 0; 1 -4 1; 0 1 0];

Laplacian filtered motorcycle

Sobel filtered motorcycle

Hybrid Images

The hybrid images were created by adding the low frequencies of one image with the high frequencies of another. The high frequencies are most visible at closer proximity to the image, but as we move farther away from the image, the high frequencies start to disappear, leaving only the low frequencies within view. For my test, I combined the high frequencies of an image of a plane with the low frequencies of an image of a bird to create a hybrid bird-plane image.

The plane is most visible at closer proximity, but as the view of the image decreases, the plane becomes less visible, leaving just the bird in the image.

More examples are shown below.

Marilyn Monroe to Albert Einstein

Fish to submarine

Bicycle to motorcycle

Cat to dog