For regression tests of our note typesetting program, LilyPond, we currently use ImageGraphick's compare
program with the MAE metric (mean absolute error, average channel error distance). A typical call to get metric values is
compare -verbose \
-metric psnr \
-depth 8 \
-dissimilarity-threshold 1 \
regtest-old.png regtest-new.png regtest-diff.png
This works fine for almost all regression test comparisons. However, it doesn't give good results for some cases that must be flagged as problematic, namely the appearance or disappearance of objects.
Consider the following two images, which are identical except a vertical shift by one pixel.
The MAE reported by a call as described above is 5422.7.
On the other hand, the following two images are substantially different (at least from the viewpoint of LilyPond) – they are identical except a small object, which is missing in the second image.
Here, the MAE is much smaller, namely 14.8507.
Due to rendering at a rather low resolution (to speed up the regression tests) we use a threshold to reject 'unimportant' differences. Alas, the case with the missing object is below our threshold.
My question: Is there a better metric available that returns smaller values for image shifts and the like but larger values for missing or added objects? All other metrics offered by the compare
program seem to be unsuitable.