Local Adjustements 2

Hello all

First, I open a “new topic” concerning “Locallab”, because “Local lab build” is 4 years old…and topics is very big. Of course you can always use this old topic.

Some news:
New operator "Tone mapping"

Actually, in RawTherapee there are 2 operators “Tone mapping”

  1. the older named “Tone mapping” uses “Mantiuk” algorithm + “Cholesky” factorisation, it was initialized a few years ago by Ben S.
  2. the most recent “Dynamic Range Compression” uses “Fattal” algorithm + “Poisson PDE”, it was initialized recently by Alberto Griggio

You can find these 2 modules, In Rawtherappe “main” and also in “Local adjustements
In “Local adjustements” some change and addition were realized in addition of course to local specificities (Scope, transitions, masks…)

  • “Normalize luminance” for “Tone mapping”, if you enabled this choice “mean” and “variance” for initial and transformed image are identicals
  • For “Dynamic Range compression”, I used the algorithm in ART, and add someting near from “Normalize luminance”, I call it “offset” (and in “Expert mode” you have also “sigma”)

I introduced another model - different from those we found in "Luminance HDR" - a total wavelet new operator for “tone mapping” and “contrast attenuator” (for example Applying retinex decomposition, see @afre ) - or how to do without “Dodge and burn”

This module I called “Levels Dynamic Wavelet Range (un)Compression” - you can find it in “Local adjustements” - “Local contrast & Wavelet pyramid”

How it works:

  • I had the idea to compress or expand each level “L” (Lab) of decomposition
  • each level has 3 components “DIR” - horizontal, vertical, diagonal
  • I apply an “simple” algorithm “exponential type” with negative coefficient for compression, and positive for “attenuator” for the signal (+ and -), for each level and each “DIR” and also for “Residual image”
  • “threshold” try to take into account noise.
  • you can use up to 10 levels that is to say since 2x2 pixels (level 0), to 1024x1024 (level 9), and you can select if necessary a range of levels (ex 3 to 7)
  • you can, with the horizontal curve, compress (negative values under the horizontal separator “Tone mapping”) or uncompress (positives values above - “Contrast attenuator”) each level differently
  • this “wavelet tone mapping” is different from “Mantiuk or Fattal”, in principle it acts more on the contrast levels and less on the solid areas
  • one of the problem is when you “reconstruct” wavelet, if there are big differences between levels, that leeds to artifacts. By using “Soft radius” in “Clarity & sharp mask - Blend & Soft Images”, this probem seems solved, with very small values of soft radius".To note, “Merge luma” in this chapter allows to reduce or increase the effects.
  • this “wavelet” module consumes a lot of memory - about double that allocated for creating a simple wavelet, but in general no problem because generaly RT-Spot are smaller than plein image
  • I left in “expert” mode the algorithm with “Laplacian”, but it needs more time and more ressources.

Of course, you can use “mask” and "Local adjustements tools" as “scope and transition” which allow differential selection (for sky, skin, buildings,…).

It would be good to improve the readability of the GUI horizontal curves for these usages (with levels decomposition).
@Hombre will you be able to examine the possibilities of :

  1. draw an horizontal fixed line (with no action) in such a way that the user easily sees the positive and negative parts
  2. draw at the bottom of the curve, a graduation in abscissa with the 10 levels (0 to 9) - inactive - just draw.
    Thank you :slight_smile:




1 Like

I improved a little “Levels Dynamic Wavelet Range (un)Compression”

  1. The noise is auto-detected by using MadL (use for Denoise in Ftblockdn.cc to evaluate noise)

  2. I re-used the slider “threshold” and rename it “Balance threshold”
    This “balance” equilibrate action around the signal average (+ and - for Luminance decomposition)

*At 1. the response is as before
*At 1.4 (default) - low values “luminance signal” are reduce, which is to say that generally and according to the level of detail, the shadows will be less crushed.
*By going further the action on dark details will generally increase, and the action on bright details will be differentiated

it is difficult to predict the response for an image because our eye has a global vision, while the wavelet will differentiate the action according to the levels of detail

