A Family of Contextual Measures of Similarity between Distributions with Application to Image Retrieval