function [sim] = histogramSimilarity(im1, im2)
    %Compares using the Euclidean distance of the images' histograms.
    %This divides by the maximum frequency in the histogram to obtain
    %relative frequencies, rather than an absolute number of pixels.
    %This yields a better average correlation between the histograms.
    sim = norm((imhist(im1, 256) / max(imhist(im1, 256))) - (imhist(im2, 256) / max(imhist(im2, 256))));
    %sim = norm(imhist(im1) - imhist(im2)); %Old method
end