Project 1: Image Filtering and Hybrid Images

Example of a hybrid image.

Algorithm description

Below is the matlab code I wrote for my_imfilter.

##example code
padding_height = idivide (int32(size(filter,1)),int32(2),'floor');
padding_width = idivide (int32(size(filter,2)),int32(2),'floor');
pad_image = padarray(image,[double(padding_height) double(padding_width)],'symmetric');
output_image = zeros(size(image));
filter_height = size(filter,1);
filter_width = size(filter,2);
for k=1:size(image,3)
    for i=1:size(image,1)
        for j=1:size(image,2)
            crop = pad_image(i:i+filter_height-1,j:j+filter_width-1,k);
            C = crop.*filter;
            output_image(i,j,k) = sum(C(:));
        end
    end
end
output = output_image;

Intermediate images

As we can see, when looking closely, the high frequency image (bike in this example) dominates the view. When viewing distance gets further away(or looking at a smaller scale), the low-frequency image becomes more perceivable.

On the other hand, the extra experiment of superman vs batman doesn't look as appealing. One reason might be that the alignment is not perfect. But I think the main reason is that amount of color in each image file is too small. Applying high-frequency filter on either image will leave only minimum outline image left, where the low-frequency image has very dominating yellow background. This is why the low-frequency image is always easier to identify from human perspective.