]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 10 Jan 2014 13:36:28 +0000 (13:36 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 10 Jan 2014 13:36:28 +0000 (13:36 +0000)
MagickCore/compare.c
MagickCore/statistic.c

index 87b6a5f58318f443c1fa7e4152f457b0e6660bcd..225e7c5658606d52fdda99decadbdea41491b133 100644 (file)
@@ -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;
index 3718216d684cad92dbeb2c649087a2a67fa355ac..6c75f2eca9a7a4cd735bcd361a7bcc3a6bf82715 100644 (file)
@@ -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])*