In this project, I applied linear filtering to sample pairs of images and combined them to produce hybrid images. The linear filtering was performed by first padding the original image with a mirror of itself just enough to make the output image be the same dimensions as the original. Next, for each color channel, I apply the filter to sections of the padded image at a time, and take the dot product of both the matrices, and sum up all the values. This eventually constitutes the resultant image.
The hybrid image was created by applying the Gaussian filter to each image in a pair, making one low frequency and one high frequency (by subtracting a blurred image from it) and combining them.
The formula used in the application of convolution is as follows:
Filtering logic:
for color=1:channels
for i= 1: height
for j= 1: width
output(i, j, color) = sum(sum(paddedImage(i:i+filterHeight-1, j:j+filterWidth-1, color) .* filter));
end
end
end
Results of the filters applied to cat.bmp :
The cutoff frequency while applying the Gaussian filter was adjusted for all of the following cases to reach the best hybrid image for both of them.