ImageMagick-6.9.9-27差分

ImageMagick-6.9.9-26差分 - yoyaのメモの続き

The latest release of ImageMagick is version 6.9.9-27

まとめ

magick logo: -scale 1x1! -format "%[fx:standard_deviation]\n" info:

標準偏差でなく平均が出てるのを修正。

差分

458,478d457
<   if ((channel == AlphaChannel) || (LocaleCompare(name,"Overall") == 0))
<     {
<       n=FormatLocaleFile(file,StatisticsFormat,name,GetMagickPrecision(),
<         (double) ClampToQuantum((MagickRealType) (scale*
<         (QuantumRange-channel_statistics[channel].minima))),
<         GetMagickPrecision(),(QuantumRange-channel_statistics[channel].minima)/
<         (double) QuantumRange,GetMagickPrecision(),(double) ClampToQuantum(
<         (MagickRealType) (scale*(QuantumRange-
<         channel_statistics[channel].maxima))),GetMagickPrecision(),
<         (QuantumRange-channel_statistics[channel].maxima)/(double) QuantumRange,
<         GetMagickPrecision(),scale*(QuantumRange-
<         channel_statistics[channel].mean),GetMagickPrecision(),(QuantumRange-
<         channel_statistics[channel].mean)/(double) QuantumRange,
<         GetMagickPrecision(),scale*
<         channel_statistics[channel].standard_deviation,GetMagickPrecision(),
<         channel_statistics[channel].standard_deviation/(double) QuantumRange,
<         GetMagickPrecision(),channel_statistics[channel].kurtosis,
<         GetMagickPrecision(),channel_statistics[channel].skewness,
<         GetMagickPrecision(),channel_statistics[channel].entropy);
<       return(n);
<     }
771c750
<     MagickColorspaceOptions,(ssize_t) image->colorspace));
---
>     MagickColorspaceOptions,(ssize_t) colorspace));
    • magick/statistic.c
20c20
< %  Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization      %
---
> %  Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization      %
1457,1462c1457,1462
<           mean+=GetPixelOpacity(p);
<           sum_squares+=(double) GetPixelOpacity(p)*GetPixelOpacity(p);
<           sum_cubes+=(double) GetPixelOpacity(p)*GetPixelOpacity(p)*
<             GetPixelOpacity(p);
<           sum_fourth_power+=(double) GetPixelOpacity(p)*GetPixelOpacity(p)*
<             GetPixelOpacity(p)*GetPixelOpacity(p);
---
>           mean+=GetPixelAlpha(p);
>           sum_squares+=(double) GetPixelOpacity(p)*GetPixelAlpha(p);
>           sum_cubes+=(double) GetPixelOpacity(p)*GetPixelAlpha(p)*
>             GetPixelAlpha(p);
>           sum_fourth_power+=(double) GetPixelAlpha(p)*GetPixelAlpha(p)*
>             GetPixelAlpha(p)*GetPixelAlpha(p);
2436c2436
<               if (IsPixelAtDepth(GetPixelOpacity(p),range) == MagickFalse)
---
>               if (IsPixelAtDepth(GetPixelAlpha(p),range) == MagickFalse)
2494,2500c2494,2498
<           if ((double) GetPixelOpacity(p) < channel_statistics[OpacityChannel].minima)
<             channel_statistics[OpacityChannel].minima=(double)
<               GetPixelOpacity(p);
<           if ((double) GetPixelOpacity(p) > channel_statistics[OpacityChannel].maxima)
<             channel_statistics[OpacityChannel].maxima=(double)
<               GetPixelOpacity(p);
<           channel_statistics[OpacityChannel].sum+=GetPixelOpacity(p);
---
>           if ((double) GetPixelAlpha(p) < channel_statistics[OpacityChannel].minima)
>             channel_statistics[OpacityChannel].minima=(double) GetPixelAlpha(p);
>           if ((double) GetPixelAlpha(p) > channel_statistics[OpacityChannel].maxima)
>             channel_statistics[OpacityChannel].maxima=(double) GetPixelAlpha(p);
>           channel_statistics[OpacityChannel].sum+=GetPixelAlpha(p);
2502c2500
<             GetPixelOpacity(p)*GetPixelOpacity(p);
---
>             GetPixelAlpha(p)*GetPixelAlpha(p);
2504c2502
<             GetPixelOpacity(p)*GetPixelOpacity(p)*GetPixelOpacity(p);
---
>             GetPixelAlpha(p)*GetPixelAlpha(p)*GetPixelAlpha(p);
2506,2508c2504,2505
<             GetPixelOpacity(p)*GetPixelOpacity(p)*GetPixelOpacity(p)*
<             GetPixelOpacity(p);
<           histogram[ScaleQuantumToMap(GetPixelOpacity(p))].opacity++;
---
>             GetPixelAlpha(p)*GetPixelAlpha(p)*GetPixelAlpha(p)*GetPixelAlpha(p);
>           histogram[ScaleQuantumToMap(GetPixelAlpha(p))].opacity++;
2681a2679,2689
>   channel_statistics[CompositeChannels].mean=0.0;
>   channel_statistics[CompositeChannels].standard_deviation=0.0;
>   for (i=0; i < (ssize_t) CompositeChannels; i++)
>   {
>     channel_statistics[CompositeChannels].mean+=
>       channel_statistics[i].mean;
>     channel_statistics[CompositeChannels].standard_deviation+=
>       channel_statistics[i].standard_deviation;
>   }
>   channel_statistics[CompositeChannels].mean/=(double) channels;
>   channel_statistics[CompositeChannels].standard_deviation/=(double) channels;
ChangeLogにない差分
  • magick/colorspace.c
> #include "magick/enhance.h"
1405,1410c1406,1407
<   if ((image->colorspace == Rec709LumaColorspace) &&
<       (colorspace == sRGBColorspace))
<     return(SetImageColorspace(image,colorspace));
<   if ((image->colorspace == GRAYColorspace) && (image->gamma != 1.0) &&
<       (colorspace == sRGBColorspace))
<     return(SetImageColorspace(image,colorspace));
---
>   if ((image->colorspace == RGBColorspace) && (colorspace == GRAYColorspace))
>     return(GrayscaleImage(image,Rec709LuminancePixelIntensityMethod));

ChangeLog

2017-12-08  6.9.9-27 Cristy  <quetzlzacatenango@image...>
  * Overall standard deviation is the average of each pixel channel (reference
    https://www.imagemagick.org/discourse-server/viewforum.php?f=3).