In this project, I'll be implementing MATLAB functions for image filtering and creating hybrid images using a simplified versiion of the SIGGRAPH 2006 paperby Oliva, Torralba, and Schyns.
Option | Description |
'X' | Outside the bounds of the image are implicitly assumed to have the zero value. When no boundary option is specified, my_imfilter uses this option. |
'symmetric' | Outside the bounds of the image are computed by mirror-reflecting the image across the image border |
test_image = im2single(imread('../data/cat.bmp'));
test_image = imresize(test_image, 0.7, 'bilinear'); %resizing to speed up testing
sobel_filter = [-1 0 1; -2 0 2; -1 0 1];
sobel_image = my_imfilter(test_image, sobel_filter);
![]() |
![]() |
|
Small blur with a box filter | Identity filter | |
![]() |
![]() |
|
Large Blur | Laplacian filter |
filter = fspecial('Gaussian', cutoff_frequency*4+1, cutoff_frequency);
low_frequencies = my_imfilter(image1,filter);
high_frequencies = image2 - my_imfilter(image2,filter);
hybrid_image = low_frequencies + high_frequencies;
By altering cutoff frequency, we can manually choose the one that produce best performance.
We write proj1.m as a function which takes the imname_1 and imname_2 as the name of the images that will be filtered with low-pass and high-pass filter respectively, and cutoff_frequency. We included the codes/results below.
proj1('dog.bmp', 'cat.bmp', 7);
proj1('marilyn.bmp', 'einstein.bmp',3);
proj1('motorcycle.bmp', 'bicycle.bmp',4);
proj1('bird.bmp', 'plane.bmp',3);
proj1('fish.bmp', 'submarine.bmp',4.5);
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |