Re: [Gimp-developer] Bug in Sobel edge detect?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday, 10 Mar 2001, Lourens Veen wrote:

> When running the Sobel edge detect on an image without a selection, the
> topmost scanline of the output is random garbage. From a very quick
> glance at the source it seems that the previous row array isn't
> initialised

Thanks for the good bug report.

It is initialised, but by passing the bogus argument -1 as a y-coord
to the pixel region function, so there's garbage returned.

Here's a patch that fixes this, relative to the sobel.c that's in
1.2.1.  Can someone stick this in stable CVS and also merge it with the
current development head.  Thanks!

Austin
------------------------------------------------------------
--- sobel.c~    Tue Aug 22 02:26:56 2000
+++ sobel.c     Sun Mar 11 14:08:36 2001
@@ -312,10 +312,10 @@
 {
   gint b;
 
-  if (y == 0)
-    gimp_pixel_rgn_get_row (pixel_rgn, data, x, (y + 1), w);
-  else if (y == pixel_rgn->h)
-    gimp_pixel_rgn_get_row (pixel_rgn, data, x, (y - 1), w);
+  if (y < 0)
+    gimp_pixel_rgn_get_row (pixel_rgn, data, x, 0, w);
+  else if (y >= pixel_rgn->h)
+    gimp_pixel_rgn_get_row (pixel_rgn, data, x, pixel_rgn->h - 1, w);
   else
     gimp_pixel_rgn_get_row (pixel_rgn, data, x, y, w);
 
@@ -384,6 +384,7 @@
 
   sobel_prepare_row (&srcPR, pr, x1, y1 - 1, (x2 - x1));
   sobel_prepare_row (&srcPR, cr, x1, y1, (x2 - x1));
+
   counter =0;
   /*  loop through the rows, applying the sobel convolution  */
   for (row = y1; row < y2; row++)


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux