Hybird image of a cat and a dog.
In this project, I have wrote my image filtering function and have used it to create hybrid images. Hybrid images are generated by superimposing two images at two different spatial scales. High frequencies dominate the near view perception but only the low frequency part of the image can be seen from distance.
My filter's implementation imitates the default behaviour of imfilter() in matlab. Following are the features supported:
% code for filter function
n_dim = ndims(image);
img_sz = size(image);
half_pad_sz = floor(size(filter)/2);
pad_sz_i = 2* half_pad_sz(1);
pad_sz_j = 2* half_pad_sz(2);
padded_img = padarray(image,half_pad_sz);
output = zeros(img_sz);
if n_dim == 1
for i = 1:img_sz(1)
for j = 1:img_sz(2)
output(i,j) = sum(dot( padded_img(i:i+pad_sz_i, j:j+pad_sz_j), filter));
end
end
else
for ch = 1:n_dim
for i = 1:img_sz(1)
for j = 1:img_sz(2)
output(i,j,ch) = sum(dot( padded_img(i:i+pad_sz_i, j:j+pad_sz_j, ch), filter));
end
end
end
end
Hybrid images are generated by superimposing two images at two different spatial scales. High frequencies dominate the near view perception but only the low frequency part of the image can be seen from distance. There is a constraint to this that the images should be aligned good enough for the effect.
cutoff_frequency1 = 9;
cutoff_frequency2 = 5;
cutoff_frequency1 = 4;
cutoff_frequency2 = 2;
cutoff_frequency1 = 9;
cutoff_frequency2 = 3;
cutoff_frequency1 = 4;
cutoff_frequency2 = 8;
cutoff_frequency1 = 10;
cutoff_frequency2 = 2;
Here I have experimented with changing orientation in the picture as well as the face when viewing from far and near the image. Can be used for viewing pics in a workplace where the information is not supposed to be shared with other divisons.
cutoff_frequency1 = 5;
cutoff_frequency2 = 3;
Here I have experimented with different frames of a video to create a time lapse effect. When we move from far to near the image it will look like the player is swinging the bat and will give a video kind of effect. Although this is very raw, because it has only two frames, but I would try in future for hybrid images with more than 3 image.
cutoff_frequency1 = 7;
cutoff_frequency2 = 5;