New algorithm for White-Balance auto

You can find in the branch “autobwlocal” a new algorithm relating to the automatic white balance.
I called this algorithm “Itcwb”, for “Iterate temperature correlation white balance”.

This algorithm can only work correctly for illuminants:

  • Daylight between 4000K and 12000K
  • Blackbody between 2000K to 4000K
    Otherwise (Fluoresent, LED, …) results are impredectible and in most cases wrong.

You can find more information in Github



Bonjour Jacques!
It sounds very interesting.
Will you include it in the Local Lab branch?

No, branches are independant, it is the principle of branches
If everybody agree

  1. we can merge “Autowblocal” (or a part of autowblocal) in dev
  2. then merge dev in “newlocallab”…in some times…
  3. then merge “newlocallab” in dev, etc.


good strategy, thanks! :slight_smile:

@jdc I am very impressed by this. Awesome!

Thank you very much.

edit: I use the latest build from @gaaned92.
Version: 5.4-637-gd40ddf5c4
Branch: autowblocal
Commit: d40ddf5c4
Commit date: 2018-07-13

The only problem I have is: The “Auto iterate temperature correlation” function and the other AWB functions, work only on the thumbnail view, they (non-raw) don’t change the main preview in this build.

But with raw it is otherwise: then the main preview changes [as expected] and the thumbnail preview does change, but is not always the same as the main view.

All other wb methods (other then AWB) give same results (also with non-raw) in thumbnail view as in the main preview, as expected.

I hope this information is useful.

Hello guys!

I want to query, if the win64 compiled version for this branch is available somewhere?
Or, alternatively, when it will be merged with default version.

I do not see this branch in the list of nightybuilds at

Thank you.


@Mira_Studio Welcome to the forum!

The currently WB algorithm is supposedly the best out of all of those that have been attempted, though I don’t know which it is specifically. As for whether it merged into other branches, I don’t know. I have given it a try myself. Based on my usage, it isn’t as good as it sounds.

@Mira_Studio welcome to the forum!

  • Sorry, but unless dev branch is merged, I can no longer build this branch due to some modifications in my build scripts! And it is not in my archives.

  • @jdc is the best WB method of this branch merged in newlocallab? Is it worth to rebuild this branch? In that case could you merge dev?


There is nothing from “autowblocal” in “newlocallab”

It is very difficult to update and merge “autowblocal”…in one year Rawtherapee changed a lot, and I think it’s better to rebuild everything from a “dev” branch to date.

I just started this job today after 9 days of absence… big big job!

I create a new branch “autowb” with ITCWB…
I am not yet satisfied with the result, I had to forget something …In some cases all works well (as branch “autowblocal”), but in some cases no… but you can test…


Glad that you are revisiting ITCWB. Once it is more consistent, I will give it another look.

There is no changes in algorithm… this one is very complex…

But my difficulties are with many many updates and changes in Rawtherapee, that leeds to bug…not the algo…

I see. In any case, I welcome the reintroduction. :slight_smile:

Je vais faire un rappel en français sur “comment fonctionne ITCWB”…je suis incapable de la faire en angliche

La quasi totalité des algorithmes de WB auto, utilisent une ou des méthodes relatives aux “gris”. On cherche par différents algorithmes à trouver un gris et donc l’équilibrer.

C’est le cas de “auto” actuel, mais aussi dans “autowblocal” de “autoedge”, “autorobust”, et “auto standard deviation”, 3 algo que j’ai trouvé dans la littérature universitaire et qu’il a fallu traduire en code.
Ils sont satisfisants…quand l’image est équilibrée … mais dès qu’il y a des couleurs dominantes cela ne marche pas.

J’ai lu un document de chercheurs Coréens (heureusement en anglais) qui évoquaient quelque chose de supérieur, en ne recherchant pas le gris, mais en comparant les couleurs à des références. le texte est laconique…

Je me suis attelé au travail et ai imaginé un algorithme entièrement de mon cru…

