]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/feature.c
(no commit message)
[imagemagick] / MagickCore / feature.c
index bc1f0d0fe8e9b7c9c2e26621b71a5617a6487149..39163a31bca85e80330790e433838da6c730f6d3 100644 (file)
@@ -17,7 +17,7 @@
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2012 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  %
 %  access the red channel contrast, for example, like this:
 %
 %      channel_features=GetImageFeatures(image,1,exception);
-%      contrast=channel_features[RedChannel].contrast[0];
+%      contrast=channel_features[RedPixelChannel].contrast[0];
 %
 %  Use MagickRelinquishMemory() to free the features buffer.
 %
@@ -140,7 +140,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
 {
   typedef struct _ChannelStatistics
   {
-    DoublePixelPacket
+    PixelInfo
       direction[4];  /* horizontal, vertical, left and right diagonals */
   } ChannelStatistics;
 
@@ -167,7 +167,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     sum_squares,
     variance;
 
-  LongPixelPacket
+  PixelPacket
     gray,
     *grays;
 
@@ -181,8 +181,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     length;
 
   ssize_t
-    y,
-    z;
+    y;
 
   unsigned int
     number_grays;
@@ -203,13 +202,13 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
   /*
     Form grays.
   */
-  grays=(LongPixelPacket *) AcquireQuantumMemory(MaxMap+1UL,sizeof(*grays));
-  if (grays == (LongPixelPacket *) NULL)
+  grays=(PixelPacket *) AcquireQuantumMemory(MaxMap+1UL,sizeof(*grays));
+  if (grays == (PixelPacket *) NULL)
     {
       channel_features=(ChannelFeatures *) RelinquishMagickMemory(
         channel_features);
       (void) ThrowMagickException(exception,GetMagickModule(),
-        ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+        ResourceLimitError,"MemoryAllocationFailed","'%s'",image->filename);
       return(channel_features);
     }
   for (i=0; i <= (ssize_t) MaxMap; i++)
@@ -221,9 +220,9 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     grays[i].black=(~0U);
   }
   status=MagickTrue;
-  image_view=AcquireCacheView(image);
+  image_view=AcquireVirtualCacheView(image,exception);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(dynamic,4) shared(status)
+  #pragma omp parallel for schedule(static,4) shared(status)
 #endif
   for (y=0; y < (ssize_t) image->rows; y++)
   {
@@ -261,7 +260,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
   image_view=DestroyCacheView(image_view);
   if (status == MagickFalse)
     {
-      grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+      grays=(PixelPacket *) RelinquishMagickMemory(grays);
       channel_features=(ChannelFeatures *) RelinquishMagickMemory(
         channel_features);
       return(channel_features);
@@ -335,11 +334,11 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
           cooccurrence=(ChannelStatistics **) RelinquishMagickMemory(
             cooccurrence);
         }
-      grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+      grays=(PixelPacket *) RelinquishMagickMemory(grays);
       channel_features=(ChannelFeatures *) RelinquishMagickMemory(
         channel_features);
       (void) ThrowMagickException(exception,GetMagickModule(),
-        ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+        ResourceLimitError,"MemoryAllocationFailed","'%s'",image->filename);
       return(channel_features);
     }
   (void) ResetMagickMemory(&correlation,0,sizeof(correlation));
@@ -384,18 +383,18 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       density_y=(ChannelStatistics *) RelinquishMagickMemory(density_y);
       density_xy=(ChannelStatistics *) RelinquishMagickMemory(density_xy);
       density_x=(ChannelStatistics *) RelinquishMagickMemory(density_x);
-      grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+      grays=(PixelPacket *) RelinquishMagickMemory(grays);
       channel_features=(ChannelFeatures *) RelinquishMagickMemory(
         channel_features);
       (void) ThrowMagickException(exception,GetMagickModule(),
-        ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+        ResourceLimitError,"MemoryAllocationFailed","'%s'",image->filename);
       return(channel_features);
     }
   /*
     Initialize spatial dependence matrix.
   */
   status=MagickTrue;
