Correctly calculates percentage of pixels matching