register ssize_t
j;
- PixelTrait traits=GetPixelChannelTraits(image,i);
area=PerceptibleReciprocal(channel_statistics[i].area);
channel_statistics[i].sum*=area;
channel_statistics[i].sum_squared*=area;
channel_statistics[i].standard_deviation=sqrt(
channel_statistics[i].variance-(channel_statistics[i].mean*
channel_statistics[i].mean));
- if (traits == UpdatePixelTrait)
- for (j=0; j < (ssize_t) (MaxMap+1U); j++)
- {
- double
- count;
+ for (j=0; j < (ssize_t) (MaxMap+1U); j++)
+ {
+ double
+ count;
- count=histogram[GetPixelChannels(image)*j+i]*area;
- channel_statistics[i].entropy+=-count*MagickLog10(count)/
- MagickLog10(MaxMap+1.0);
- }
+ count=histogram[GetPixelChannels(image)*j+i]*area;
+ channel_statistics[i].entropy+=-count*MagickLog10(count)/
+ MagickLog10(MaxMap+1.0);
+ }
}
for (i=0; i < (ssize_t) MaxPixelChannels; i++)
{
channel_statistics[CompositePixelChannel].standard_deviation+=
channel_statistics[i].variance-channel_statistics[i].mean*
channel_statistics[i].mean;
- channel_statistics[CompositePixelChannel].entropy+=
- channel_statistics[i].entropy;
+ if (channel_statistics[i].entropy > MagickEpsilon)
+ channel_statistics[CompositePixelChannel].entropy+=
+ channel_statistics[i].entropy;
}
channels=GetImageChannels(image);
channel_statistics[CompositePixelChannel].area/=channels;