-  image_view=AcquireCacheView(image);
+  image_view=AcquireVirtualCacheView(image,exception);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
     register const Quantum
@@ -413,7 +412,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     if (status == MagickFalse)
       continue;
     p=GetCacheViewVirtualPixels(image_view,-(ssize_t) distance,y,image->columns+
-      2*distance,distance+1,exception);
+      2*distance,distance+2,exception);
     if (p == (const Quantum *) NULL)
       {
         status=MagickFalse;
@@ -510,7 +509,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       p+=GetPixelChannels(image);
     }
   }
-  grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+  grays=(PixelPacket *) RelinquishMagickMemory(grays);
   image_view=DestroyCacheView(image_view);
   if (status == MagickFalse)
     {
@@ -521,7 +520,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       channel_features=(ChannelFeatures *) RelinquishMagickMemory(
         channel_features);
       (void) ThrowMagickException(exception,GetMagickModule(),
-        ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+        ResourceLimitError,"MemoryAllocationFailed","'%s'",image->filename);
       return(channel_features);
     }
   /*
@@ -593,7 +592,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     Compute texture features.
   */
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(dynamic,4) shared(status)
+  #pragma omp parallel for schedule(static,4) shared(status)
 #endif
   for (i=0; i < 4; i++)
   {
@@ -610,21 +609,21 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         /*
           Angular second moment:  measure of homogeneity of the image.
         */
-        channel_features[RedChannel].angular_second_moment[i]+=
+        channel_features[RedPixelChannel].angular_second_moment[i]+=
           cooccurrence[x][y].direction[i].red*
           cooccurrence[x][y].direction[i].red;
-        channel_features[GreenChannel].angular_second_moment[i]+=
+        channel_features[GreenPixelChannel].angular_second_moment[i]+=
           cooccurrence[x][y].direction[i].green*
           cooccurrence[x][y].direction[i].green;
-        channel_features[BlueChannel].angular_second_moment[i]+=
+        channel_features[BluePixelChannel].angular_second_moment[i]+=
           cooccurrence[x][y].direction[i].blue*
           cooccurrence[x][y].direction[i].blue;
         if (image->colorspace == CMYKColorspace)
-          channel_features[BlackChannel].angular_second_moment[i]+=
+          channel_features[BlackPixelChannel].angular_second_moment[i]+=
             cooccurrence[x][y].direction[i].black*
             cooccurrence[x][y].direction[i].black;
         if (image->matte != MagickFalse)
-          channel_features[OpacityChannel].angular_second_moment[i]+=
+          channel_features[AlphaPixelChannel].angular_second_moment[i]+=
             cooccurrence[x][y].direction[i].alpha*
             cooccurrence[x][y].direction[i].alpha;
         /*
@@ -651,17 +650,17 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         /*
           Inverse Difference Moment.
         */
-        channel_features[RedChannel].inverse_difference_moment[i]+=
+        channel_features[RedPixelChannel].inverse_difference_moment[i]+=
           cooccurrence[x][y].direction[i].red/((y-x)*(y-x)+1);
-        channel_features[GreenChannel].inverse_difference_moment[i]+=
+        channel_features[GreenPixelChannel].inverse_difference_moment[i]+=
           cooccurrence[x][y].direction[i].green/((y-x)*(y-x)+1);
-        channel_features[BlueChannel].inverse_difference_moment[i]+=
+        channel_features[BluePixelChannel].inverse_difference_moment[i]+=
           cooccurrence[x][y].direction[i].blue/((y-x)*(y-x)+1);
         if (image->colorspace == CMYKColorspace)
-          channel_features[BlackChannel].inverse_difference_moment[i]+=
+          channel_features[BlackPixelChannel].inverse_difference_moment[i]+=
             cooccurrence[x][y].direction[i].black/((y-x)*(y-x)+1);
         if (image->matte != MagickFalse)
-          channel_features[OpacityChannel].inverse_difference_moment[i]+=
+          channel_features[AlphaPixelChannel].inverse_difference_moment[i]+=
             cooccurrence[x][y].direction[i].alpha/((y-x)*(y-x)+1);
         /*
           Sum average.
@@ -681,21 +680,21 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
         /*
           Entropy.
         */
-        channel_features[RedChannel].entropy[i]-=
+        channel_features[RedPixelChannel].entropy[i]-=
           cooccurrence[x][y].direction[i].red*
           log10(cooccurrence[x][y].direction[i].red+MagickEpsilon);
-        channel_features[GreenChannel].entropy[i]-=
+        channel_features[GreenPixelChannel].entropy[i]-=
           cooccurrence[x][y].direction[i].green*
           log10(cooccurrence[x][y].direction[i].green+MagickEpsilon);
-        channel_features[BlueChannel].entropy[i]-=
+        channel_features[BluePixelChannel].entropy[i]-=
           cooccurrence[x][y].direction[i].blue*
           log10(cooccurrence[x][y].direction[i].blue+MagickEpsilon);
         if (image->colorspace == CMYKColorspace)
-          channel_features[BlackChannel].entropy[i]-=
+          channel_features[BlackPixelChannel].entropy[i]-=
             cooccurrence[x][y].direction[i].black*
             log10(cooccurrence[x][y].direction[i].black+MagickEpsilon);
         if (image->matte != MagickFalse)
-          channel_features[OpacityChannel].entropy[i]-=
+          channel_features[AlphaPixelChannel].entropy[i]-=
             cooccurrence[x][y].direction[i].alpha*
             log10(cooccurrence[x][y].direction[i].alpha+MagickEpsilon);
         /*
@@ -740,33 +739,33 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     /*
       Correlation: measure of linear-dependencies in the image.
     */
-    channel_features[RedChannel].correlation[i]=
+    channel_features[RedPixelChannel].correlation[i]=
       (correlation.direction[i].red-mean.direction[i].red*
       mean.direction[i].red)/(sqrt(sum_squares.direction[i].red-
       (mean.direction[i].red*mean.direction[i].red))*sqrt(
       sum_squares.direction[i].red-(mean.direction[i].red*
       mean.direction[i].red)));
-    channel_features[GreenChannel].correlation[i]=
+    channel_features[GreenPixelChannel].correlation[i]=
       (correlation.direction[i].green-mean.direction[i].green*
       mean.direction[i].green)/(sqrt(sum_squares.direction[i].green-
       (mean.direction[i].green*mean.direction[i].green))*sqrt(
       sum_squares.direction[i].green-(mean.direction[i].green*
       mean.direction[i].green)));
-    channel_features[BlueChannel].correlation[i]=
+    channel_features[BluePixelChannel].correlation[i]=
       (correlation.direction[i].blue-mean.direction[i].blue*
       mean.direction[i].blue)/(sqrt(sum_squares.direction[i].blue-
       (mean.direction[i].blue*mean.direction[i].blue))*sqrt(
       sum_squares.direction[i].blue-(mean.direction[i].blue*
       mean.direction[i].blue)));
     if (image->colorspace == CMYKColorspace)
-      channel_features[BlackChannel].correlation[i]=
+      channel_features[BlackPixelChannel].correlation[i]=
         (correlation.direction[i].black-mean.direction[i].black*
         mean.direction[i].black)/(sqrt(sum_squares.direction[i].black-
         (mean.direction[i].black*mean.direction[i].black))*sqrt(
         sum_squares.direction[i].black-(mean.direction[i].black*
         mean.direction[i].black)));
     if (image->matte != MagickFalse)
-      channel_features[OpacityChannel].correlation[i]=
+      channel_features[AlphaPixelChannel].correlation[i]=
         (correlation.direction[i].alpha-mean.direction[i].alpha*
         mean.direction[i].alpha)/(sqrt(sum_squares.direction[i].alpha-
         (mean.direction[i].alpha*mean.direction[i].alpha))*sqrt(
@@ -777,7 +776,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     Compute more texture features.
   */
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(dynamic,4) shared(status)
+  #pragma omp parallel for schedule(static,4) shared(status)
 #endif
   for (i=0; i < 4; i++)
   {
@@ -789,62 +788,62 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       /*
         Sum average.
       */
-      channel_features[RedChannel].sum_average[i]+=
+      channel_features[RedPixelChannel].sum_average[i]+=
         x*density_xy[x].direction[i].red;
-      channel_features[GreenChannel].sum_average[i]+=
+      channel_features[GreenPixelChannel].sum_average[i]+=
         x*density_xy[x].direction[i].green;
-      channel_features[BlueChannel].sum_average[i]+=
+      channel_features[BluePixelChannel].sum_average[i]+=
         x*density_xy[x].direction[i].blue;
       if (image->colorspace == CMYKColorspace)
-        channel_features[BlackChannel].sum_average[i]+=
+        channel_features[BlackPixelChannel].sum_average[i]+=
           x*density_xy[x].direction[i].black;
       if (image->matte != MagickFalse)
-        channel_features[OpacityChannel].sum_average[i]+=
+        channel_features[AlphaPixelChannel].sum_average[i]+=
           x*density_xy[x].direction[i].alpha;
       /*
         Sum entropy.
       */
-      channel_features[RedChannel].sum_entropy[i]-=
+      channel_features[RedPixelChannel].sum_entropy[i]-=
         density_xy[x].direction[i].red*
         log10(density_xy[x].direction[i].red+MagickEpsilon);
-      channel_features[GreenChannel].sum_entropy[i]-=
+      channel_features[GreenPixelChannel].sum_entropy[i]-=
         density_xy[x].direction[i].green*
         log10(density_xy[x].direction[i].green+MagickEpsilon);
-      channel_features[BlueChannel].sum_entropy[i]-=
+      channel_features[BluePixelChannel].sum_entropy[i]-=
         density_xy[x].direction[i].blue*
         log10(density_xy[x].direction[i].blue+MagickEpsilon);
       if (image->colorspace == CMYKColorspace)
-        channel_features[BlackChannel].sum_entropy[i]-=
+        channel_features[BlackPixelChannel].sum_entropy[i]-=
           density_xy[x].direction[i].black*
           log10(density_xy[x].direction[i].black+MagickEpsilon);
       if (image->matte != MagickFalse)
-        channel_features[OpacityChannel].sum_entropy[i]-=
+        channel_features[AlphaPixelChannel].sum_entropy[i]-=
           density_xy[x].direction[i].alpha*
           log10(density_xy[x].direction[i].alpha+MagickEpsilon);
       /*
         Sum variance.
       */
-      channel_features[RedChannel].sum_variance[i]+=
-        (x-channel_features[RedChannel].sum_entropy[i])*
-        (x-channel_features[RedChannel].sum_entropy[i])*
+      channel_features[RedPixelChannel].sum_variance[i]+=
+        (x-channel_features[RedPixelChannel].sum_entropy[i])*
+        (x-channel_features[RedPixelChannel].sum_entropy[i])*
         density_xy[x].direction[i].red;
-      channel_features[GreenChannel].sum_variance[i]+=
-        (x-channel_features[GreenChannel].sum_entropy[i])*
-        (x-channel_features[GreenChannel].sum_entropy[i])*
+      channel_features[GreenPixelChannel].sum_variance[i]+=
+        (x-channel_features[GreenPixelChannel].sum_entropy[i])*
+        (x-channel_features[GreenPixelChannel].sum_entropy[i])*
         density_xy[x].direction[i].green;
-      channel_features[BlueChannel].sum_variance[i]+=
-        (x-channel_features[BlueChannel].sum_entropy[i])*
-        (x-channel_features[BlueChannel].sum_entropy[i])*
+      channel_features[BluePixelChannel].sum_variance[i]+=
+        (x-channel_features[BluePixelChannel].sum_entropy[i])*
+        (x-channel_features[BluePixelChannel].sum_entropy[i])*
         density_xy[x].direction[i].blue;
       if (image->colorspace == CMYKColorspace)
-        channel_features[BlackChannel].sum_variance[i]+=
-          (x-channel_features[BlackChannel].sum_entropy[i])*
-          (x-channel_features[BlackChannel].sum_entropy[i])*
+        channel_features[BlackPixelChannel].sum_variance[i]+=
+          (x-channel_features[BlackPixelChannel].sum_entropy[i])*
+          (x-channel_features[BlackPixelChannel].sum_entropy[i])*
           density_xy[x].direction[i].black;
       if (image->matte != MagickFalse)
-        channel_features[OpacityChannel].sum_variance[i]+=
-          (x-channel_features[OpacityChannel].sum_entropy[i])*
-          (x-channel_features[OpacityChannel].sum_entropy[i])*
+        channel_features[AlphaPixelChannel].sum_variance[i]+=
+          (x-channel_features[AlphaPixelChannel].sum_entropy[i])*
+          (x-channel_features[AlphaPixelChannel].sum_entropy[i])*
           density_xy[x].direction[i].alpha;
     }
   }
@@ -852,7 +851,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     Compute more texture features.
   */
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(dynamic,4) shared(status)
+  #pragma omp parallel for schedule(static,4) shared(status)
 #endif
   for (i=0; i < 4; i++)
   {
@@ -953,17 +952,17 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
             MagickEpsilon));
       }
     }
