Blur correctness problem

I noticed, that gaussian blur or similar convolution matrix works somehow unevenly at contrast edges, between light and dark areas. When filter applies… literally, light pushes darkness a bit. Best way to see it in gimp - create copy of layer to be blured and invert (I used non-linear inversion). Blur both, then reverse copy back. Difference should be visible when toggling second layer. Comparing each other, both have disbalance, but in second (which was reversed), darkness wins (sic).

It seems to be problem of any approach, where additive/subtractive only approach is used. For example, if not this issue, sharpening, applied after blur so, that it exactly negates blur, should restore almost original image. Instead - when I did such experiment with white-on-black text (rendered grayscale), text became slightly bolder after sharpening. For most grotesque effect (on gimp) sharpening could be applied to negative while blur is not (or first negated than normal).

Now about blur solution. I got almost even blur by blending second layer (blured while negated) with 50% transparency. However - despite of visually correct margins, I’m not sure is it same about resulting blur size. More what I’m exactly sure in - this approach seems mismatch for sharpening.

I wonder, are there better approaches, probably differing by blending or each blured pixel?

At the moment of writing this - I forgot another test: blur could be applied after reversions pair (1 - linear, 2 - non-linear), which is also repeated after blur, but in reverse order (linear is second). At this moment my system undergoes full upgrade (I use gentoo-based distro), and I just noticed, that gimp doesn’t show gui (could be due to immense system load though), so I have no even illustrations yet.

What is your working color space?

@nick87720z Welcome to the forum!

Provide us with as much info as you can.
1 Software and versions: OS, GIMP, etc.
2 Your exact tools and parameters, blend modes, settings, etc.

Since you are a new member, you might have to write a few more posts before you may drag and drop files into the post…

Color space - I’m not sure is it default, but as far as I remember it is sRGB.

For software - I use calculate (gentoo based), but with full source-build profile.
gimp-2.10.12, gegl-0.4.16, right from gentoo portage.

Btw, one more detail about image: it is created from 50 photo sequence from smartphone (thanks for FreeDCam), joined with align_image_stack and hugin_stacker. Although, for illustration I could use just raster, generated from inkscape (I think to try again imagemagick, since there are examples with all necessary cli switches).

Edit: About starting conditions. When I load hugin/NR output (tif), it is 8-bpc non-linear colorspace. In this case I do everything in 32-bit FP, which automatically proposes linear colorspace (I’m not yet enough skilled to override such things).

I managed to run gimp, but not for long - its gui frozen at some operation, so I had to kill it. So, here is what I found (if it were programming forum, I would have to be in “Newbie programmers” section :slight_smile: ).

There seem to be some mess in color spacing between different tools. When I finally made second approach with same image (inv_lin, inv_nonlin, then blur) - I really got same image as when I did blur to negative, resulting from non-linear inversion (if course I had to do reverse color conversion for comparison).

Also did some experiments with test image - black/white stripes of equal width. When I do gaussian blur (tried 4pix strips with 1pix blur and 8pix stripes with 2pix blur), white in black stripes seem to be bolder than black on white… but of course, it is just due to color perception. Equality appears after doing lin->nonlin inversions pair. It seems, that gaussian blur itself could use same color space parameter, as e.g. gradients do (if only gradients honored it, too bad I did not pay attention to check for such option in blur, before new gimp crash).

It doesn’t make sence, what’s image bitdepth/colorspace-type (lin/nonlin) - all operations work in same way.