set maxDifferent to the correct number of differing pixels