-    channel_features[RedChannel].variance_sum_of_squares[i]=
+    channel_features[RedPixelChannel].variance_sum_of_squares[i]=
       variance.direction[i].red;
-    channel_features[GreenChannel].variance_sum_of_squares[i]=
+    channel_features[GreenPixelChannel].variance_sum_of_squares[i]=
       variance.direction[i].green;
-    channel_features[BlueChannel].variance_sum_of_squares[i]=
+    channel_features[BluePixelChannel].variance_sum_of_squares[i]=
       variance.direction[i].blue;
     if (image->colorspace == CMYKColorspace)
-      channel_features[RedChannel].variance_sum_of_squares[i]=
+      channel_features[BlackPixelChannel].variance_sum_of_squares[i]=
         variance.direction[i].black;
     if (image->matte != MagickFalse)
-      channel_features[RedChannel].variance_sum_of_squares[i]=
+      channel_features[AlphaPixelChannel].variance_sum_of_squares[i]=
         variance.direction[i].alpha;
   }
   /*
@@ -972,7 +971,7 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
   (void) ResetMagickMemory(&variance,0,sizeof(variance));
   (void) ResetMagickMemory(&sum_squares,0,sizeof(sum_squares));
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(dynamic,4) shared(status)
+  #pragma omp parallel for schedule(static,4) shared(status)
 #endif
   for (i=0; i < 4; i++)
   {
@@ -1006,21 +1005,21 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
       /*
         Difference entropy.
       */