Edit January 7

I moved Warm-Cool from Exposure to Vibrance.

In Exposure this module was lost and didn’t have much to do with it (but it’s old …)

Now, It is in “Vibrance” a module which allows color adjustment, like “Warm-Cool”.

Recall : what is “warm-cool” ?
This is close to a white balance, but it is not. It is a CAT02 (Chromatic Adaptation Transform) directly derived from Ciecam02.
It uses the same (simplified) algorithm, only for chromatic adaptation.
As I say it is not a “white balance”, but :

  • it allows good approximations to simulate WB (if we stay in the standard illuminants Daylight from D41 to D75, and Tungsten)
  • it’s easy to use.

Some questions about the simplification of “Local adjustments”

For a few weeks now, you have been able to choose the level of complexity : “normal”, “confirmed”, “expert”
You find in rawpedia (in french) the distribution :slight_smile:

Beyond this interface there is the problem of what is useful ? By reasoning by the absurd, the simplest system is that where there is nothing
So let’s delete, optimize, … but it is necessary to be able to do what users want.

Hence my questions ?

For each module, and mainly the “normal” :

  1. are there too many functionalities (it’s easy to suppress) or conversely which is missing compared to the “expert” module
  2. is there any functionality missing (including in the “expert” mode) that it is necessary to develop / add (as far as it is doable)

I know user want “lasso” or rotate the RT-spots, or curves to define the freehand RT-Spot. For a large part these are GUI problems that I cannot deal with. But I will take into account.
Of course, @Pandagrapher is hopefully improving the GUI.

My question is outside of these problems !
For example :

  • Are there any missing curves?
  • Should we develop other new algorithms (as far as it is doable) ?
  • Are there any features present in “main” that you would like to see appear in “local adjustements”

Thank you


//edit January 11
I added 3 things that I think are useful:

  • in “local contrast” - wavelet pyramid : graduated filter local contrast

  • in “Encoding log” : a) improvment to calculate “automatic” value for “source gray point”, by using in some cases Yb

  • in “Encoding log” : b) graduated filter luminance


Hi Jacques,
In my opinion, the possibility to see the deltaE area is missing in the normal mode (that I find very useful), and, at leats in the version I tried, the contrast by detail level with clarity feature is also missing in the normal mode. Otherwise, I find the local section very nice and complex enough.

Hi olivier,
In normal mode:

  • area deltaE in which module?: see: Local Lab build
  • What version did you try? see: preferences-> About-> version.

Regards, Arturo.

I have change the repartition between “normal” <=> “expert”


  • CBDL is in “normal”
  • Denoise is in “normal”
  • TRC - Tone response Curve (With Tone equalizer) in "normal - TRC allows to change gamma and slope without artifacts and whithout “jump” - This TRC allows a good recovery of under exposed images

As says @arturoisilvia, there is no major difference for seeing the deltaE between “normal” and “expert”

  • differences for “shape detection” and “transition gradient” are in settings for some parameters deltaE or transition, to refine choices

But for this part where appears “menu” for mask, deltaE, modifications,…

  • differences are in “mask” :
    ** “normal” has a simplified mask management with 3 curves LCH, blend, smooth, chroma and contrast curve,
    ** “expert” depending on the module, you have also : gamma, slope, shadows, highlight, wavelet contrast, dynamic range compression, Laplacian, structure, Blur


Hi Arturo,
This was my mistake, deltaE is visible in all modes - I was running an old version.
I have tried today the most recent version (5.7-1765 on win 10), and I find that the DeltaE visualization has maybe a bug: instead of mask coded with false color like in the previous release, it is all grey and I cannot judge about the deltaE anymore (see the attached picture, with scope at 15). Is it normal?

On that image and that mask, are you applying any value of something? (Luminance, contrast, chrominance …?) If not, you will not see the changes and intensity to be applied on that mask.
In the previous example that I have given you, I had changed the value of the ‘Color correction grid’ grid and then I can see the scope of the mask and the intensity.

