What does diffuse or sharpen really do?

It is certainly not intuitive to use or teach to students. I have listened to his video, paused the video, took notes, experimented with sliders and then started the video again. I spent hours trying to get my head around the module. All I know is that I get great results, but the presets are the starting point. I use the sharpen demosaicing (AA filter) on all my images as an initial sharpening. I also tend to use one of the lens deblur options for additional sharpening as required. With noisy images I apply the sharpening selectively using the details threshold slider and I may use one of the denoising presets selectively applied using the details threshold. It is a great module. I have a decent computer with a graphics card and apply these corrections early in the processing. But my work supplied laptop has no graphics card so I apply these settings at the end of editing as the diffuse or sharpen module is very resource intensive.

image

2 Likes

I think that’s correct, you can try yourself, results are identical. You can also set speed1 to 100% and speed 2 to -100% and it does nothing. My understanding are that the 4 speed works as follow :

Not totally sure but I would need to read the code carefully to be sure. In any case the interface doesn’t make a very good job at communicating it.

Thanks, @jonathanBieler. Wish they would put something like that diagram in the documentation. (Yes, the words say it, but it’s easier to refer back to a picture.)

My hunch is that the interface is the main problem with the module. Everyone seems to love the results, but very few seem to know how to actually use the module from scratch. I have absolutely no idea what kind of interface would be better, so this isn’t a very useful comment. But I do sometimes wonder if an interface overhaul would generate less confusion. Is it just how the sliders are named (with abstract comments like “speed”), or is it that there are simply too many moving parts and it’s too hard to visualize how they all interact?

4 Likes

It’s not too bad if you play around… But I think your right there are a lot of moving parts…

1 Like

All of the above!

2 Likes

As it stands, it is incomprehensible to the average innumerate non-scientist like me. I did watch one video that started to make sense of it all for me.

Darktable Episode 51: diffuse and sharpen module in practice

When I have time I’ll watch it a few times. Who knows! sometimes today’s incomprehensible becomes tomorrow’s obvious. If only in practice rather than theory.

3 Likes

Well, for starters there’s kind of a “unit error” that might mess with people’s intuition. You see 4 similarly labeled sliders about speed and anisotropy, which I think leads to an intuition that they all do something similar, just possibly at different frequencies. But as far as I understand, two of them are operating on a scalar function (a laplacian) and two of them are working on a vector space (a gradient). So even if you wrap your head around what sliders 2 and 4 do, it won’t really help your intuition about sliders 1 and 3.

In some sense, I can kind of get sliders 2 and 4. Like the laplacian, which is the divergence of the gradient, represents how much the gradient vector space flows out of each point. So it will be high for dark spots surrounded light spots. Since it’s a scalar, you can do some kind of blur on it, and then subtract the blur from the original and amplify or attenuate that difference. The greater the blur, the less steep you will make the gradient, so the less local contrast there will be.

On the other hand, I have zero intuition for sliders 1 and 3. What on earth are these sliders doing to the gradient of your image, and why is that useful??? I mean I know it looks good in certain cases, I just don’t even understand at any level what those things are doing. Are they somehow blurring the gradient vector space? What would that even do to your image and why?

1 Like

I suspect the explanation here was not sufficient?? https://www.youtube.com/watch?v=DREdq7guNz4 and here https://www.youtube.com/watch?v=jHlPh7gt3Y0

This is one module that I use a lot and at the same time 90% of the time it is some of the default presets and the only adjustment is the iterations.

The last 30 minutes of the AP video are closest, but not really. In the video he says the docs link to a description and then corrects himself and says it’s only in the source code. I should check through the source code and see if I can track down the paper.

1 Like

https://www.researchgate.net/publication/220663968

Reaction-diffusion textures | ACM SIGGRAPH Computer Graphics)

/ see in Rotation-invariant Laplacian for 2D grids - Aurélien PIERRE Engineering
// for references (Oono & Puri)

Found these from a quick scan…there is one more reference in there but it is related to the wavelet part…

1 Like

I feel this would be a great idea if anyone actually knows how to make the UI intuitive. It is a great module, but most if not all of us struggle with understanding the sliders and options. Thank God (or AP) for the presets that are so useful.

I neither have such understanding of the workings of DoS that I myself can give any specific suggestions of how to make this advanced tool more “operational” for the less mathematical minds, (beyond the existing presets that seem to work quite well). The module allows precise control over the parameters of a highly sophisticated, general algorithm, that can be used for so many purposes, but the problem seem to be that (beyond some of the presets) the module presents no terms that can link “lay” users’ practical tasks to the module’s exact mathematical parameters.

I have, however, noted a thought and convey it here, that was put forward a couple of years ago in the comments to one of AP’s video explanation on YT by a guy (@marct8788, who seemed to have more theoretical background than many of us other users, and had done his home lesson in reading up to understand dt and the DoS module, but still made a pass on it because of its UI).

His suggestion to make “superior algorithms available for simpler minded photographers” was to implement several “different dedicated purpose-built tools, e.g. diffusion, watercolor simulation, noise/grain modification, texture or film emulsion generation, in-painting, sharpen, local contrast, etc.” as front-ends to DoS that “worked silently in the background”. “These modules could have different names (which would also be a relief in the stack of modules if you need them for several different tasks), with dedicated behavior and dedicated naming for their sliders or other controls, but hopefully with less sliders than this module has now, and with safety measures for their specific intended purpose.” With a "clear, specific purpose -… and using “a language a “normal” digital photographer can understand, and has safety measures which are up to the task”, the UX ought to be improved, according to him.

