Local Lab build

@jdc Locallab offers great features and is working fine now.
Sometimes the elipse or rectangle spots cannot be easyly adapted to picture regions I want to tweak. So I have a question: Is it possible with not too much coding effort to make the angle of the axes changeable as can be done in Graduated Filters? This could introduce more freedom in adjusting regions to tweak.



Two improvements could be made in the long term (several months …).
These 2 improvements require a lot of work on the GUI and the algorithms

I . add a zone delimiter that is not an elipse or a rectangle, but 4 Bezier curves connecting to the “head” of the XY axes.

Big job on the GUI, I don’t know how to do… the work on the algorithm seems feasible, even if it is not self-evident

II - allow rotation of the spot, especially to make the luminance gradients a little more efficient.
Big job on the GUI…Big job on the algorithm…

I do not plan to do any of these 2 improvements - I do not know how.

Let’s first make sure that the system as it is today is working as it is intended (algorithm, memory leak, etc.). This should be ensured in a short term.
Then, integrate “local adjustements” to the main branch.

Only after and without guarantee we can start these 2 improvements


At the current process level, several improvements were made recently

  • on the GUI by @Pandagrapher,
  • on optimization by @heckflosse,
  • on algorithms by me, especially for 2 complex processes that were heavily bugged “Tone mapping” and “Retinex”



Thanks @jdc @Pandagrapher @heckflosse
I’ve started to use the “Local adjustments” build exclusively since a couple weeks, since the dev branch is regularly merged into the newlocallab branch.
No problem so far, it is my opinion that this branch should be merged into dev, it would allow more users to try the local adjustments and help polishing the corners.

@jdc I think there’s a bug in the Local Adjustments “Retinex” filter regarding the range of the “amount” slider: going from 0 to 0.1 there’s a huge difference, then from 0.1 to 100 no difference at all.


Verify the version, effectively “old” commit have this bug.
Since 2 or 3 days this bug (I think is solved)


I update “Rawpedia” - always in french, with last improvments

1 Like

Oh, sorry, indeed my build is from Monday. Thank you Jacques!

@jdc Can you check the behaviour of the “guide filter radius” in local retinex? It looks like the same range problem I noticed for “amount”: huge effect from 0.0 to 0.1, then nothing changes > 0.1.

Edit: using commit d255cff3c

@jdc Something else regarding the new retinex code in Local adjustments: the borders of the image tend to be more or less unaffected. I don’t know if the algorithm can be adapted to affect the whole image area.
Edit: I think the borders are affected, but they appear lighter than the central part of the image.

@jdc Another strange behaviour lies in the preview: if I place a detail window, what it shows is different from the main 1:1 preview, and also different from the final exported image:

I did a review of “Guide filter radius”…
It’s a complex thing, because in one case, it uses “Log” values, and in other “normal” values with two different goals !

I hope it’s solved :slight_smile:


Thanks Jacques, now it works. By the way, Ithink it should “guided filter”, not “guide filter”.

Now, I see that the Chroma slider has also a problem with range: most of the effect occurs between 0 and 1, and only small changes are seen from 1 to 100.

A majority of bugs have been solved.

In addition I modified the parameters that take into account the size of the preview to make less sensitive the differences between preview and TIFF/JPG

I added a function that I think is useful - I included it in the “Soft Light” module to not add a module, but I could have put it somewhere else

This function is named “Original retinex” or in internal “Retinex_pde”
It aims to reduce the differences between shadows and lights -following the Retinex principle developed in the 1970s 1980 - for example in a portrait and avoid many individual retouching with brush (that is not in RT) or with a RT-spot

Summarily it uses a Laplacian “adjustable” with 2 sliders, then a Fourier transform, then the resolution of the Poisson equation (PDE), then a balancing of the luminances


I just made two improvements

  1. for Retinex_pde, by introducing 1 more slider, which takes into account the deltaE in the use of Laplacian…this allows to better differentiate the foreground and the background

  2. for Retinex (MSR multiscale retinex) and Tone mapping, I add a function - of course you can disabled - “nomalize luminance”, useful in this 2 cases where luminance and contrast are very strongly changed. The algorithm takes into account the luminance and variance of each image (before and after TM or Retinex) and “equalizes” them.



I added to “Local Contrast” as well as to “Retinex” the possibility to use FFTW (Fast Fourier Transform) to generate the blur instead of the function “GaussianBlur” present in Rawtherapee.

This function presents 2 optimizations:

  1. multithread with OpenMp
  2. adapted “generaly” the size of the Rt-spot, in such a way that each of the dimensions is compatible with the prime factor decomposition below (this optimization il also in Retinex_pde)
    2^n * 3^p * 5^q * 7^r * 11^y * 13^z with y+z = 0 or 1

With this optimizations the treatment time is rarely inferior to the traditional method, sometimes higher, but acceptable!.

But, there are several advantages:

  • it is possible to increase the size of the radius (sigma), without affecting memory and processing times.
  • the results seem to me better quality because we strictly apply the Gauss formula :
    G(x,y) = (1/2 * PI * sigma) * exp(-(x^2 + y^2) / 2* sigma^2)


Two complements to my text above

  1. the adaptation of RT-spot is about some pixels and should have very little impact
    For example if user select a spot with H=2020 W=1349, system will calculated new dimensions Hr=2016 Wr=1344
    Other example H=1200 W=944, new dimensions H=1200 W=936.
    This reduction can reduce treatment time up to 4 or more times.

In the case of Retinex (due to code complexity), this optimization does not work if the 2 delimiters (separatly for horizontal and vertical) are outside the all image.

  1. in fact, the formula used to “blur” is a transformation of G(x,y) adapted to FFT
    G(x,y) = exp((-sigma)*(PI * x^2 + PI * y^2))


1 Like

Trying to do some local adjustment with RAW file from this thread . Using the Elipse and all I did , was using the “Exposure”

I’m not happy with the result , or maybe I’m doing something wrong ?
Exposure in Global adjustment is working just fine. Nothing to complain about it.

playraw.RT4.jpg.out.pp3 (18.5 KB)

The last picture is Lightroom and radial filter (the same as the Elipse )

RT 5.6.947 and Windows 10

Try raising the “scope value” and/or increasing the spot size. In your test the small spot in the dark part of the truck cabin, and small scope value, mean that the tool is going to try increasing the exposure only of similarly dark tones.
Or maybe try the local shadows/highlights tool instead, if what you want is to raise the shadows inside the cabin.
What were you trying to achieve?

1 Like

Tried to raise the scope , helped just a little. Highlight compression helped - but prevented lifting of the shadows.

Using the Shadows/Highlights did give a much better result as shown below

(18.5 KB)

Using the Exposure in local adjustment is giving me strange result with many pictures. Can’t figure out , how to use it. It’s just confusing me.

@Dxouser For some reason, I found placing the spot on the wall behind, then raising exposure by 2 stops and drawing S shaped curve seemed to work. Also made rectangular shape over cab and raised exposure by 1.7 stops.

Here is the pp3
Playraw_spidermonkey.NEF.pp3 (24.2 KB)

Looks OK to me, but not as good as some other people’s