I understand your example, but in the previous version, the “preview selection deltaE” was showing exactly the affected area by the spot, which is very convenient to adjust the scope parameter:
Ex, version 5.7-1416 (scope at 40 in color and light section ON, no other modification)
While it is not the case in the current version 5.7-1765 (scope at 40 in color and light section ON, no other modification):


I improve “Preview Selection deltaE”

Now, you can choose in “settings” the hue (between blue and green) and the intensity of the Color for preview

By default it’s blue at -5


Thank you for this modification Jacques!


You can now download the version 5.7-1778-gaeafd4426 that solve your problem.


1 Like

In the masks the way to display “Show modifications whithout mask” should be changed, as it does not show the modifications without a mask but with a mask just like “Show modifications whith mask”.

I think that “Show modifications whithout mask” should be just as it was before changing “Preview selection AE” in version 1765, which looked at the modifications that were made.

Hello Arturo

First, thank you for participating in the improvement :slight_smile:

In fact, it is more complex, menu choices are necessarily limited. What do we fit into what ?

First of all I want to remind that at the origin of “Locallab” (4 years ago) there were no masks.
I was inspired by the interface imagined in 2006 by Nik Software, “U point” (“You point” and you have the result), with no mask (at the end Nik Software add mask, but there were hidden…)

A) original algorithm
So if we go back to the origin of my design, no masks.
I search several month and years and I found an algorithm - without masks, because the masks are not at all intuitive (at least for me) - to solve the problem of detecting shapes, in order to avoid 2 things:

  1. no clipping use (lasso, …)
  2. no layers, no blending, no mask

The algorithm uses several things to meet the goal (I simplifie):

  1. the notions of reference - hue, chroma, luma where is the spot - must take into account the size of the reference
  2. the deltaE notion : deviation between the reference and the “color” of any pixel in the image
  3. the transition notion : the idea of introducing a degression starting from a certain threshold
  4. the structure notion : as in some cases deltaE is not discriminating enough, I introduce the “structure” notion, difference between solids and structure.

In all these cases, the shape of the RT-spot is of little importance (rectangle, elipse, or others)

Resumed of action whithout mask, for me in 90% cases

  • selected a Rt-spot big enough to cover the area to change and it doesn’t matter that it goes beyond
  • selected (or let by default 60%) the transition value (TR) : up to TR% - geographically - of the Rt-spot area, deltaE wil be apply at 100%, after (TR% - 100%) there will be a regression to get to zero
  • selected a “Scope” value : range of deltaE. At 100% no effect for deltaE, all colors are concerned, values by default about 20, must satisfied a majority of cases

Selected the action you want, lightness, chroma, contrast, graduated, local contrast, retinex, etc.
And, it is finished.

But, because the is a but, I had to improve the algorithm

  1. in some cases “Structure” (“Color and Light”, “Exposure”) improve the result
  2. allows RT-spot different from “circle” (rectangle, elipse) in some cases
  3. allows “Excluding spot”, to undo certain actions
  4. 4 sliders (in Expert mode) allows to modified “DeltaE rules” : normal Rules deltaE (dC = dL = dH and linear weakening) - see documentation
  5. 2 sliders (in Expert mode) allows to modified “Transition rules” - normal transition rules - linear weakening XY - see documentation (especially to touch up small defects, red eyes, etc.)
  6. and of course you can open multiple "Rt spot"

B) Masks
Two years ago, I was asked to add masks, inspired by what Alberto had done for “Color toning”
The first question for what to do ? certainly it is a request, probably partly because people have not completely understood the algorithm
But, it’s a request and in some cases original algorithm fails (as Nik software!),so I looked for how and why

I will resume more than one years of changes and improvment

  1. 2 usages for masks : a) improve selection deltaE , b) special effects
  2. generally in “normal” mode you have 3 curves L, C, H, a slider “blend”, a smoother, a chroma slider, a contrast curve
  3. for the 3 curves, you see (thanks to @Pandagrapher ) the 3 references (hue, chroma, luma)
    If blend is at zero, you only improve deltaE ( a) above)
    if blend > 0 or < 0, ( b above) you add or substract the mask of the original image (before threatment) - for Retinex or Tone-mapping you can choose after or before

