RSS/Atom feed Twitter
Site is read-only, email is disabled

Blur patches and comments

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

Blur patches and comments Guillermo S. Romero / Familia Romero 25 Aug 19:15
Guillermo S. Romero / Familia Romero
2002-08-25 19:15:05 UTC (over 21 years ago)

Blur patches and comments

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 < 1.0 && b2vals.vertical < 1.0)) + if (status == GIMP_PDB_SUCCESS && (b2vals.horizontal < 1.0 && vert < 1.0) + if (horz 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 = 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 < 1.0 && b2vals.vertical < 1.0)) + if (status == GIMP_PDB_SUCCESS && (b2vals.horizontal < 1.0 && vert < 1.0) + if (horz 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 = 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 ), 1.0, 0.5,

GSR