function [im1,im2]=query(img, im);
% Compares images to the database using the histogram similarity function and
% returns the top 2 results.

for i=1:8
    sim(i) = histogramSimilarity (img,im{i});
end;

minsim=find(sim==min(sim))
sim(minsim)=max(sim);
min2sim=find(sim==min(sim))

im1=im{minsim};
im2=im{min2sim};

    