darktable tone equalizer : help wanted

Forget about highlights. Tone equalizer knows no highlights, it just splits the dynamic range you feed it in 9 zones, spaced by 1 EV. Highlights may fall into the 0, -1, -2 EV band, that doesn’t change anything. Always try to spread the histogram over all the available nodes, so you get maximum control over your whole dynamic range.

Preliminary answer here, for @Julien76, @gadolf, @asn and @phweyland, regarding the masking:

  1. The mask used in tone equalizer simply compresses an RGB image into a grey map representing the pixel lightness, using several norms, and is used internally to map the pixel lightness to the control nodes to apply the corresponding exposure correction.
  2. If you don’t use the details preservation option, the tone equalizer falls back to a simple tone curve with built-in chroma preservation. That’s good if you want to increase the contrast in a picture and don’t mind the over-sharpening (aka you want local and global contrast increase).
  3. If you are decreasing the contrast (in HDR situations) or want to increase the global contrast without affecting the local one (in studio portraits, to avoid making skin flaws pop out too much), you need to post-process the mask and use the details preservation mode.

To avoid affecting the local contrast along, we need to make sure that the same exposure correction is applied over contiguous areas of the picture (say : all the background gets -1 EV, and all the foreground gets +1 EV) and these areas are properly separated.

We therefore need to post-process the mask with a surface blur. We do that with a guided filter.

  1. chose the luminance estimator that gives you the most separation between the areas you want to dodge, and the ones you want to burn,
  2. chose the smoothing diameter depending on the size of the elements you want to isolate,
  3. adjust the edge feathering:
    1. if you get halos along sharp edges, increase it,
    2. if you get too much local contrast compression, decrease it.
    3. Note that a very high edge feathering (> 100) is equivalent to disabling the details preservation at all.
  4. if the trade-off beween smoothing diameter and edge feathering is still not enough to get a good edge-aware blurring:
    1. increase the mask diffusion (aka apply the guided filter iteratively on top of itself),
    2. increase the mask quantization (aka use a pseudo-boolean mask in the guided filter).

BUT…

The core of the guided filter is actually a box average (also called box blur), which computes the local average in a square box around each pixel. As you increase the mask diffusion, the mask quantization, and decrease the edge feathering, the post-processed mask will tend to its average lightness. Thus the histogram will shrink around its average, and most nodes in the equalizer will consequently control nothing.

So the mask exposure and contrast compensations are just there to counter the averaging effect of the guided filter and force-spread the histogram over all available nodes.

That’s why we don’t care about highlights or shadows in this module, because what the -1EV band actually represents depends on the masking options, and doesn’t change anything since you have the interactive correspondance between image preview and EV band.

At any rate, preview the mask for each step, and read the tooltips labels I have put on each slider, that should help understanding what’s going on. Litterally every setting has a tooltip.

3 Likes