But, when you get into the logic of masks, you have to go further. So, depending on the case and mode (expert or normal), I added other type of mask - creation of mask - others than the 3 curves LCH : Structure mask and Blur mask (in addition to LCH)
And also work on mask - Structure mask, gamma mask, slope mask, level contrast mask, Laplacian mask, shadows mask, Highlight mask, hue curve mask, dynamic range compression mask
And of course you can uses more than one mask, and more than one spot.
Of course you can see the work on the mask.

C) what to show
We realize that if we had to offer the possibility of showing all the possible choices the selection menu would be very important.
So, I limited the possibilities which at the start were :

  • none - normal display
  • show modifications whithout mask (we can change but for which label ?)
  • show modifications with mask (we can change but for which label ?)
  • show mask
  • structure

About one year ago, one ask me to add “Preview selection deltaE” (someting as in Darktable)

Of course we can change the labels, but it will be difficult, not impossible to change the contents

  • show modification whithout mask : use for the essantial deltaE algorithm, stucture, and transition
    The grey aspects will change when you change curve, sliders, methods,…that acts on luminance, chrominance, hue, and when you change scope, transition and sliders (in settings) that acts on deltaE or transition
    Mask have no action

  • show modification whith mask : same as above, but take into account mask whether the slider blend is zero or not

  • show mask : show the work on the current mask (you cannot show 2 masks in the same screen), blend is not active, transition is not active, deltaE has quasi no effect, deltaE mask have an effect if you uses tools mask (contrast curve, chroma, etc.)

  • show structure : (when possible) - shows in grey the area concerned by structure (Sobel canny algorithm) - structure is “added” to deltaE

  • preview selection deltaE : shows areas concerned by deltaE algorithm, whatever the settings on luminance, chrominance, hue. Tansition is not active, all sliders settings deltaE are actives and of course Scope
    If you change sometings that acts on luminance you will see the result (side effect)
    if you enable mask with (or whitout) blend you will see the changes.

I hope to have been clear



I understand the delta E selection and masks but I find combining them confusing. I would only want to use a mask if delta E didn’t achieve the result I wanted. Sorry if I have missed this but Is it possible to turn off delta E selection and just use the mask? Ie have everything within the large circle selected at first then use LCH curves to make the selection? Thanks


If you want to turned off deltaE selection, just set “Scope” to 100, and (??) transition to 100


Makes sense, thanks


The content should not be a problem because in “show modification whithout mask” the code you had before in “preview selection deltaE” must be before changing it to Olivier.

Current “show modification whithout mask” (bad):

It must be: (old content of “preview selection deltaE”):

  • Without changes:

  • With changes:

I think it should be like that.


Hello Arturo

I have to admit that I don’t understand what you want :slight_smile:

Is it a language problem, a code problem, a semantic problem ? When reading your post, it seems to be semantic…the problem seem to me in the use of the term “mask”. Do you use really a mask ? that is to say enabled 1 or 2 or 3 of the 3 curves LCH in “mask and modifications”?
But perhaps there is a bug somewhere or something else, I don’t understand :slight_smile:

It is not a criticism, but an observation. Is it due to the language, my english is bad, very bad
On another thread, I said in french : “ah si tout le monde parlait français !”

So that we talk about the same thing, on the example that you give, can you provide the raw (or JPG / TIF) and the pp3

The change, I made following the (justified) request to @cabernet_olivier, does not affect the end result. The only change I made, is to adjust the sensitivity of the reaction - in the last version, the response was too weak depending on input (not good). Now the response is quasi independent of the input (except side efftect)

With regard to the 2 headings (and of course the code) : “Show modfications with mask”, or “show modifications whithout mask” no changes for some time, date on which I revised the code to remove redundancies and bugs (about 3 or 4 mount ago or more…)

Perhaps you want that I adjust the sensitivity response, in a way that makes it more visible (the same way I changed for "preview selection deltae) ?

Best regards, and again thank you for trying, testing