use <= to allow image to match to itself
compute variation for possible reordering