]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 8 Aug 2010 02:26:04 +0000 (02:26 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 8 Aug 2010 02:26:04 +0000 (02:26 +0000)
magick/statistic.c
magick/statistic.h

index 2cef7358c35d9c7fe3ad74321893ec287b5ab427..4629e5d45d712f5fcaae49dacfc2b312d11ac981 100644 (file)
@@ -1078,7 +1078,8 @@ MagickExport MagickBooleanType GetImageChannelMean(const Image *image,
           *standard_deviation+=(double) p->blue*GetBluePixelComponent(p);
           area++;
         }
-      if ((channel & OpacityChannel) != 0)
+      if (((channel & OpacityChannel) != 0) &&
+          (image->matte != MagickFalse))
         {
           *mean+=GetOpacityPixelComponent(p);
           *standard_deviation+=(double) p->opacity*GetOpacityPixelComponent(p);
@@ -1643,7 +1644,9 @@ MagickExport ChannelStatistics *GetImageChannelStatistics(const Image *image,
     channel_statistics[AllChannels].kurtosis+=channel_statistics[i].kurtosis;
     channel_statistics[AllChannels].skewness+=channel_statistics[i].skewness;
   }
-  channels=4;
+  channels=3;
+  if (image->matte != MagickFalse)
+    channels++;
   if (image->colorspace == CMYKColorspace)
     channels++;
   channel_statistics[AllChannels].mean/=channels;
index 3e0d617b915e9fd82be1c3570f004557cf15f8b8..a007b43e1b7bbbd5b2f4d2b8fa35da40a8769044 100644 (file)
@@ -30,7 +30,8 @@ typedef struct _ChannelStatistics
   double
     minima,
     maxima,
-    mean, standard_deviation,
+    mean,
+    standard_deviation,
     kurtosis,
     skewness;
 } ChannelStatistics;