[cairo] A better image comparison tool

Ralph Giles giles at ghostscript.com
Mon Sep 22 12:06:37 PDT 2008


On Mon, Sep 22, 2008 at 11:53 AM, Antoine Azar <cairo at antoineazar.com> wrote:

> I am considering a couple approaches. The first one I want to try out is a
> pretty simple square sum of differences or sum of absolute differences.
> There are more fancy algorithms like cross correlation and mutual
> information,  which I'll probably try out too. We can then set custom
> thresholds for what should appear as "OK", "Warning" and "Error".

We'd be interested to hear how this goes. The problem we've had with a
lot of these measures is that the were developed for image recognition
and video compression applications and don't apply well to
high-contrast vector graphics

We use a threshold+cluster tool to cull single-pixel differences in
our regression tests for ghostscript. It counts the number of pixels
whose values differ by more than a threshold value, and then counts
how many of those are in clusters larger than a particular window
size.

Implementation is here if you want to try it out:

  http://svn.ghostscript.com/ghostscript/trunk/gs/toolbin/tests/fuzzy.c

Note the 'make a diff image' feature is currently broken. It expect
the input files to be in bmp or ppm format.

 -r


More information about the cairo mailing list