From: cristy Date: Fri, 10 Jan 2014 13:36:28 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2911 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3dfa9ea90c8281fd712402034c282efd32e9b0b7;p=imagemagick --- diff --git a/MagickCore/compare.c b/MagickCore/compare.c index 87b6a5f58..225e7c565 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -1142,6 +1142,9 @@ static MagickBooleanType GetPerceptualHashDistortion(const Image *image, double difference; + if ((fabs(reconstruct_moments[channel].I[i]) < MagickEpsilon) || + (fabs(image_moments[channel].I[i]) < MagickEpsilon)) + continue; difference=log10(fabs(reconstruct_moments[channel].I[i]))- log10(fabs(image_moments[channel].I[i])); distortion[channel]+=difference*difference; @@ -1200,6 +1203,9 @@ static MagickBooleanType GetPerceptualHashDistortion(const Image *image, double difference; + if ((fabs(reconstruct_moments[channel].I[i]) < MagickEpsilon) || + (fabs(image_moments[channel].I[i]) < MagickEpsilon)) + continue; difference=log10(fabs(reconstruct_moments[channel].I[i]))- log10(fabs(image_moments[channel].I[i])); distortion[channel]+=difference*difference; diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index 3718216d6..6c75f2eca 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -1565,7 +1565,7 @@ MagickExport ChannelMoments *GetImageMoments(const Image *image, */ if (fabs(M00[channel]) < MagickEpsilon) continue; - channel_moments[channel].I[0]=M20[channel]+M02[channel]; + channel_moments[channel].I[0]=M20[channel]+M02[channel]; channel_moments[channel].I[1]=(M20[channel]-M02[channel])* (M20[channel]-M02[channel])+4.0*M11[channel]*M11[channel]; channel_moments[channel].I[2]=(M30[channel]-3.0*M12[channel])*