+1. Nice work. I am impressed. Image comparison is notoriously 
difficult, and it is a good idea to recycle other tools.

My one suggestion is to consider other tolerance options. In particular, 
the integer tolerance does not look like it scales with image size. I 
expect you are honouring pdiff's native options. If you double the image 
in each dimension, do you have to have to quadruple your tolerance? 
Would a double representing a fraction of total pixels be a bit more 
user-friendly? For example, we might want to fail a test if 0.01% of 
pixels change, regardless of image size. Is this good practice? Who 
knows. (Thinking of noise scaling laws.)

Would it be useful to add an ImageAssert.Options class to allow other 
options to be set? This might allow either style (integer or fraction) 
to be used transparently.

Well done: two static methods and already you have users asking for more 
features.  :-)

Kind regards,
Ben.

On 28/03/11 02:58, Andrea Aime wrote:
> Hi,
> I put toghether some tooling that can compare images against
> references using an eventually installed perceptualdiff.
>
> The user visible class is called ImageAssert, and exposes these
> two methods:
>
> public static void assertEquals(File expectedFile, RenderedImage
> actualImage, int threshold);
> public static void assertEquals(RenderedImage expectedImage,
> RenderedImage actualImage,
>              int threshold);
>
> The threshold is the number of pixels that can be perceptually
> different without having to
> consider the image different (useful for images with fonts for
> example, and to allow some
> changes in the antialiasing).
>
> The tool will perform the assert only if perceptualdiff is in the
> path, otherwise it will
> emit a warning and exit peacefully (no test failures).
>
> If the first method does not find the expectedFile and the
> org.geotools.image.test.interactive=true
> system variable is set it will pop up a dialog asking for visual
> inspection, if the user
> gives a positive result it will save the image as the expected file.
> (see savereference.png, attached).
>
> If the same variable is set and the two images are not equal a dialog helping 
> to
> compare the image will be shown (compare.png).
> Maybe the image changed enough for the tool to trigger on it, but the result
> might be good anyways (e.g. the label placement were changed), if so the
> user can overwrite the reference.
>
> In case the variable is not set the tests will fail without popping up
> any dialog.
>
> What do you think? Seems useful enough to me, if we find a significant
> platform/jdk/font
> variation we can just raise the threshold without giving up the test 
> altogheter.
>
> The only major thing we'd need is to have perceptualdiff installed on Hudson
> and on machines of anyone that is interested in rendering testing.
>
> Cheers
> Andrea
>
>

-- 
Ben Caradoc-Davies <[email protected]>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to