Proposal to add the Invert-button to Difference of Gaussians (DOG) again

In GIMP 2.10.30 there are two functions “Difference of Gaussians” (hence DOG) which are good for edge detection and also as a preparation for OCR. They are accessible through Filters → Edge-Detect → Difference of Gaussians / Difference of Gaussians (deprecated older function). The older version has additional options Normalize and Invert but the old function lacks the Split image option.

I propose to add the two options Normalize and Invert from the legacy version again to the newer version of DOG, since very often one wants to apply it to the result and view it while playing with the amount of blur for the two blur radii. One important question about normalizing is whether it operates on the blurred images before the subtraction or if it only operates on the final result. If it operates on the final result, one might want to combine it with two Thresholds (with additional slider/number interfaces like the radii) to clip everything to black (i.e. 0) below the lower threshold and rise everything above the upper threshold to white (i.e. 255) and if Normalize is activated, normalize the output range to 0 … 255.

Also – contrary to the legacy DOG – the new DOG function has a plethora of Blending Options (Mode Replace/Normal/Dissolve/Behind/Color erase/Erase/Merge/Split/Lighten only/Luminance lighten only/…). There is no explanation for them.

For the user interface: In the legacy DOG the two radii-parameters could somehow be Locked to each other (the factor between them them was fixed when the lock was set, which probably is an useful choice for that). This locking mode should also be added to the new function.

When paying with either of the DOG functions, it looks that often some random noise shows up in the unstructured uniform parts of the image. I see myself performing gray level transformations afterwards in order to suppress this noise by clipping it to zero or 255 respectively. That’s why I propose to be able to add two sliders for that in the normalize function for the result.

I would also propose to enhance the description of the function (file:///usr/share/gimp/2.0/help/de/gimp-filter-difference-of-gaussians.html) like this:

Explanations:

  1. The blurred image is computed by a convolution. The radius determines the width of a single blurred pixel: the larger this figure, the more blur.

  2. Radius 1 relates to the first term of the subtraction, the minuend.

  3. Radius 2 relates to the second term of the subtraction, the subtrahend.

  4. The difference of the two images is computed per RGB channel (is that true? What happens if the values run out of the range 0…255? Are they clipped at 0 or 255 respectively? Or is the intermediate result computed lossless with more bits and normalized to 0…255 afterwards? - The operation should be explained by one dimensional plots of a profile with a narrow spike in it and with a broader hill, like a gauss-convoluted feature like the spike normalized to the spike hight and it should show what happens to the values when DOG is applied.

In the current new DOG function:

  1. Is there any normalization applied in these operations?
  2. If there currently is normalization: Is it applied to the intermediate blurred images (i.e. min=0, max=255) or i it only applied to the end result?