Problems with Image Statistics (fx:maxima etc.)

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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems with Image Statistics (fx:maxima etc.)

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

For IMv6, the overall standard-deviation is population rather than sample. It will likely remain that way since the current algorithm does not lend itself to sample-based standard-deviation.
miket
Posts: 60
Joined: 2016-08-12T13:19:13-07:00
Authentication code: 1151

Re: Problems with Image Statistics (fx:maxima etc.)

Post by miket »

I've now updated to : ImageMagick-7.0.5-3-beta20170315

All Max, Min & Mean values from identify and fx: commands now appear to give correct values.

Means give mean of RGBA with alpha "on" and mean of RGB with alpha "off" - which suits my needs just fine :)

Fred - I have not checked the SD values, nor have I checked out IM6 values.

Subject to Fred's comments, it looks like this has been resolved. It's taken a few goes, but many thanks for your work wizards :) :). It's much appreciated.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problems with Image Statistics (fx:maxima etc.)

Post by fmw42 »

There seem to be some issue with IM 6.9.8-1 Q16 beta fx statistics

IM 7.0.5-3 Q16 looks fine.



IM 6 beta:

Code: Select all

im6beta identify -verbose test.png

Code: Select all

  Channel statistics:
    Pixels: 3
    Red:
      min: 0 (0)
      max: 65535 (1)
      mean: 43690 (0.666667)
      standard deviation: 37836.6 (0.57735)
      kurtosis: -2.33333
      skewness: -0.3849
      entropy: 0.918296
    Green:
      min: 0 (0)
      max: 65535 (1)
      mean: 21845 (0.333333)
      standard deviation: 37836.6 (0.57735)
      kurtosis: -2.33333
      skewness: 0.3849
      entropy: 0.918296
    Blue:
      min: 16384 (0.250004)
      max: 49151 (0.749996)
      mean: 32767.7 (0.500003)
      standard deviation: 16383.5 (0.249996)
      kurtosis: -2.33333
      skewness: -2.03457e-05
      entropy: 1
    Alpha:
      min: 13107 (0.2)
      max: 65535 (1)
      mean: 48059 (0.733333)
      standard deviation: 30269.3 (0.46188)
      kurtosis: -2.33333
      skewness: 0.3849
      entropy: 0.918296
  Image statistics:
    Overall:
      min: 0 (0)
      max: 65535 (1)
      mean: 36590.3 (0.558333)
      standard deviation: 29135.5 (0.44458)
      kurtosis: -1.9149
      skewness: 0.1516
      entropy: 0.938722
FX stats

Code: Select all

im6beta convert test.png -format "min=%[fx:minima.r], max=%[fx:maxima.r], mean=%[fx:mean.r], std=%[fx:standard_deviation.r]\n" info:
min=0, max=1, mean=0.7, std=0.519615 <--- mean should be 0.666667 and std should be 0.57735

Code: Select all

im6beta convert test.png -format "min=%[fx:minima.g], max=%[fx:maxima.g], mean=%[fx:mean.g], std=%[fx:standard_deviation.g]\n" info:
min=0, max=1, mean=0.533333, std=0.519615 <--- mean should be 0.333333 and std should be 0.57735

Code: Select all

im6beta convert test.png -format "min=%[fx:minima.b], max=%[fx:maxima.b], mean=%[fx:mean.b], std=%[fx:standard_deviation.b]\n" info:
min=0.250004, max=0.749996, mean=0.616667, std=0.355938 <--- mean should be 0.500003 and std should be 0.249996

Code: Select all

im6beta convert test.png -format "min=%[fx:minima.a], max=%[fx:maxima.a], mean=%[fx:mean.a], std=%[fx:standard_deviation.a]\n" info:
min=0.2, max=1, mean=0.733333, std=0.46188

Code: Select all

im6beta convert test.png -format "min=%[fx:minima.o], max=%[fx:maxima.o], mean=%[fx:mean.o], std=%[fx:standard_deviation.o]\n" info:
min=0.2, max=1, mean=0.733333, std=0.46188

Code: Select all

im6beta convert test.png  -format "min=%[fx:minima], max=%[fx:maxima], mean=%[fx:mean], std=%[fx:standard_deviation]\n" info:
min=0, max=1, mean=0.558334, std=0.466644 <--- std should be 0.44458



IM 7 beta: All Looks Fine

Code: Select all

im7beta magick identify -verbose test.png

Code: Select all

  Channel statistics:
    Pixels: 3
    Red:
      min: 0 (0)
      max: 65535 (1)
      mean: 43690 (0.666667)
      standard deviation: 37836.6 (0.57735)
      kurtosis: -2.33333
      skewness: -0.3849
      entropy: 0.918296
    Green:
      min: 0 (0)
      max: 65535 (1)
      mean: 21845 (0.333333)
      standard deviation: 37836.6 (0.57735)
      kurtosis: -2.33333
      skewness: 0.3849
      entropy: 0.918296
    Blue:
      min: 16384 (0.250004)
      max: 49151 (0.749996)
      mean: 32767.7 (0.500003)
      standard deviation: 16383.5 (0.249996)
      kurtosis: -2.33333
      skewness: -2.03457e-05
      entropy: 1
    Alpha:
      min: 13107 (0.2)
      max: 65535 (1)
      mean: 48059 (0.733333)
      standard deviation: 30269.3 (0.46188)
      kurtosis: -2.33333
      skewness: -0.3849
      entropy: 0.918296
  Image statistics:
    Overall:
      min: 0 (0)
      max: 65535 (1)
      mean: 36590.4 (0.558334)
      standard deviation: 29135.5 (0.44458)
      kurtosis: -1.9149
      skewness: -0.151608
      entropy: 0.938722
FX stats:

Code: Select all

im7beta magick convert test.png -format "min=%[fx:minima.r], max=%[fx:maxima.r], mean=%[fx:mean.r], std=%[fx:standard_deviation.r]\n" info:
min=0, max=1, mean=0.666667, std=0.57735

Code: Select all

im7beta magick convert test.png -format "min=%[fx:minima.g], max=%[fx:maxima.g], mean=%[fx:mean.g], std=%[fx:standard_deviation.g]\n" info:
min=0, max=1, mean=0.333333, std=0.57735

Code: Select all

im7beta magick convert test.png -format "min=%[fx:minima.b], max=%[fx:maxima.b], mean=%[fx:mean.b], std=%[fx:standard_deviation.b]\n" info:
min=0.250004, max=0.749996, mean=0.500003, std=0.249996

Code: Select all

im7beta magick convert test.png -format "min=%[fx:minima.a], max=%[fx:maxima.a], mean=%[fx:mean.a], std=%[fx:standard_deviation.a]\n" info:
min=0.2, max=1, mean=0.733333, std=0.46188

Code: Select all

im7beta magick convert test.png -format "min=%[fx:minima.o], max=%[fx:maxima.o], mean=%[fx:mean.o], std=%[fx:standard_deviation.o]\n" info:
min=0.2, max=1, mean=0.733333, std=0.46188

Code: Select all

im7beta magick convert test.png  -format "min=%[fx:minima], max=%[fx:maxima], mean=%[fx:mean], std=%[fx:standard_deviation]\n" info:
min=0, max=1, mean=0.558334, std=0.444579
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems with Image Statistics (fx:maxima etc.)

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
Post Reply