...
authorCristy <urban-warrior@imagemagick.org>
Fri, 24 Feb 2017 23:28:29 +0000 (18:28 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 24 Feb 2017 23:28:29 +0000 (18:28 -0500)
MagickCore/statistic.c

index 5cde9930b200920791176286c0cfc0ed2375a592..69c498751be509441c411cf4ccd52df6c6946d3b 100644 (file)
@@ -1528,6 +1528,10 @@ MagickExport ChannelMoments *GetImageMoments(const Image *image,
       (M20[channel]-M02[channel])*(M20[channel]-M02[channel]))));
     channel_moments[channel].ellipse_angle=RadiansToDegrees(0.5*atan(2.0*
       M11[channel]/(M20[channel]-M02[channel]+MagickEpsilon)));
+    if (channel_moments[channel].ellipse_angle < 0.0)
+      channel_moments[channel].ellipse_angle+=90.0;
+    if (channel_moments[channel].ellipse_angle >= 90.0)
+      channel_moments[channel].ellipse_angle-=90.0;
     channel_moments[channel].ellipse_eccentricity=sqrt(1.0-(
       channel_moments[channel].ellipse_axis.y/
       (channel_moments[channel].ellipse_axis.x+MagickEpsilon)));