-      channel_features[RedChannel].difference_entropy[i]-=
+      channel_features[RedPixelChannel].difference_entropy[i]-=
         density_xy[x].direction[i].red*
         log10(density_xy[x].direction[i].red+MagickEpsilon);
-      channel_features[GreenChannel].difference_entropy[i]-=
+      channel_features[GreenPixelChannel].difference_entropy[i]-=
         density_xy[x].direction[i].green*
         log10(density_xy[x].direction[i].green+MagickEpsilon);
-      channel_features[BlueChannel].difference_entropy[i]-=
+      channel_features[BluePixelChannel].difference_entropy[i]-=
         density_xy[x].direction[i].blue*
         log10(density_xy[x].direction[i].blue+MagickEpsilon);
       if (image->colorspace == CMYKColorspace)
-        channel_features[BlackChannel].difference_entropy[i]-=
+        channel_features[BlackPixelChannel].difference_entropy[i]-=
           density_xy[x].direction[i].black*
           log10(density_xy[x].direction[i].black+MagickEpsilon);
       if (image->matte != MagickFalse)
-        channel_features[OpacityChannel].difference_entropy[i]-=
+        channel_features[AlphaPixelChannel].difference_entropy[i]-=
           density_xy[x].direction[i].alpha*
           log10(density_xy[x].direction[i].alpha+MagickEpsilon);
       /*
@@ -1054,68 +1053,68 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     /*
       Difference variance.
     */
