Hybrid image of Derek and his cat, Nutmeg
This project is comprised of two parts: create a matlab function which works the same as imfilter, which filters images, using the algorithm introduced in the 2006 SIGGRAPH paper by Oliva, Torralba, and Schyns, and generate hybrid images based on one's own filtering function.
Algorithm
To apply Gaussian filter, image has to have an appropriate pad around it in order not to lose any boundary pixels after applying to filter. After setting up pad around the original image, take dot product to each block which has exactly the same size with filter. Laplacian filter is (original image - Gaussian filter applied image).
Result
As an image gets applied Gaussian filter, it loses distinct outlines and focuses more on colors, while an image with Laplacian filter focuses more outlines losing color information. When people see an object in close distance, they focuses more on its detailed shape becuase they can see the clear contour. However, with far distance, people cannot distinguish all the contours but try to find an object's outline with its color change. Thus, in hybrid image, high frequency image (which has clearer outline) is easily recognizeable with short distance while low frequency image (which has more color information) is easily recognizeable with far distance.
%example code (filtering function)
for j = 1:size(image, 3)
makeframe=padarray(image(:,:,j), [width, height], 'replicate');
for i=1:size(image,1)*size(image,2)
filtered(i)=sum(filtocol.*imtocol(:,i));
end
output(:,:,j)=reshape(filtered, size(image,1), []);
end
Result Table - given images
![]() ![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() |
Result Table - new images
![]() ![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() |
Gaussian Pyramid and Laplacian Pyramid
While working on above project, I became wondering the progress of losing contour and getting clearer contour. Thus I tried to construct Gaussian Pyramid by applying Gaussian filter several times and Laplacian Pyramid by deducting Gaussian filter applied images from the original image. The results are below.
![]() |
![]() |
As I applied more and more times of Gaussian filter, the outline became weak and I could not recognize it as a cat. When I applied Laplacian filter once (image - one-time-Gaussian-filter-applied-image), I could not say it was a cat. However, it got its clear contour as I applied several times of Laplacian filter.