octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automated (or otherwise) tests for graphics code?


From: Przemek Klosowski
Subject: Re: automated (or otherwise) tests for graphics code?
Date: Fri, 17 Oct 2008 09:22:03 -0400 (EDT)

Thomas wrote:
   > It seems gnuplot produces identical images (md5sum matches) for
   > identical input. 

David responded
   Hummm, that will make development harder though as any change to the 
   commands sent to gnuplot for any reason might result in a slightly 
   different plot, and so a spurious failure. There is still a need for 
   some intervention in these cases.. Though perhaps the md5sum with png 
   images might be a reasonable solution..

What if we used Octave superior processing powers to look how similar images 
are? The simplest idea would be to just see how many different pixels are there
in the image:

 %!test
 %! sombrero
 %! print("testImage.png")
 %! img1=imread("testImage.png");
 %! img2=imread("correctImage.png");
 %! assert((sum(sum(sum((img1-img2) != 0))))/prod(size(img1)) < .05)

I concede that this method is crude and unpredictable, but it should catch
all 'huge' errors where the plot totally fails. Someone smarter could
come up with more ambitious similarity testing algorithm on the images,
like a radon transform perhaps, if this is not acceptable.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]