Project 1: Image Filtering and Hybrid Images

Image Filtering

In the algorithm, I implemented the filtering for a channel. If the input image is colored, the algorithm will take the seperated R, G, and B channels and filter each channel, and at the end of the algorithm the three seperated channels are merged back into a single image. In the filtering algorithm, it first determines the size of the filter. Then the algorithm pads the original image matrix. With floor(filterHeight/2) at the bottom and top, floor(filterWidth/2) on left and right. Then the algorithm loops through the original pixels in the padded image matrix. Then the convolution is carried out in the code below.


%convolution
	temp = channel_temp(j-floor(filter_h/2):j+floor(filter_h/2),
						k-floor(filter_w/2):k+floor(filter_w/2)).*filter;
	output(j,k) = sum(temp(:));

Image Filtering Results

Identity Blur Gaussian Blur Sobel Laplacian High Pass filter

Hybrid Image

First the algorithm applies a Gaussian blur filter to both of the images, then it takes one of the input images and subtract the blurred image from its orginal to obtain its high pass filtered image. Then simply add the high and low frequency images to obtain the hybrid image.

Hybrid Image Results