MagickCore::CompareImages() question
Posted: 2016-04-15T11:12:51-07:00
Hello
I've observed a difference in using MagickCore::CompareImages when the image hasn't originated from a decoded png. The code, essentially, looks like:
The resultant distortion is 0.00422927
If, however, I reload the "saved_a.png" file back into an Image type, and compare, I get a lower difference value, say 0.00345319:
And indeed, this is true using the command line:
How can I ensure I get the same values back without decoding the file that I've just written out (ie I don't want to do that as it's expensive). Is there something that I can invoke on Image?
Thanks a lot
I've observed a difference in using MagickCore::CompareImages when the image hasn't originated from a decoded png. The code, essentially, looks like:
Code: Select all
Image a(pixel buffer);
Image b("b.png");
a.write("saved_a.png");
MagickCore::CompareImages(b.image(), a.image(), MagickCore::FuzzErrorMetric, &distortion, exception);
If, however, I reload the "saved_a.png" file back into an Image type, and compare, I get a lower difference value, say 0.00345319:
Code: Select all
Image a(pixel buffer);
Image b("b.png");
a.write("saved_a.png");
Image c("saved_a.png"); // decode the image we've just saved
// note compare b and c
MagickCore::CompareImages(b.image(), c.image(), MagickCore::FuzzErrorMetric, &distortion, exception);
Code: Select all
$ compare -metric FUZZ a.png b.png null
0.00345319
Thanks a lot