How to use Retinex

(Olaf Berthelsen) #1

I’m currently exploring the Retinex facility under the exposure tab. It is not easy to understand, but it has helped a lot that the Rawpedia documentation has been translated from French.
Here is my first attempt improving a photo taken a foggy day following the guidelines in “A possible example – Dehaze – some recommendations” in Rawpedia.
I welcome comments and suggestions. Can anybody do better and how? The contrast maybe too harsh I think, but lowering the contrast brings back the fog.


You can download the original raw file, the pp3 file and the colour input profile used (remember to uncheck “Baseline exposure”) following this link:

(Shreedhar Inamdar) #2

Well, better is not the word I will use. I would say differently. Here is a different approach without using Retinex. Just the Vignette, graduated filter and LAB tabs together with your dcp profile (with baseline exposure checked!) and setting the white balance on the road markings. Have a look.
There is a bit of haze left. I thought it gives a sense of mood, so did not aggressively remove it.

DSC_7177.jpg.out.pp3 (12.0 KB)


The difference is also that you left some blue.

Many times after (heavy) editing a photo, I find out that I lost a color. It happens unnoticed. But when I look again, after an hour, there is something missing…

Often it is blue…

(Olaf Berthelsen) #4

I think you result is much “better” and much easier to understand. You succeeded in transforming a foggy day into something almost like an nice and sunny morning. I like it very much.

The question is then, what can a Retinex do that you can’t do easier using other tools?

(Shreedhar Inamdar) #5

Thank you @obe, it is a very nice photo.

Actually, you had a specific query about using Retinex on this particular image. Thus, for the first half an hour I did try to use that tool to get a result that is satisfying to me. But I failed. Then, I started all over again from the Neutral profile and spent another half an hour or so to finally get something that I was happy with. Then I debated for some time whether to upload it or not because it strictly speaking did not answer your question. Therefore, I am happy that in the end, you liked the result of my efforts :wink:

Now, to answer your question about uniqueness of Retinex, I feel ( due to my experience with RT over a period of time) that the correct approach to use RT is not about using a particular tool but to have an idea of what one wants to be the final image and getting there one way or another. RT is not a collection of tools that operate on disjoint circumstances. Rather, it is an amalgamation of (almost) all possible tools that can be applied in a non-destructive way to a RAW image. Thus, many other tools may combine to make some particular tool completely redundant. RT is not bothered about it. I really like this approach because, it gives you a choice to reinvent yourself in a familiar setting of a known programme (rather than having to know a new set up to get hold of new tools).

In short, it is my understanding that the inclusion of the Retinex tool in RT need not necessarily imply that there exists a circumstance that can be tackled ONLY by it. Of course, there are more knowledgeable people here and will like to know what they say on this. Cheers.

(Olaf Berthelsen) #6

Thank you @shreedhar for your answer.
It made me recall a comment from a frequent and heavy user of Photoshop I once read. He wrote something like this: One of the lessons I have learned over the years is that you can achieve almost the same result by different routes, that is using different tools in different combinations. You are more or less expressing the same and it’s of course true.

How do you go about becoming an experienced and skilful user of RT? RT is not easy to master, I think. You have to put a lot of effort into it and in many cases the documentation is not easy to fully understand. This is also apparent from reading the posts in the forum. You also miss all the books, articles, youtube videos and all the stuff you can Google in the Photoshop (Elements) world.
So you have to edit a lot of photos and try out the different tools. The photo in question was taken specifically to test the Retinex tool which was, and still is, somewhat of a mystery to me. Earlier this year I tried to translate the French documentation into English using Google. The result was “interesting” and not that helpful! Now the documentation is in English and I decided to have another go at Retinex.

I’m still more or less left with the question: What are the best qualities of Retinex? When should I go for Retinex as my first choice editing a photo taking into consideration that one has only limited time to tune each photo?

(Thomas) #7

For comparison: Darktable with haze removal module (standard settings) only, plus base curve and a little tone curve adjustment.

DSC_7177.NEF.xmp (2.5 KB)

(Olaf Berthelsen) #8

Very nice indeed! Apparently it’s also very simple to achieve this result.

I Googled Darktable the other day and learned that there is no “official” and reliable Windows version of Darktable available, so Darktable is not really an option (for me). Is this still the situation?


@obe, there is an official Darktable for Windows, look here:

darktable for Windows

(Desmis) #10

If you want to have all the features of Retinex, you must use the branch “waveletnew”.

In this case, you have:
a) Retinex in wavelet (wavelet panel)
b) In Exposure panel / Retinex, I added a slider “chroma” which allows better rendering of images with haze



(Olaf Berthelsen) #11

Where do I find “waveletnew”? Is it in RT 5.3?


(Desmis) #12

If you can compile. Use branch “waveletnew” and then compile, last commit is 9905bda from today

If not, and on windows, @gaaned92 gives you this link with various Win64 builds

(Olaf Berthelsen) #13

Thank you very much.

It’s of the course the build named “waveletnew”-something I should use. I have downloaded it and will try it out tomorrow.


(Olaf Berthelsen) #14

Having spend a few hours experimenting with waveletnew I have reached the following conclusions:

  • I have grown more fond of the Retinex tool (in the Exposure tab) because it doesn’t change the original colors removing the haze unless you want to of course (using the new chroma slider)
  • The chroma slider is a very nice improvement
  • Tuning the photo in question I get a much better result choosing method “High” instead of “uniform”. Why is that?
  • You have to use the Transmission map equalizer and most important the Gain transmission equalizer to obtain a good result
  • It is annoying to scroll op and down all the time to control the “Settings” when you work with the equalizers
  • I need to study Retinex in wavelet closer. But it is more less the same except that you can work on the residual image or the final touch up. Isn’t it?

Below you will find the results various tuning. I’m sure I could have produced better results if I had spend more time tuning and tweaking.

When will the waveletnew be included in a regular release?

I welcome comments and suggestions.

Photo with the RT raw default profile:

Retinex turned on default settings no other changes

After having changed the equalizer settings

Same as the above photo but now the chroma slider is moved

(Desmis) #15

As I have already said elsewhere many algorithms used in photography are empirical or rough , as WhiteBalance, Color Management and sometimes with no real scientific basis as Retinex…

But it works, and it is the main result

The choice between “High”, “Low”, “Uniform” is dependent on the distribution of luminance, the more we will have highlights in the picture more likely “high” will be recommended … but the best is to try.

if I added the 2 equalizer, it is obviously not for the developer’s pleasure :slight_smile: but because it seems to me a necessity. The use is not obvious, and thank you for emphasizing the utility of these 2 curves.

I understand what you mean for “Settings” and “Equalizer”, it is a GUI problem. I’ll have a look, but without warranty :slight_smile:

Retinex in Wavelet add wavelet complexity, and I think it’s not very easy to have good result, but it’s allow work on JPG, TIF,…

For including “waveletnew” in “dev”…I don’t know :slight_smile:

And many thank you for your testings !