Enhanced Unsharp Mask in PhotoFlow - please test!

I tend to use dual-demosaic all the time now. I did start looking into whether it was the dual-demsaick :wink: (like that word better) that was the issue but got interrupted before forming a conclusion. Will do some experimentation when I find the time, perhaps I can find a good example image.

1 Like

It’s about time to make a speedup for vng4…

2 Likes

Looking forward to it.

Looking at the backlogs it’s already 10 times faster than 4 years ago:
https://github.com/Beep6581/RawTherapee/issues/2262

https://github.com/Beep6581/RawTherapee/issues/4633

But I will see what I can do to further improve it…

I’ve done some quick tests of capture sharpen oof “dither” now. Is this the place to upload or should i start a thread in the RT forum?

edit: may as well link to filebin from this post Filebin | nofwa4edaqoreb80
Look at the transition from petal to white background above the central diagonal stem. Album view works well in filebin.

Imho better to post in the RT forum

1 Like

This part of the experiment continued here Capture sharpen, soft edges test

I did some further work to improve the halo suppression, as well as the transition between the sharpened areas and those where the noise gets protected.
I have also renamed the sliders as “noise threshold” and “edge threshold” to make their role more clear.

Here is what I can achieve on your image with the latest version:

Now coming to the meaning of the threshold sliders, I will try to give a simple visual explanation using an image with a double gradient:

In the middle there is a sharp edge that increases in amplitude from left to right.
Setting the noise threshold to 0 and the edge threshold to the maximum, the edge gets sharpened all the way to the right:

Lowering the edge threshold, the right part of the edge starts to be preserved, and only the “not too pronounced” part of the edge gets sharpened:


Notice that the edge is still sharpened all the way to the left side, proportionally to the initial step amplitude.

Now, if one rises the “noise threshold” slider from 0 to 10, the sharpening in the left part of the image gets suppressed. That is, small variations in intensity (like those due to noise) are “protected” from sharpening:

Moving the threshold slider up to 50 extends the “preserved” region to the right:

The effect is rather subtle, which also means that one has a lot of fine control over the noise/texture sharpening tradeoff. There is also no sharp transition between the two, so the result should look quite natural.

Hope this clarifies a bit more how to actually use the sliders with this new tool…

I have implemented one more improvement to the new USM algorithm.

Some of you might know about the “octave sharpening” method, which consists in blending several sharpened versions of the original image, at increasingly higher radius and lower opacity. This adds some “volume” to the image in addition to the enhancement of the small details.

In the new tool, this is controlled by the “number of scales” parameter.
For example, for a radius of 1 and 3 scales, the contributions to the sharpening are as follows:

  • 50% at radius=1
  • 25% at radius=2
  • 25% at radius=4

Here is a simple sharpening with radius=1 and one scale:

Same image with radius=4 and one scale:

Finally, radius=1 and 3 scales:

Again, your feedback is very much appreciated!

1 Like

I started by trying to eliminate the halos. In your setting above, I can still see them. I could eliminate them by lowering the edge threshold to 6.3.
But a so lower threshold seems to reduce the effect of the other sliders.
I then tried to tweak the new # of scales, and all it seems to produce is a smoothing effect.
Without sharpening:

Before raising the # of scales:

After:

Anyway, at least for this particular image, I’m satisfied with the result.

EDIT: Scrolling thru the screenshots, I noticed that raising # of scales added some local contrast to the water, which is nice.
EDIT2: I haven’t noticed the show mask feature before. That is good! However, having it enabled, raising # of scales from 1 to something much higher (~6), gives this while processing (when it finishes, the mask gets back)

1 Like

The guided filter generates a variance-dependent blending between the original and the blurred images. The higher the variance is locally, the lower is the weight of the blurred image. However, such weight is never 0, so some degree of blurring (and therefore of halos) is always present. This gets accentuated when the number of scales is increased, because of the contribution of blurs at larger radii. For example, with radius=3 and 6 scales one gets contributions (with decreasing strength) from radii of 3, 6, 12, 24, , 48 and 96 pixels!

yes, because almost all transitions are considered “edges” and therefore not blurred by the underlying guided filter.

Yes, because of the contribution of larger radii that adds some “local contrast” to larger-scale variations on top of the sharpening of small textures.

With 1 scale, all the sharpening comes from the blur at the base radius (3 pixels in your example). When you increase the number of scales, contributions at larger radii are introduced that “replace” the one at 3 pixels, so sharpening of small textures is decreased…

Personally I would suggest to start with a base radius of 1 and 3 scales, at least if the goal is to sharpen fine details. I will also tweak a bit the relative strength of the scale contributions, lowering the weight of larger radii.

I will check what is going on, although I consider the “show mask” feature mostly a temporary diagnostic tool while developing the filter.