En résumé, il y a 200 couleurs spectrales, qui représentent sensiblement la palette des couleurs visibles.
D’un autre côté j’analyse l’image en découpant les valeurs xy en en gros aussi en 200 paquets

Ensuite j’applique à chacun des lots une loi de colorimétrie, exacte pour les couleurs de référence et celles de RT pour les couleurs réelles.

Je compare les probabilités (méthode de Student) et choisis la meilleure.

Mais pour compliquer l’ensemble le système est plus que sensible au “green” (la teinte), donc je fais varier la teinte en amont, applique l’algo ci-dessus et choisit au bout du coimpte le meilleur couple, gris température.

Cela ne peut fonctionner que si et seulement si, le CRI (Color Rendering index) est à 100, c’est à dire soit une lumière du jour pure, soit un corps noir pur. Dès qu’il y aura des LED, des fluo…cela ne va pas marcher ou mal.

J’ai beaucoup simplifié…


1 Like

Thanks! I forgot most of the French that I learnt from school but your explanation was clear enough for me to understand.

Guys, keep it up, the Auto BW alhorithm which is currently in dev does not work well either. Simpler to set color temperature by the table, which is about 5280 for the Sunny in Northern Europe and forget the rest. The results will be consistent and white will be white. We hope that this new algorithm you have designed will finally solve the major difficiency of the native algorithm in RawTherapee, which is nevertheless AWB the best program so far. Thank you a lot !!! Your MIRA team.

I think, to verify that now branch “autowb” seems to work :slight_smile:


Temperature (and green ?), are a function of the latitude…
The more lattitude is high, the more temperature is high. Where I live south of France, it’s about 4700K.
In some images (north) I have, temp (at noon) is about 6500, or 8000K

In this case, even if the white balance is good, whites are “yellow”…

I explain myself, the white balance is a mathematical operation whatever the method.
But our eye, our brain reacts differently and compensates for this difference, by a chromatic adaptation.
In ours softwares, there are 2 majors adaptation “Bradford” and “cat02”
If you look some profiles who are not to D50 (ex AdobeRGB D65) they includes a chromatic adaptation.

In the cases of white balance, it’s the same thing : software realize mathematic, then I think, except if you research special effects, you must execute “cat02”
Actually there is 2 ways to do that

  1. uses Ciecam with 2 temperature…not easy; This functionnality was asked me, by “Elle Stone”.
  2. uses branch cat02wb, realize this function automatically.

To note , these 2 functions only works with CRI=100, that is to say, pure Daylight, or pure blackbody.


1 Like

Thank you for explanations.

I have PhD in Image Processing and produce profiles for Raw Therapee for camera professionally based on

We apply color management on all stage of the process, and make highly accurated profiles for the camera that can be used with RawTherapy as image processing profiles. It makes all the color real and appealing and all bits of information recorded by the sensor are used. This process is based on our 40 year old research in human vision and its modeling for creating the AI systems.

Therefore we cannot tolerate color shofts or make guesses on color temperature. We profile all the stage of the algorithm measuring teh ourput with profiled spectral camera for 8 basic colors of the spectra to maintain the consistant responce. It is rather difficult to explain the thecnhology in brief.

We are using RAWT 5.5 since version 5.6 has introduced some changes resulting color shifts and inconsistency with the very same image processing profile. Unfortunately we do not know the reason for that and we have not traced what has been changed since 5.5 as we were busy with our algorithms and vision models. It is strange that when we use our profile for 5.5 everyhing looks perfect, when we load it in 5.6, we see that colors go out of gamut, and out of histogram. We do not understand thsi behavious and like to discuss it as well.

The color temperature in Finland, where we are, as well in Latvia, where is our testing unit, is about the same at noon, and we have used (for Latvia) measured about 5860 K. Surely it changes with the time and with the latitude. Again we use actual values we have measured by professional equipment. Thank you again for your responce

Eugene at MiraStudio

ke 26. kesäk. 2019 klo 9.39 Desmis via ( kirjoitti:

If you can provide a raw file and all relevant profiles (pp3, dcp) we can have a look.