compare -metric fuzz is wrong!

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

compare -metric fuzz is wrong!

Post by anthony »

The compare -metric fuzz is suposed to implement the FUZZ formula

"%[fx:(100)*sqrt( ( (u.r-v.r)^2 +
(u.g-v.g)^2 +
(u.b-v.b)^2 )*u.a*v.a/3 + (u.a-v.a)^2 ) ]%%"

That is a 4 dimentional cone with alpha channel of the 3D color channel distance.
the 100 (for percent should be QuantumRange for the output image.

See http://www.imagemagick.org/Usage/bugs/fuzz_distance/

However it is clearly not using that formula...

compare -metric fuzz xc:white xc:blue null:
43690 (0.666667)

That wrong. This distance is Manhattan (taxi-cab) distance, without squares or square roots!

compare -metric fuzz xc:white xc:blue -alpha on null:
32767.5 (0.5)

That should NOT be the case.
As both colors are opaque the 'fuzz' distance should not change.
Opaque colors do not get further apart when alpha is enabled!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply