Hi:

I saw the mail about small blurs, remembered what I tried months ago
when talking on IRC (blur 1 vs 1.5) and decided to investigate /
test. Changed the filters to allow up to 0.1, and it works, the
description was wrong. Also checking more source found that
gaussian_blur_region allows anything above 0.0. Changed to allow
anything above 0.0, and let the user see if it makes sense.

Searching I also discovered the reason to do two passes instead of a
big single matrix, decomposition of matrices. If someone is interested
check: http://www.engin.umd.umich.edu/~jwvm/ece581/21_GBlur.pdf

Important: current widget does not allow float pixels (I think that
was the reason I gave up with the 1 vs 1.5 test), so to use this
feature one must change to some unit that allows and do some maths.
The easy case is a 72 DPI image, cos then 1 pix = 1 point (pt), and
this unit allows one decimal digit (so you can blur 0.5 or 2.2).
Reported in http://bugzilla.gnome.org/show_bug.cgi?id=91648 to see if
"float pixels" can be fixed before 1.4, it would be pretty nice.

I include the patches against CVS HEAD and a xcf.gz that demos 1.0 pt
vs 0.1 pt (aka pixels here). Use the color picker or info window,
there are differences in the area that looks like plain black and
white. See http://bugzilla.gnome.org/show_bug.cgi?id=91647

Index: plug-ins/common/gauss_iir.c
===================================================================
RCS file: /cvs/gnome/gimp/plug-ins/common/gauss_iir.c,v
retrieving revision 1.41
diff -u -p -r1.41 gauss_iir.c
--- plug-ins/common/gauss_iir.c 4 Aug 2002 15:27:04 -0000       1.41
+++ plug-ins/common/gauss_iir.c 25 Aug 2002 16:49:05 -0000
@@ -126,7 +126,7 @@ query (void)
     { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
     { GIMP_PDB_IMAGE, "image", "Input image (unused)" },
     { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
-    { GIMP_PDB_FLOAT, "radius", "Radius of gaussian blur (in pixels > 1.0)" },
+    { GIMP_PDB_FLOAT, "radius", "Radius of gaussian blur (in pixels > 0.0)" },
     { GIMP_PDB_INT32, "horizontal", "Blur in horizontal direction" },
     { GIMP_PDB_INT32, "vertical", "Blur in vertical direction" }
   };
@@ -150,9 +150,8 @@ query (void)
                          "independently invoked by specifying only one to "
                          "run.  The IIR gaussian blurring works best for "
                          "large radius values and for images which are not "
-                         "computer-generated.  Values for radius less than "
-                         "1.0 are invalid as they will generate spurious "
-                         "results.",
+                         "computer-generated.  Values for radius 0.0 are"
+                         "invalid as they will generate spurious results.",
                          "Spencer Kimball & Peter Mattis",
                          "Spencer Kimball & Peter Mattis",
                          "1995-1996",
@@ -172,9 +171,8 @@ query (void)
                          "horizontal and the vertical direction. The IIR "
                          "gaussian blurring works best for large radius "
                          "values and for images which are not "
-                         "computer-generated.  Values for radii less than "
-                         "1.0 would generate spurious results. Therefore "
-                         "they are interpreted as 0.0, which means that the "
+                         "computer-generated.  Values for radii 0.0 "
+                         "would generate spurious results. Therefore "
                          "computation for this orientation is skipped.",
                          "Spencer Kimball, Peter Mattis & Sven Neumann",
                          "Spencer Kimball, Peter Mattis & Sven Neumann",
@@ -235,7 +233,7 @@ run (gchar      *name,
              bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
              bvals.vertical   = (param[5].data.d_int32) ? TRUE : FALSE;
            }
-         if (status == GIMP_PDB_SUCCESS && (bvals.radius < 1.0))
+         if (status == GIMP_PDB_SUCCESS && (bvals.radius <= 0.0))
            status = GIMP_PDB_CALLING_ERROR;
          INIT_I18N();
          break;
@@ -279,7 +277,7 @@ run (gchar      *name,
              b2vals.horizontal = param[3].data.d_float;
              b2vals.vertical   = param[4].data.d_float;
            }
-         if (status == GIMP_PDB_SUCCESS && (b2vals.horizontal < 1.0 && 
b2vals.vertical < 1.0))
+         if (status == GIMP_PDB_SUCCESS && (b2vals.horizontal <= 0.0 && 
+b2vals.vertical <= 0.0))
            status = GIMP_PDB_CALLING_ERROR;
          break;
          
@@ -409,8 +407,8 @@ gauss_iir_dialog (void)
   gtk_widget_show (label);
 
   spinbutton = gimp_spin_button_new (&adj,
-                                    bvals.radius, 1.0, GIMP_MAX_IMAGE_SIZE,
-                                    1.0, 5.0, 0, 1, 2);
+                                    bvals.radius, 0.0, GIMP_MAX_IMAGE_SIZE,
+                                    0.0, 5.0, 0, 1, 2);
   gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, TRUE, 0);
   gtk_widget_show (spinbutton);
 
@@ -583,7 +581,7 @@ gauss_iir (GimpDrawable *drawable,
   gint *gi_tmp1, *gi_tmp2;
   gdouble std_dev;
 
-  if (horz < 1.0 && vert < 1.0)
+  if (horz <= 0.0 && vert <= 0.0)
     return;
 
   gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
@@ -611,14 +609,14 @@ gauss_iir (GimpDrawable *drawable,
                        TRUE, TRUE);
 
   progress = 0.0;
-  max_progress  = (horz < 1.0 ) ? 0 : width * height * horz;
-  max_progress += (vert < 1.0 ) ? 0 : width * height * vert;
+  max_progress  = (horz <= 0.0 ) ? 0 : width * height * horz;
+  max_progress += (vert <= 0.0 ) ? 0 : width * height * vert;
 
   if (has_alpha)
     multiply_alpha (src, height, bytes);
   
   /*  First the vertical pass  */
-  if (vert >= 1.0)
+  if (vert > 0.0)
     {    
       vert = fabs (vert) + 1.0;
       std_dev = sqrt (-(vert * vert) / (2 * log (1.0 / 255.0)));
@@ -699,7 +697,7 @@ gauss_iir (GimpDrawable *drawable,
     }
 
   /*  Now the horizontal pass  */
-if (horz >= 1.0)
+if (horz > 0.0)
     {
       horz = fabs (horz) + 1.0;
 
Index: plug-ins/common/gauss_rle.c
===================================================================
RCS file: /cvs/gnome/gimp/plug-ins/common/gauss_rle.c,v
retrieving revision 1.36
diff -u -p -r1.36 gauss_rle.c
--- plug-ins/common/gauss_rle.c 4 Aug 2002 15:27:05 -0000       1.36
+++ plug-ins/common/gauss_rle.c 25 Aug 2002 16:49:05 -0000
@@ -120,7 +120,7 @@ query (void)
     { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
     { GIMP_PDB_IMAGE, "image", "Input image (unused)" },
     { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
-    { GIMP_PDB_FLOAT, "radius", "Radius of gaussian blur (in pixels > 1.0)" },
+    { GIMP_PDB_FLOAT, "radius", "Radius of gaussian blur (in pixels > 0.0)" },
     { GIMP_PDB_INT32, "horizontal", "Blur in horizontal direction" },
     { GIMP_PDB_INT32, "vertical", "Blur in vertical direction" }
   };
@@ -145,7 +145,7 @@ query (void)
                          "run.  The RLE gaussian blurring performs most "
                          "efficiently on computer-generated images or images "
                          "with large areas of constant intensity.  Values for "
-                         "radii less than 1.0 are invalid as they would "
+                         "radii 0.0 are invalid as they would "
                          "generate spurious results.",
                          "Spencer Kimball & Peter Mattis",
                          "Spencer Kimball & Peter Mattis",
@@ -167,9 +167,8 @@ query (void)
                          "gaussian blurring performs most efficiently on "
                          "computer-generated images or images with large "
                          "areas of constant intensity.  Values for radii "
-                         "less than 1.0 would generate spurious results. "
-                         "Therefore they are interpreted as 0.0, which means "
-                         "that the computation for this orientation is "
+                         "0.0 would generate spurious results. "
+                         "Therefore the computation for this orientation is "
                          "skipped.",
                          "Spencer Kimball, Peter Mattis & Sven Neumann",
                          "Spencer Kimball, Peter Mattis & Sven Neumann",
@@ -230,7 +229,7 @@ run (gchar      *name,
              bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
              bvals.vertical = (param[5].data.d_int32) ? TRUE : FALSE;
            }
-         if (status == GIMP_PDB_SUCCESS && (bvals.radius < 1.0))
+         if (status == GIMP_PDB_SUCCESS && (bvals.radius <= 0.0))
            status = GIMP_PDB_CALLING_ERROR;
          break;
          
@@ -274,7 +273,7 @@ run (gchar      *name,
              b2vals.horizontal = param[3].data.d_float;
              b2vals.vertical   = param[4].data.d_float;
            }
-         if (status == GIMP_PDB_SUCCESS && (b2vals.horizontal < 1.0 && 
b2vals.vertical < 1.0))
+         if (status == GIMP_PDB_SUCCESS && (b2vals.horizontal <= 0.0 && 
+b2vals.vertical <= 0.0))
            status = GIMP_PDB_CALLING_ERROR;
          break;
          
@@ -404,8 +403,8 @@ gauss_rle_dialog (void)
   gtk_widget_show (label);
 
   spinbutton = gimp_spin_button_new (&adj,
-                                    bvals.radius, 1.0, GIMP_MAX_IMAGE_SIZE,
-                                    1.0, 5.0, 0, 1, 2);
+                                    bvals.radius, 0.0, GIMP_MAX_IMAGE_SIZE,
+                                    0.0, 5.0, 0, 1, 2);
   gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, TRUE, 0);
   gtk_widget_show (spinbutton);
 
@@ -576,7 +575,7 @@ gauss_rle (GimpDrawable *drawable,
   gint     initial_p, initial_m;
   gdouble  std_dev;
 
-  if (horz < 1.0 && vert < 1.0)
+  if (horz <= 0.0 && vert <= 0.0)
     return;
 
   gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
@@ -604,14 +603,14 @@ gauss_rle (GimpDrawable *drawable,
                        TRUE, TRUE);
 
   progress = 0.0;
-  max_progress  = (horz < 1.0 ) ? 0 : width * height * horz;
-  max_progress += (vert < 1.0 ) ? 0 : width * height * vert;
+  max_progress  = (horz <= 0.0 ) ? 0 : width * height * horz;
+  max_progress += (vert <= 0.0 ) ? 0 : width * height * vert;
          
   if (has_alpha)
     multiply_alpha (src, height, bytes);
 
   /*  First the vertical pass  */
-  if (vert >= 1.0)
+  if (vert > 0.0)
     {
       vert = fabs (vert) + 1.0;
       std_dev = sqrt (-(vert * vert) / (2 * log (1.0 / 255.0)));
@@ -685,7 +684,7 @@ gauss_rle (GimpDrawable *drawable,
     }
 
   /*  Now the horizontal pass  */
-  if (horz >= 1.0)
+  if (horz > 0.0)
     {
       horz = fabs (horz) + 1.0;
 
Index: plug-ins/common/sel_gauss.c
===================================================================
RCS file: /cvs/gnome/gimp/plug-ins/common/sel_gauss.c,v
retrieving revision 1.23
diff -u -p -r1.23 sel_gauss.c
--- plug-ins/common/sel_gauss.c 11 May 2002 10:33:51 -0000      1.23
+++ plug-ins/common/sel_gauss.c 25 Aug 2002 16:49:05 -0000
@@ -105,7 +105,7 @@ query (void)
     { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
     { GIMP_PDB_IMAGE, "image", "Input image (unused)" },
     { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
-    { GIMP_PDB_FLOAT, "radius", "Radius of gaussian blur (in pixels > 1.0)" },
+    { GIMP_PDB_FLOAT, "radius", "Radius of gaussian blur (in pixels > 0.0)" },
     { GIMP_PDB_INT32, "maxdelta", "Maximum delta" }
   };
 
@@ -171,7 +171,7 @@ run (gchar      *name,
          bvals.radius   = param[3].data.d_float;
          bvals.maxdelta = CLAMP (param[4].data.d_int32, 0, 255);
        }
-      if (status == GIMP_PDB_SUCCESS && (bvals.radius < 1.0))
+      if (status == GIMP_PDB_SUCCESS && (bvals.radius <= 0.0))
        status = GIMP_PDB_CALLING_ERROR;
       break;
 
@@ -264,7 +264,7 @@ sel_gauss_dialog (void)
   gtk_container_add (GTK_CONTAINER (frame), table);
 
   spinbutton = gimp_spin_button_new (&adj,
-                                    bvals.radius, 1.0, G_MAXINT, 1.0, 5.0,
+                                    bvals.radius, 0.0, G_MAXINT, 1.0, 5.0,
                                     0, 1, 2);
   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
                             _("_Blur Radius:"), 1.0, 0.5,


GSR
 
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to