]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/feature.c
Update web pages
[imagemagick] / MagickCore / feature.c
index 7dc3faa086f9c7fbd28ec78d7f47e68c7c80cfe9..4f5b23700ff17c2576f867290122dd673030220e 100644 (file)
@@ -17,7 +17,7 @@
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -48,6 +48,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/cache-private.h"
 #include "MagickCore/cache-view.h"
+#include "MagickCore/channel.h"
 #include "MagickCore/client.h"
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
@@ -246,7 +247,7 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
     pixel;
 
   char
-    geometry[MaxTextExtent];
+    geometry[MagickPathExtent];
 
   double
     lower_threshold,
@@ -273,15 +274,15 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
     y;
 
   assert(image != (const Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   assert(exception != (ExceptionInfo *) NULL);
-  assert(exception->signature == MagickSignature);
+  assert(exception->signature == MagickCoreSignature);
   /*
     Filter out noise.
   */
-  (void) FormatLocaleString(geometry,MaxTextExtent,
+  (void) FormatLocaleString(geometry,MagickPathExtent,
     "blur:%.20gx%.20g;blur:%.20gx%.20g+90",radius,sigma,radius,sigma);
   kernel_info=AcquireKernelInfo(geometry,exception);
   if (kernel_info == (KernelInfo *) NULL)
@@ -296,6 +297,7 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
       edge_image=DestroyImage(edge_image);
       return((Image *) NULL);
     }
+  (void) SetImageAlphaChannel(edge_image,OffAlphaChannel,exception);
   /*
     Find the intensity gradient of the image.
   */
@@ -609,13 +611,6 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
 %
 */
 
-static inline ssize_t MagickAbsoluteValue(const ssize_t x)
-{
-  if (x < 0)
-    return(-x);
-  return(x);
-}
-
 static inline double MagickLog10(const double x)
 {
 #define Log10Epsilon  (1.0e-11)
@@ -677,7 +672,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     number_grays;
 
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if ((image->columns < (distance+1)) || (image->rows < (distance+1)))
@@ -742,7 +737,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       if (image->colorspace == CMYKColorspace)
         grays[ScaleQuantumToMap(GetPixelBlack(image,p))].black=
           ScaleQuantumToMap(GetPixelBlack(image,p));
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         grays[ScaleQuantumToMap(GetPixelAlpha(image,p))].alpha=
           ScaleQuantumToMap(GetPixelAlpha(image,p));
       p+=GetPixelChannels(image);
@@ -768,7 +763,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     if (image->colorspace == CMYKColorspace)
       if (grays[i].black != ~0U)
         grays[gray.black++].black=grays[i].black;
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       if (grays[i].alpha != ~0U)
         grays[gray.alpha++].alpha=grays[i].alpha;
   }
@@ -783,7 +778,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
   if (image->colorspace == CMYKColorspace)
     if (gray.black > number_grays)
       number_grays=gray.black;
-  if (image->alpha_trait == BlendPixelTrait)
+  if (image->alpha_trait != UndefinedPixelTrait)
     if (gray.alpha > number_grays)
       number_grays=gray.alpha;
   cooccurrence=(ChannelStatistics **) AcquireQuantumMemory(number_grays,
@@ -985,7 +980,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
             cooccurrence[u][v].direction[i].black++;
             cooccurrence[v][u].direction[i].black++;
           }
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           {
             u=0;
             v=0;
@@ -1074,7 +1069,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         cooccurrence[x][y].direction[i].blue*=normalize;
         if (image->colorspace == CMYKColorspace)
           cooccurrence[x][y].direction[i].black*=normalize;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           cooccurrence[x][y].direction[i].alpha*=normalize;
       }
     }
@@ -1114,7 +1109,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
           channel_features[BlackPixelChannel].angular_second_moment[i]+=
             cooccurrence[x][y].direction[i].black*
             cooccurrence[x][y].direction[i].black;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           channel_features[AlphaPixelChannel].angular_second_moment[i]+=
             cooccurrence[x][y].direction[i].alpha*
             cooccurrence[x][y].direction[i].alpha;
@@ -1126,7 +1121,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         sum[y].direction[i].blue+=cooccurrence[x][y].direction[i].blue;
         if (image->colorspace == CMYKColorspace)
           sum[y].direction[i].black+=cooccurrence[x][y].direction[i].black;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           sum[y].direction[i].alpha+=cooccurrence[x][y].direction[i].alpha;
         correlation.direction[i].red+=x*y*cooccurrence[x][y].direction[i].red;
         correlation.direction[i].green+=x*y*
@@ -1136,7 +1131,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         if (image->colorspace == CMYKColorspace)
           correlation.direction[i].black+=x*y*
             cooccurrence[x][y].direction[i].black;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           correlation.direction[i].alpha+=x*y*
             cooccurrence[x][y].direction[i].alpha;
         /*
@@ -1151,7 +1146,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         if (image->colorspace == CMYKColorspace)
           channel_features[BlackPixelChannel].inverse_difference_moment[i]+=
             cooccurrence[x][y].direction[i].black/((y-x)*(y-x)+1);
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           channel_features[AlphaPixelChannel].inverse_difference_moment[i]+=
             cooccurrence[x][y].direction[i].alpha/((y-x)*(y-x)+1);
         /*
@@ -1166,7 +1161,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         if (image->colorspace == CMYKColorspace)
           density_xy[y+x+2].direction[i].black+=
             cooccurrence[x][y].direction[i].black;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           density_xy[y+x+2].direction[i].alpha+=
             cooccurrence[x][y].direction[i].alpha;
         /*
@@ -1185,7 +1180,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
           channel_features[BlackPixelChannel].entropy[i]-=
             cooccurrence[x][y].direction[i].black*
             MagickLog10(cooccurrence[x][y].direction[i].black);
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           channel_features[AlphaPixelChannel].entropy[i]-=
             cooccurrence[x][y].direction[i].alpha*
             MagickLog10(cooccurrence[x][y].direction[i].alpha);
@@ -1195,7 +1190,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         density_x[x].direction[i].red+=cooccurrence[x][y].direction[i].red;
         density_x[x].direction[i].green+=cooccurrence[x][y].direction[i].green;
         density_x[x].direction[i].blue+=cooccurrence[x][y].direction[i].blue;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           density_x[x].direction[i].alpha+=
             cooccurrence[x][y].direction[i].alpha;
         if (image->colorspace == CMYKColorspace)
@@ -1207,7 +1202,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         if (image->colorspace == CMYKColorspace)
           density_y[y].direction[i].black+=
             cooccurrence[x][y].direction[i].black;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           density_y[y].direction[i].alpha+=
             cooccurrence[x][y].direction[i].alpha;
       }
@@ -1222,7 +1217,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
           mean.direction[i].black+=y*sum[y].direction[i].black;
           sum_squares.direction[i].black+=y*y*sum[y].direction[i].black;
         }
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         {
           mean.direction[i].alpha+=y*sum[y].direction[i].alpha;
           sum_squares.direction[i].alpha+=y*y*sum[y].direction[i].alpha;
@@ -1256,7 +1251,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         (mean.direction[i].black*mean.direction[i].black))*sqrt(
         sum_squares.direction[i].black-(mean.direction[i].black*
         mean.direction[i].black)));
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       channel_features[AlphaPixelChannel].correlation[i]=
         (correlation.direction[i].alpha-mean.direction[i].alpha*
         mean.direction[i].alpha)/(sqrt(sum_squares.direction[i].alpha-
@@ -1290,7 +1285,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       if (image->colorspace == CMYKColorspace)
         channel_features[BlackPixelChannel].sum_average[i]+=
           x*density_xy[x].direction[i].black;
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         channel_features[AlphaPixelChannel].sum_average[i]+=
           x*density_xy[x].direction[i].alpha;
       /*
@@ -1309,7 +1304,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         channel_features[BlackPixelChannel].sum_entropy[i]-=
           density_xy[x].direction[i].black*
           MagickLog10(density_xy[x].direction[i].black);
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         channel_features[AlphaPixelChannel].sum_entropy[i]-=
           density_xy[x].direction[i].alpha*
           MagickLog10(density_xy[x].direction[i].alpha);
@@ -1333,7 +1328,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
           (x-channel_features[BlackPixelChannel].sum_entropy[i])*
           (x-channel_features[BlackPixelChannel].sum_entropy[i])*
           density_xy[x].direction[i].black;
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         channel_features[AlphaPixelChannel].sum_variance[i]+=
           (x-channel_features[AlphaPixelChannel].sum_entropy[i])*
           (x-channel_features[AlphaPixelChannel].sum_entropy[i])*
@@ -1371,7 +1366,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         if (image->colorspace == CMYKColorspace)
           variance.direction[i].black+=(y-mean.direction[i].black+1)*
             (y-mean.direction[i].black+1)*cooccurrence[x][y].direction[i].black;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           variance.direction[i].alpha+=(y-mean.direction[i].alpha+1)*
             (y-mean.direction[i].alpha+1)*
             cooccurrence[x][y].direction[i].alpha;
@@ -1387,7 +1382,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         if (image->colorspace == CMYKColorspace)
           density_xy[MagickAbsoluteValue(y-x)].direction[i].black+=
             cooccurrence[x][y].direction[i].black;
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           density_xy[MagickAbsoluteValue(y-x)].direction[i].alpha+=
             cooccurrence[x][y].direction[i].alpha;
         /*
@@ -1402,7 +1397,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         if (image->colorspace == CMYKColorspace)
           entropy_xy.direction[i].black-=cooccurrence[x][y].direction[i].black*
             MagickLog10(cooccurrence[x][y].direction[i].black);
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           entropy_xy.direction[i].alpha-=
             cooccurrence[x][y].direction[i].alpha*MagickLog10(
             cooccurrence[x][y].direction[i].alpha);
@@ -1417,7 +1412,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
           entropy_xy1.direction[i].black-=(
             cooccurrence[x][y].direction[i].black*MagickLog10(
             density_x[x].direction[i].black*density_y[y].direction[i].black));
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           entropy_xy1.direction[i].alpha-=(
             cooccurrence[x][y].direction[i].alpha*MagickLog10(
             density_x[x].direction[i].alpha*density_y[y].direction[i].alpha));
@@ -1434,7 +1429,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
           entropy_xy2.direction[i].black-=(density_x[x].direction[i].black*
             density_y[y].direction[i].black*MagickLog10(
             density_x[x].direction[i].black*density_y[y].direction[i].black));
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           entropy_xy2.direction[i].alpha-=(density_x[x].direction[i].alpha*
             density_y[y].direction[i].alpha*MagickLog10(
             density_x[x].direction[i].alpha*density_y[y].direction[i].alpha));
@@ -1449,7 +1444,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     if (image->colorspace == CMYKColorspace)
       channel_features[BlackPixelChannel].variance_sum_of_squares[i]=
         variance.direction[i].black;
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       channel_features[AlphaPixelChannel].variance_sum_of_squares[i]=
         variance.direction[i].alpha;
   }
@@ -1477,7 +1472,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       variance.direction[i].blue+=density_xy[x].direction[i].blue;
       if (image->colorspace == CMYKColorspace)
         variance.direction[i].black+=density_xy[x].direction[i].black;
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         variance.direction[i].alpha+=density_xy[x].direction[i].alpha;
       sum_squares.direction[i].red+=density_xy[x].direction[i].red*
         density_xy[x].direction[i].red;
@@ -1488,7 +1483,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       if (image->colorspace == CMYKColorspace)
         sum_squares.direction[i].black+=density_xy[x].direction[i].black*
           density_xy[x].direction[i].black;
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         sum_squares.direction[i].alpha+=density_xy[x].direction[i].alpha*
           density_xy[x].direction[i].alpha;
       /*
@@ -1507,7 +1502,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         channel_features[BlackPixelChannel].difference_entropy[i]-=
           density_xy[x].direction[i].black*
           MagickLog10(density_xy[x].direction[i].black);
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         channel_features[AlphaPixelChannel].difference_entropy[i]-=
           density_xy[x].direction[i].alpha*
           MagickLog10(density_xy[x].direction[i].alpha);
@@ -1523,7 +1518,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       if (image->colorspace == CMYKColorspace)
         entropy_x.direction[i].black-=(density_x[x].direction[i].black*
           MagickLog10(density_x[x].direction[i].black));
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         entropy_x.direction[i].alpha-=(density_x[x].direction[i].alpha*
           MagickLog10(density_x[x].direction[i].alpha));
       entropy_y.direction[i].red-=(density_y[x].direction[i].red*
@@ -1535,7 +1530,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       if (image->colorspace == CMYKColorspace)
         entropy_y.direction[i].black-=(density_y[x].direction[i].black*
           MagickLog10(density_y[x].direction[i].black));
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         entropy_y.direction[i].alpha-=(density_y[x].direction[i].alpha*
           MagickLog10(density_y[x].direction[i].alpha));
     }
@@ -1559,7 +1554,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         (((double) number_grays*number_grays*sum_squares.direction[i].black)-
         (variance.direction[i].black*variance.direction[i].black))/
         ((double) number_grays*number_grays*number_grays*number_grays);
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       channel_features[AlphaPixelChannel].difference_variance[i]=
         (((double) number_grays*number_grays*sum_squares.direction[i].alpha)-
         (variance.direction[i].alpha*variance.direction[i].alpha))/
@@ -1584,27 +1579,27 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         (entropy_xy.direction[i].black-entropy_xy1.direction[i].black)/
         (entropy_x.direction[i].black > entropy_y.direction[i].black ?
          entropy_x.direction[i].black : entropy_y.direction[i].black);
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       channel_features[AlphaPixelChannel].measure_of_correlation_1[i]=
         (entropy_xy.direction[i].alpha-entropy_xy1.direction[i].alpha)/
         (entropy_x.direction[i].alpha > entropy_y.direction[i].alpha ?
          entropy_x.direction[i].alpha : entropy_y.direction[i].alpha);
     channel_features[RedPixelChannel].measure_of_correlation_2[i]=
-      (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].red-
+      (sqrt(fabs(1.0-exp(-2.0*(double) (entropy_xy2.direction[i].red-
       entropy_xy.direction[i].red)))));
     channel_features[GreenPixelChannel].measure_of_correlation_2[i]=
-      (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].green-
+      (sqrt(fabs(1.0-exp(-2.0*(double) (entropy_xy2.direction[i].green-
       entropy_xy.direction[i].green)))));
     channel_features[BluePixelChannel].measure_of_correlation_2[i]=
-      (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].blue-
+      (sqrt(fabs(1.0-exp(-2.0*(double) (entropy_xy2.direction[i].blue-
       entropy_xy.direction[i].blue)))));
     if (image->colorspace == CMYKColorspace)
       channel_features[BlackPixelChannel].measure_of_correlation_2[i]=
-        (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].black-
+        (sqrt(fabs(1.0-exp(-2.0*(double) (entropy_xy2.direction[i].black-
         entropy_xy.direction[i].black)))));
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       channel_features[AlphaPixelChannel].measure_of_correlation_2[i]=
-        (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].alpha-
+        (sqrt(fabs(1.0-exp(-2.0*(double) (entropy_xy2.direction[i].alpha-
         entropy_xy.direction[i].alpha)))));
   }
   /*
@@ -1645,7 +1640,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
               pixel.direction[i].blue+=cooccurrence[x][y].direction[i].blue;
               if (image->colorspace == CMYKColorspace)
                 pixel.direction[i].black+=cooccurrence[x][y].direction[i].black;
-              if (image->alpha_trait == BlendPixelTrait)
+              if (image->alpha_trait != UndefinedPixelTrait)
                 pixel.direction[i].alpha+=
                   cooccurrence[x][y].direction[i].alpha;
             }
@@ -1665,7 +1660,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
             Q[z][y].direction[i].black+=cooccurrence[z][x].direction[i].black*
               cooccurrence[y][x].direction[i].black/
               density_x[z].direction[i].black/density_y[x].direction[i].black;
-          if (image->alpha_trait == BlendPixelTrait)
+          if (image->alpha_trait != UndefinedPixelTrait)
             Q[z][y].direction[i].alpha+=
               cooccurrence[z][x].direction[i].alpha*
               cooccurrence[y][x].direction[i].alpha/
@@ -1682,7 +1677,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       if (image->colorspace == CMYKColorspace)
         channel_features[BlackPixelChannel].contrast[i]+=z*z*
           pixel.direction[i].black;
-      if (image->alpha_trait == BlendPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         channel_features[AlphaPixelChannel].contrast[i]+=z*z*
           pixel.direction[i].alpha;
     }
@@ -1699,7 +1694,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     if (image->colorspace == CMYKColorspace)
       channel_features[BlackPixelChannel].maximum_correlation_coefficient[i]=
         sqrt((double) -1.0);
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       channel_features[AlphaPixelChannel].maximum_correlation_coefficient[i]=
         sqrt((double) -1.0);
   }
@@ -1778,8 +1773,8 @@ MagickExport Image *HoughLineImage(const Image *image,const size_t width,
     *image_view;
 
   char
-    message[MaxTextExtent],
-    path[MaxTextExtent];
+    message[MagickPathExtent],
+    path[MagickPathExtent];
 
   const char
     *artifact;
@@ -1820,11 +1815,11 @@ MagickExport Image *HoughLineImage(const Image *image,const size_t width,
     Create the accumulator.
   */
   assert(image != (const Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   assert(exception != (ExceptionInfo *) NULL);
-  assert(exception->signature == MagickSignature);
+  assert(exception->signature == MagickCoreSignature);
   accumulator_width=180;
   hough_height=((sqrt(2.0)*(double) (image->rows > image->columns ?
     image->rows : image->columns))/2.0);
@@ -1864,7 +1859,7 @@ MagickExport Image *HoughLineImage(const Image *image,const size_t width,
       }
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      if (GetPixelIntensity(image,p) > (QuantumRange/2))
+      if (GetPixelIntensity(image,p) > (QuantumRange/2.0))
         {
           register ssize_t
             i;
@@ -1915,12 +1910,12 @@ MagickExport Image *HoughLineImage(const Image *image,const size_t width,
       accumulator=DestroyMatrixInfo(accumulator);
       return((Image *) NULL);
     }
-  (void) FormatLocaleString(message,MaxTextExtent,
+  (void) FormatLocaleString(message,MagickPathExtent,
     "# Hough line transform: %.20gx%.20g%+.20g\n",(double) width,
     (double) height,(double) threshold);
   if (write(file,message,strlen(message)) != (ssize_t) strlen(message))
     status=MagickFalse;
-  (void) FormatLocaleString(message,MaxTextExtent,"viewbox 0 0 %.20g %.20g\n",
+  (void) FormatLocaleString(message,MagickPathExtent,"viewbox 0 0 %.20g %.20g\n",
     (double) image->columns,(double) image->rows);
   if (write(file,message,strlen(message)) != (ssize_t) strlen(message))
     status=MagickFalse;
@@ -2004,7 +1999,7 @@ MagickExport Image *HoughLineImage(const Image *image,const size_t width,
                 (image->rows/2.0))*sin(DegreesToRadians((double) x))))/
                 cos(DegreesToRadians((double) x))+(image->columns/2.0);
             }
-          (void) FormatLocaleString(message,MaxTextExtent,
+          (void) FormatLocaleString(message,MagickPathExtent,
             "line %g,%g %g,%g  # %g\n",line.x1,line.y1,line.x2,line.y2,maxima);
           if (write(file,message,strlen(message)) != (ssize_t) strlen(message))
             status=MagickFalse;
@@ -2017,7 +2012,7 @@ MagickExport Image *HoughLineImage(const Image *image,const size_t width,
   */
   image_info=AcquireImageInfo();
   image_info->background_color=image->background_color;
-  (void) FormatLocaleString(image_info->filename,MaxTextExtent,"mvg:%s",path);
+  (void) FormatLocaleString(image_info->filename,MagickPathExtent,"mvg:%s",path);
   artifact=GetImageArtifact(image,"background");
   if (artifact != (const char *) NULL)
     (void) SetImageOption(image_info,"background",artifact);
@@ -2115,11 +2110,11 @@ MagickExport Image *MeanShiftImage(const Image *image,const size_t width,
     y;
 
   assert(image != (const Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   assert(exception != (ExceptionInfo *) NULL);
-  assert(exception->signature == MagickSignature);
+  assert(exception->signature == MagickCoreSignature);
   mean_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
   if (mean_image == (Image *) NULL)
     return((Image *) NULL);