Revert "Change the computeImageDistance function"

This reverts commit 3f1288e54c979830400ac7d3a02f68dc7e19ffa0.