I would like to understand the practical difference between what can be achieved with diffuse and sharpen and contast equalizer from the perspective of photo editing.
Note that I am not asking about the algorithms, clearly they are different. Both operate on wavelet decompositions, but D&S allows anisotropic filtering, while CE has edge management adjustments. CE allows a finer control over frequencies and is much faster.
But my question is the following: is there anything you find relevant for editing photos that D&S can do but CE cannot? (If yes, please try to add an example with a RAW or a TIFF crop to play).
Probably not answering your question, but I see the modules as very different. I often compare both for denoising and sometimes one is more suited than the other. I like that I can decide the size of detail that is being affected in CE. With diffuse or sharpen I am mainly limited to using the presets because I donāt fully understand the sliders despite watching APās video introducing the module. Surprisingly I have also rediscovered the old school sharpening module as an option for sharpening, but I still mainly use the DorS module for sharpening. I never use the CE module for sharpening.
I personally havenāt found any major practical differences between the two. I spent a long time trying to learn how to use D&S instead of CE, but ultimately decided it was more trouble than itās worth, so I almost exclusively use CE now. Iāve given up on D&S except for some presets that sometimes come in handy. But even those presets I could probably recreate in CE.
For what itās worth, I donāt obsess over sharpness. What I find more important is understanding the UI and not slowing down my workflow too much. I find D&S slow to use and too heavy on processing power.
FWIW I noted at some time that Aurelien (the creator of D&S) stated that he neither would normally use sharpening due to downsizing from camera resolution negotiating the need for pixel-level sharpening adjustment ā and in general his interest for softer images.
I believe Diffuse and Sharpen does a better job on itās advertised function than Contrast Equalizer. I mainly use D&S for sharpening, usually with the medium preset and I strengthen the effect as needed with the 4th order speed slider.
Where CE helps is when I need to emphasize low order tonals, similar to how texture and clarity work in Lightroom and other programs. On my Dark Side of the Goose photo, I boosted the coarse details to help bring out the structure of the birdās face. I donāt think I could get that effect with D&S.
I find that CE is better for smoothing unwanted detail, but D&S is great if I want to add a hazy effect.
My workflow has a place for all of these related modules. Iāll start with the legacy Local Contrast to bring back detail from Filmic or Sigmoid, then use the CE for texture/clarity, and then D&S for sharpening. And I find the legacy Sharpen module works well for output sharpening.
You can do this with D&S but itās a hell of a job knowing where to start and dialling it in to be just right (I could give you some numbers but it varies depending on your imageās resolution). With CE, you can just grab the furthest left node and drag up to add some nice soft texture. Doing this in D&S requires finding the right Central Radius and Radius Width, plus tweaking the iterations and speeds for the desired strength. It can be done, but itās far harder and not something I bother with anymore. I did create a couple of presets, but the effect varies in its attractiveness between photos, so it often needs tweaking.
I find it very useful for effective (output) sharpening, quicker than D&S for this and D&S tends to produce a kind of high frequency noise pattern I donāt like (if pushed too much). I use mainly the 4th and 5th luma sliders for this, while decreasing a bit the 6th one to avoid the grainy effect.
I almost never push the 1-3 sliders upwards because halo can appear very quickly. Also I noticed that it can destroy transitions in the bokeh very easily, and It is hard to mitigate even with the edge sliders (Iāll find and post here a RAW to demonstrate what I noticed).
Diffuse and Sharpen:
I think it is nice to (input) sharpening/deblur the image at the beginning of the pipeline. Also, I add a bit of local contrast with D&S, but I think it is hard to work with D&S because the results are very hard to compare to the exported output, or you have to work with the full size render and accept the insane computation time.
What only D&S can do?
In my opinion/experience:
simulate halation, by diffusing the red channel in the highlights;
simulate bloom, by diffusing the highlights;
local contrast enhancements without halos, but Iāve not played a lot with this.
I tend to put D&S after the tone mapping in this case, or just before.
Here is an example where the foreground blur is heavily affected by Contrast Equalizer (CEQ).
Image 1: CEQ not enabled Image 2: CEQ with luma pushed 1 graduation up for all scales Image 3: Same as Image 2 but with edges slider pushed all the way to the minimum Image 4: Same as Image 2 but with edges slider pushed all the way to the maximum
You can clearly see halos in Image 2 and Image 4. In image 3 the small halos disappear, but you can see a darkening on the rock.
Intermediates settings could improve the image (at least as a tradeoff between types of halos). But I posted this more as a sample picture to show the limits of Contrast Equalizer, at least in my experience.
In my experience halo mitigation should be done in a per-image basis, with a particular attention for images with focus blurs. Also the āedgesā settings to use depends on at which scale(s) the focus blur is present, so that sometimes it is not possible to remove all halos and fine-tuning can become time-consuming.
nice, thanks for the concrete description of the artifacts and the test image!
the old dt equaliser is based on a-trous wavelets with edge aware filters⦠which clearly violate the sampling theorem when you dial in harsh edge weights. with all the artifacts described here as a consequence: halos, gradient reversals, weird ringing artifacts/copies of edges appearing in some distance to the edge (especially at high contrast edges).
in vkdt i use a different implementation that doesnāt hurt nyquist and can thus work on decimated wavelets (much faster to evaluate). on your test image (evaluates full res eq processing in 1.370ms, i.e. >700fps here):
the way it works is it simply does the vanilla wavelet contrast boost (not edge-aware, with halos) but limits the effect by some inter-scale edge detection mechanism. this āedge shieldingā behaviour can be controlled by the āedgesā parameter (setting it to 0 will become the std wavelet/halo case but also show a stronger effect).
i never got around to doing actual comparisons and iām surprised how it works so well in comparison on your test scene, especially when comparing render times, so yeah thanks for posting.
The legacy Local Contrast module seems to work pretty well, plus it has options to emphasize highlights, shadows and midtones with the result being brighter with more contrast than CEQ or DoS. Iāve asked, but it seems that no one seems to know exactly how it works so the institutional knowledge of the modules appears to be lost.
but the code there is really simple⦠itās just a bilateral unsharp mask, or the local laplacian pyramid (which is probably what you mean because that uses what is called āmidtonesā here). there are a few detailed papers about this, so i would argue we know exceptionally well how it works in this case.
Isnāt the main difference between the two that contrast equalizer works in lab and Diffuse/sharpen in rgb? Therefoe, contrast equalizer reduces saturation, among other things. Or at least contrast equalizer used to work in lab, maybe someone changed that meanwhile. Nevertheless, I think it still somehow does reduce saturation.
After some trial and error, I came to the conclusion that sharpening only makes sense at the output resolution and scale. A small print or phone display requires a different amount of sharpening than a big print or computer monitor. I have therefore mostly given up on the idea in general.
I do use the Contrast EQ for Clarity/Texture, though. Often in combination with some drawn masking, as it does horrible things to already-blurred backgrounds. Hanatosā implementation in vkdt looks intriguing in that regard.
Iāve understood that there are 3 different types of sharpening:
1. input/capture sharpening
This one is supposed to counteract the capture imperfections (lens blur, antialiasing filter, etc.) In darktable I think it corresponds to the corresponding presets of the Diffuse&Sharpen module. Effect should be inspected at 100% zoom.
2. local/artistic sharpening
This one is related to the artistic intent, to add clarity and/or texture and @bastibe said. I think in darktable this can be achieved with Contrast Equalizer and Local contrast modules. Also, the old/classical Sharpen module with appropriate radius can be used.
3. output sharpening
This type of sharpening depends on the output medium: viewing distance and physical size of the print or image on screen. When resized, and image usually soften and this need to be taken into account by using a sharpening radius dependent on viewing distance and print resolution (see calculator in the first link).
I think either Sharpen and Diffuse&Sharpen can achieve this but Iām not sure of what is the exact strategy to use. Iāve tried GMIC RL_output_sharpening but Iāve found it increases a lot the noise.
Disclaimer: this is what I think Iāve understood so far and not a general guideline
I guess the obvious question is whether it can be ported to Darktable if it works better. Although I donāt really have any major problems with Contrast Equalizer in its current form. I actually like some of the effects it produces, even though they may be technically ābadā. Subtle haloing on coarse details can produce a very nice dreamy effect if ever you want it.