-    channel_features[RedChannel].difference_variance[i]=
+    channel_features[RedPixelChannel].difference_variance[i]=
       (((double) number_grays*number_grays*sum_squares.direction[i].red)-
       (variance.direction[i].red*variance.direction[i].red))/
       ((double) number_grays*number_grays*number_grays*number_grays);
-    channel_features[GreenChannel].difference_variance[i]=
+    channel_features[GreenPixelChannel].difference_variance[i]=
       (((double) number_grays*number_grays*sum_squares.direction[i].green)-
       (variance.direction[i].green*variance.direction[i].green))/
       ((double) number_grays*number_grays*number_grays*number_grays);
-    channel_features[BlueChannel].difference_variance[i]=
+    channel_features[BluePixelChannel].difference_variance[i]=
       (((double) number_grays*number_grays*sum_squares.direction[i].blue)-
       (variance.direction[i].blue*variance.direction[i].blue))/
       ((double) number_grays*number_grays*number_grays*number_grays);
     if (image->colorspace == CMYKColorspace)
-      channel_features[BlackChannel].difference_variance[i]=
+      channel_features[BlackPixelChannel].difference_variance[i]=
         (((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->matte != MagickFalse)
-      channel_features[OpacityChannel].difference_variance[i]=
+      channel_features[AlphaPixelChannel].difference_variance[i]=
         (((double) number_grays*number_grays*sum_squares.direction[i].alpha)-
         (variance.direction[i].alpha*variance.direction[i].alpha))/
         ((double) number_grays*number_grays*number_grays*number_grays);
     /*
       Information Measures of Correlation.
     */
-    channel_features[RedChannel].measure_of_correlation_1[i]=
+    channel_features[RedPixelChannel].measure_of_correlation_1[i]=
       (entropy_xy.direction[i].red-entropy_xy1.direction[i].red)/
       (entropy_x.direction[i].red > entropy_y.direction[i].red ?
        entropy_x.direction[i].red : entropy_y.direction[i].red);
-    channel_features[GreenChannel].measure_of_correlation_1[i]=
+    channel_features[GreenPixelChannel].measure_of_correlation_1[i]=
       (entropy_xy.direction[i].green-entropy_xy1.direction[i].green)/
       (entropy_x.direction[i].green > entropy_y.direction[i].green ?
        entropy_x.direction[i].green : entropy_y.direction[i].green);
-    channel_features[BlueChannel].measure_of_correlation_1[i]=
+    channel_features[BluePixelChannel].measure_of_correlation_1[i]=
       (entropy_xy.direction[i].blue-entropy_xy1.direction[i].blue)/
       (entropy_x.direction[i].blue > entropy_y.direction[i].blue ?
        entropy_x.direction[i].blue : entropy_y.direction[i].blue);
     if (image->colorspace == CMYKColorspace)
-      channel_features[BlackChannel].measure_of_correlation_1[i]=
+      channel_features[BlackPixelChannel].measure_of_correlation_1[i]=
         (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->matte != MagickFalse)
-      channel_features[OpacityChannel].measure_of_correlation_1[i]=
+      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[RedChannel].measure_of_correlation_2[i]=
+    channel_features[RedPixelChannel].measure_of_correlation_2[i]=
       (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].red-
       entropy_xy.direction[i].red)))));
