calculate similarity between two images