compare meric AE ignores fuzz factor

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

compare meric AE ignores fuzz factor

Post by anthony »

The compare option -mertic AE returns a list of the number of pixels that was different
between the images.

compare also has a -fuzz option which adjusts the number of modified pixels reported by the output image. However this factor does not modify the pixel count returned by the AE metric, it only effects the output image.

Can we have a TE metric added that returns the Threshold Error.
That is the number of pixels in the image that are NOT within the 'fuzz factor' threshold.
I don't actually care about the output image.

ASIDE: if the output image of compare is NULL: perhaps compare can avoid image mask processing and thus speed up its processing.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: compare meric AE ignores fuzz factor

Post by magick »

AE respects -fuzz. We tried
  • compare -fuzz 15% -metric ae rose: rose: null:
Debugging shows the fuzz @ 9830.25 for Q16. Method magick/compare.c/GetAbsoluteDistortion() calls IsMagickColorSimilar() which respects the pixel fuzz.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: compare meric AE ignores fuzz factor

Post by anthony »

Strange when I tested that a few days ago it wasn't working! I must have been doing it wrong!

Only to AE Any two transparent colors are equal

compare -metric AE xc:#0000 xc:#FFF0 null:
0

But of course to RMSE they are different!

compare -metric RMSE xc:#0000 xc:#FFF0 null:
56755 (0.866025)

Though I do not understand why the distance is 86.7% of the distance between white and black!
That does not seem to make a lot of sense!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: compare meric AE ignores fuzz factor

Post by anthony »

Can we modify the code so that we get a Fuzz Factor 'distance' metric.
EG:
compare -metric Fuzz xc:Blue xc:Navy null:
16383.8 (0.25)

Note that this should return the same result for RMSE for fully-opaque colors.
However Fuzz results are different when transparency is involved. EG:

compare -metric Fuzz xc:#0000 xc:#FFF0 null:
0 (0.00000)

We may have a new fuzz factor formula soon. One that treats None to any opaque color as being the same.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: compare meric AE ignores fuzz factor

Post by fmw42 »

why not just a new parameter for compare such as -respect-transparency or something like that (or -channel rgba)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: compare meric AE ignores fuzz factor

Post by anthony »

Because it should not effect other metrics!!!! It is a completely separate metric.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: compare meric AE ignores fuzz factor

Post by fmw42 »

anthony wrote:Because it should not effect other metrics!!!! It is a completely separate metric.
Yes, I agree. I thought about that over night and realized that it was only for rmse and your method would not affect the others, but mine would, if taken full course. My alternate suggestions are withdrawn.
Post Reply