% HW2: Erickson Miranda
% All files must be in the same directory

% task 1
files = dir('task1\*.jpg');
for i=1:8
    db{i} = imread(strcat('task1\',files(i).name));
end
figure; 
title('Task 1');
for i=1:8
    [top1,top2] = query(db{i},db);
    subplot(3,8,i), imshow(db{i});
    subplot(3,8,8+i), imshow(top1);
    subplot(3,8,16+i), imshow(top2);
end

files = dir('task2\*.jpg');
for i=1:8
    db{i} = imread(strcat('task2\',files(i).name));
end
figure;
title('Task 2');
for i=1:8
    [top1,top2] = query(db{i},db);
    subplot(3,8,i), imshow(db{i});
    subplot(3,8,8+i), imshow(top1);
    subplot(3,8,16+i), imshow(top2);
end