If we combine this idea – to which I will be surprised if dt developers immediately cheer, in particular if we by “dedicated purpose-built tools” think of some kind of quasi-modules) – with another idea that was recently put forward in another posting here in the forum, about the possibility to have several tabs of Quick Access Panels, could that possibly lead us in the right direction?

Could we possibly place groups of DoS slider copies under relevant task headings and with more descriptive labels in a modified system for QAP?

3 Likes

You can use the presets and iterations/opacity which I think a lot of people do. If you experiment with the threshold sliders you can actually really dial things in and or correct artifacts… the Edge threshold have a big effect on halo’s or black lines on edges when you go to extremes but you can actually push the settings in the upper speed portion and then use that slider to back things off or even from a default just drop it a little and watch the edges sharpen. The other threshold slider is great for the grain artifact that can happen so you can use it to control that … so I have been experimenting with stronger settings instead of iterations and then dialing it in with the threshold sliders… As for the upper sliders you can use then synergistically to reinforce each other or use 1 against 2 and 3 against 4 to balance an adjustment. For me the direction sliders are out of my control…not 100% sure how to put them to good use… but for the rest I can wrangle it fairly well now…

3 Likes

Interesting discussion here. And just to be clear, we’re just throwing out ideas and discussing, rather than trying to lead a protest to get anything changed, at least I’m not. I can’t image a dev or anyone with the skills is particularly bothered about changing this module. But you never know where discussion leads…

Just as an example of this module’s complexity, if we take a look at the Local Contrast preset, which is probably one of the most commonly used, we get this:

image

That’s 9 sliders in use. Nine! It’s hard to imagine anyone would come to this preset’s effects intuitively. You can imagine a commercial business like Adobe or Capture One having a few sliders called “Texture”, “Sharpness”, “Bloom”, “Contrast”, and then possibly a couple of secondary sliders for masking and/or edge management.

Not that I’m advocating for mimicking what these companies do because Darktable has always given more control to the user. But the sheer number of obscure-sounding sliders in this module is on a different level.

I like to draw parallels with the Contrast Equalizer because they perform similar functions and because some aspects of its frequency separation were applied to Diffuse or Sharpen (according to the manual). The separation of frequency between coarse details on the left and fine details on the right over 6 nodes is a really nice frame of reference. If you want to adjust contrast to fine details, you just use the nodes on the right, and for more contrast on coarser details, you use the ones on the left. The middle is for “medium” details. And if you want to add more contrast to some details, and less for others, you just push your nodes accordingly, some up, some down. It’s so much more intuitive than working out how much speed and anisotropy you need, and where on the slider scale the coarse and fine details lie in Radius Span.

The Contrast Equalizer module has some of its own issues (in my opinion), such as the bottom nodes for noise being barely visible, and Edge management being separated on a different tab, but it’s much easier to learn. The upcoming Color EQ module also has this nice split interface where you have an equalizer graph with sliders below. I have no idea if D or S could ever be adapted to have such an interface, but something like that would be easier to grasp I think.

6 Likes

FWIW, I agree with you completely. I would imagine that most users would choose to use the drop-down presets rather than mess with the sliders. of course there are some who have no problem understanding those sliders and that in itself is very impressive.

It would be great to see a simplification or more intuitive way to work which could perhaps make the module much more user-friendly.

1 Like

“Intuitive” use usually means that you are very used to the tool and know what it does through experience (working with it and perhaps studying the theory behind it).

In this case, simplified or “intuitive” ways to work with the module would have to hide part of the power of the module, and I’m not sure the full darktable interface would become simpler (as there would have to be many more “modules”.

And yes, I only use the presets, with perhaps a few extra iterations to “strenghten” the effects (not always possible without artifacts!). That said, it’s not the first time I see an interface/tool that’s hard to understand, but works in practice (through iterative use, NMR shimming for the initiated :wink: )

I think it’s a great goal to make the diffuse or sharpen module more intuitive, but not at the cost of taking away its power. That’s why I think a good starting point would be just a simple explanation of what it does. Then we can discuss whether there’s a better UI. However, I strongly conjecture that until someone can explain how the module works, we won’t have better ideas for UI that don’t hurt the module’s flexibility and power.

As a starting point, I want to look at the papers that @priort shared.

2 Likes

Did you watch Nicolas’s video (A dabble in photography) …he did a pretty good job basically showing you what is going on as you move down the module from where you set the wavelet parameters to obtain your high and low frequency images/layer much like a frequency separation. Then you do that again basically to get even finer high frequency image and these are the bases for the effect and the sliders 1-4 and then the next 4 are the steering the effect you set with those…

I think what I find hard to do is visualize assessing an image in such a way to target these adjustments … for example guiding the effect on the high frequency image using the gradient from the low frequency image… I think the manual says something like so it makes sense…

To me I think it boils down to manipulating edges and discrete particles like grain or noise and you can tweak the controls to target one or the other or both… I suppose someone breaking down a couple of images and showing how they would use the module differently to suit that might be helpful…