Exploiting spatial overlap to efficiently compute appearance distances between image windows