-    channel_features[GreenChannel].measure_of_correlation_2[i]=
+    channel_features[GreenPixelChannel].measure_of_correlation_2[i]=
       (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].green-
       entropy_xy.direction[i].green)))));
-    channel_features[BlueChannel].measure_of_correlation_2[i]=
+    channel_features[BluePixelChannel].measure_of_correlation_2[i]=
       (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].blue-
       entropy_xy.direction[i].blue)))));
     if (image->colorspace == CMYKColorspace)
-      channel_features[BlackChannel].measure_of_correlation_2[i]=
+      channel_features[BlackPixelChannel].measure_of_correlation_2[i]=
         (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].black-
         entropy_xy.direction[i].black)))));
     if (image->matte != MagickFalse)
-      channel_features[OpacityChannel].measure_of_correlation_2[i]=
+      channel_features[AlphaPixelChannel].measure_of_correlation_2[i]=
         (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].alpha-
         entropy_xy.direction[i].alpha)))));
   }
@@ -1123,10 +1122,13 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
     Compute more texture features.
   */
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(dynamic,4) shared(status)
+  #pragma omp parallel for schedule(static,4) shared(status)
 #endif
   for (i=0; i < 4; i++)
   {
+    ssize_t
+      z;
+
     for (z=0; z < (ssize_t) number_grays; z++)
     {
       register ssize_t
@@ -1181,31 +1183,34 @@ MagickExport ChannelFeatures *GetImageFeatures(const Image *image,
               density_y[x].direction[i].alpha;
         }
       }
-      channel_features[RedChannel].contrast[i]+=z*z*pixel.direction[i].red;
-      channel_features[GreenChannel].contrast[i]+=z*z*pixel.direction[i].green;
-      channel_features[BlueChannel].contrast[i]+=z*z*pixel.direction[i].blue;
+      channel_features[RedPixelChannel].contrast[i]+=z*z*
+        pixel.direction[i].red;
+      channel_features[GreenPixelChannel].contrast[i]+=z*z*
+        pixel.direction[i].green;
+      channel_features[BluePixelChannel].contrast[i]+=z*z*
+        pixel.direction[i].blue;
       if (image->colorspace == CMYKColorspace)
-        channel_features[BlackChannel].contrast[i]+=z*z*
+        channel_features[BlackPixelChannel].contrast[i]+=z*z*
           pixel.direction[i].black;
       if (image->matte != MagickFalse)
-        channel_features[OpacityChannel].contrast[i]+=z*z*
+        channel_features[AlphaPixelChannel].contrast[i]+=z*z*
           pixel.direction[i].alpha;
     }
     /*
       Maximum Correlation Coefficient.
       Future: return second largest eigenvalue of Q.
     */
-    channel_features[RedChannel].maximum_correlation_coefficient[i]=
+    channel_features[RedPixelChannel].maximum_correlation_coefficient[i]=
       sqrt((double) -1.0);
-    channel_features[GreenChannel].maximum_correlation_coefficient[i]=
+    channel_features[GreenPixelChannel].maximum_correlation_coefficient[i]=
       sqrt((double) -1.0);
-    channel_features[BlueChannel].maximum_correlation_coefficient[i]=
+    channel_features[BluePixelChannel].maximum_correlation_coefficient[i]=
       sqrt((double) -1.0);
     if (image->colorspace == CMYKColorspace)
-      channel_features[BlackChannel].maximum_correlation_coefficient[i]=
+      channel_features[BlackPixelChannel].maximum_correlation_coefficient[i]=
         sqrt((double) -1.0);
     if (image->matte != MagickFalse)
-      channel_features[OpacityChannel].maximum_correlation_coefficient[i]=
+      channel_features[AlphaPixelChannel].maximum_correlation_coefficient[i]=
         sqrt((double) -1.0);
   }
   /*