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