Project 1 entails two tasks, one which requires implementing our own version of Matlab's imfilter and hybridization of images.
For the sake of optimization, I used as many matlab functions as I could as opposed to implementing my own versions of its functions
%Apply the same logic for all color channels%
extractedImage = image(:,:,color);
paddedImage = padarray(extractedImage, padSize, 'symmetric');
% No padding for the (m*n)-by-((mm-m+1)*(nn-n+1)) block. Basically gets all the neighborhoods%
neighborhoods = im2col(paddedImage, size(filter), 'sliding');
%Doing regular matrix multiplication instead of element-wise multiplication%
%since we have 1*filtersize x filtersize*neighborhoods%
filteredBlock = reshape(filterVector * neighborhoods, size(image, 1), size(image, 2));
To construct the hybrid images I first created the low spatial frequencies matrix by convolving image1 with my filter
then created the high frequencies matrix by subtracting my_imfilter(image2, filter)
from image2.
Afterwards, I added the low frequencies and high frequencies to obtain the hybrid image. For each image pair,
I tried different cutoff frequencies to achieve the best results
Low Frequencies | High Frequencies | Hybrid Image | Scaled Hybrid Images | Cutoff Frequency |
---|---|---|---|---|
7 | ||||
7 | ||||
3 | ||||
5 | ||||
6 | ||||
6 |
Low Frequencies | High Frequencies | Hybrid Image | Scaled Hybrid Images | Cutoff Frequency |
---|---|---|---|---|
9 |