Project 1: Image Filtering and Hybrid Images

Image Filtering

For the image filtering portion of this project I was tasked with writing my_imfilter, a function that would apply any matrix filter to an image. I started by finding the index of the middle pixel of the filter. This value told me how much I would need to pad the image by to allow the filter to change every pixel without going out of index. I then used that information to perform a mirror image pad on the image. This ensured that the filter was recieving reasonable data, even in the edge cases. I then indexed through the pixels of the orgional image and matched them with the corresponding area of the padded image that would be used with the filter to create the new pixel values. Then for every color channel the new pixel color was computed by using the dot product of the filter and the corresponding area of the image row by row. Lastly, the new pixel was assembled and inserted into the location of the origional pixel in a blank image created at the beginning of the code.

Below are examples of filters ran through the my_imfilter I wrote.

Identity Image Blur Image Large Blur Image Sobel Image Laplacian Image High Pass Image

Hybrid Images

For the second portion of this project I created a hybrid image using two similar images and the my_imfilter referenced above. I started by creating a low frequency image by filtering the first image with a Gaussian blur. This created a blurred image. I then created a high frequency image from the second image by subtracting the low frequency version of the image (obtained by applying a Gaussion blur to the image). I then created a hybrid image by adding the low frequency version of the first image to the high frequency version of the second image. This resulted in an image that has the appearance of the low frequency (blurred) image at far distances and the appearance of the high frequency image at close distances.

Below are examples of images ran through the hybrid image creater I wrote.

Origional Image 1 Origional Image 2 Low Frequeny Image High Frequeny Image Hybrid Image Image Size Step-down