]> granicus.if.org Git - imagemagick/commitdiff
https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=33199
authorCristy <urban-warrior@imagemagick.org>
Fri, 8 Dec 2017 23:50:55 +0000 (18:50 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 8 Dec 2017 23:50:55 +0000 (18:50 -0500)
MagickCore/statistic.c

index b8419831d92e53897ba4e3759e360da8006b37f5..cc6b5aa1ff30ba1590f5c4ace7bb7094f2937892 100644 (file)
@@ -2139,6 +2139,19 @@ MagickExport ChannelStatistics *GetImageStatistics(const Image *image,
       channel_statistics[i].mean)*(standard_deviation*standard_deviation*
       standard_deviation*standard_deviation)-3.0;
   }
+  channel_statistics[CompositePixelChannel].mean=0.0;
+  channel_statistics[CompositePixelChannel].standard_deviation=0.0;
+  for (i=0; i < (ssize_t) MaxPixelChannels; i++)
+  {
+    channel_statistics[CompositePixelChannel].mean+=
+      channel_statistics[i].mean;
+    channel_statistics[CompositePixelChannel].standard_deviation+=
+      channel_statistics[i].standard_deviation;
+  }
+  channel_statistics[CompositePixelChannel].mean/=(double)
+    GetImageChannels(image);
+  channel_statistics[CompositePixelChannel].standard_deviation/=(double)
+    GetImageChannels(image);
   if (y < (ssize_t) image->rows)
     channel_statistics=(ChannelStatistics *) RelinquishMagickMemory(
       channel_statistics);