]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 9 Apr 2014 23:32:39 +0000 (23:32 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 9 Apr 2014 23:32:39 +0000 (23:32 +0000)
MagickCore/effect.c

index 57433ba078796b65c571060ffd56c1e72d09d502..b56e0067b3ac377ca4bf3f1b89646912eed6adaf 100644 (file)
@@ -1139,7 +1139,7 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
         kernel_pixels+=edge_image->columns+1;
       }
       pixel.magnitude=sqrt(dx*dx+dy*dy);
-      pixel.orientation=2;
+      pixel.orientation=0;
       if (fabs(dx) > MagickEpsilon)
         {
           double
@@ -1149,22 +1149,22 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
           if (theta < 0.0)
             {
               if (theta < -2.41421356237)
-                pixel.orientation=2;
+                pixel.orientation=0;
               else
                 if (theta < -0.414213562373)
                   pixel.orientation=1;
                 else
-                  pixel.orientation=0;
+                  pixel.orientation=2;
             }
           else
             {
               if (theta > 2.41421356237)
-                pixel.orientation=2;
+                pixel.orientation=0;
               else
                 if (theta > 0.414213562373)
                   pixel.orientation=3;
                 else
-                  pixel.orientation=0;
+                  pixel.orientation=2;
             }
         }
       if (SetMatrixElement(pixel_cache,x,y,&pixel) == MagickFalse)
@@ -1215,16 +1215,16 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
         case 0:
         {
           /*
-            0 degrees.
+            0 degrees, north and south.
           */
-          (void) GetMatrixElement(pixel_cache,x-1,y,&alpha_pixel);
-          (void) GetMatrixElement(pixel_cache,x+1,y,&beta_pixel);
+          (void) GetMatrixElement(pixel_cache,x,y-1,&alpha_pixel);
+          (void) GetMatrixElement(pixel_cache,x,y+1,&beta_pixel);
           break;
         }
         case 1:
         {
           /*
-            45 degrees.
+            45 degrees, northwest and southeast.
           */
           (void) GetMatrixElement(pixel_cache,x-1,y-1,&alpha_pixel);
           (void) GetMatrixElement(pixel_cache,x+1,y+1,&beta_pixel);
@@ -1233,16 +1233,16 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius,
         case 2:
         {
           /*
-            90 degrees.
+            90 degrees, east and west.
           */
-          (void) GetMatrixElement(pixel_cache,x,y-1,&alpha_pixel);
-          (void) GetMatrixElement(pixel_cache,x,y+1,&beta_pixel);
+          (void) GetMatrixElement(pixel_cache,x-1,y,&alpha_pixel);
+          (void) GetMatrixElement(pixel_cache,x+1,y,&beta_pixel);
           break;
         }
         case 3:
         {
           /*
-            135 degrees.
+            135 degrees, northeast and southwest.
           */
           (void) GetMatrixElement(pixel_cache,x-1,y+1,&alpha_pixel);
           (void) GetMatrixElement(pixel_cache,x+1,y-1,&beta_pixel);