RT Would someone be so nice to explain to a stupid (me) a couple of things (retinex/dehaze)

absolutely not bored and i thank you for the information… i would look in depth the pp3 too

Excuse my bad English, I’m a grumpy old French.
I like to develop algorithms, some are simple, like Lab, others more complex like Retinex, others even more like Wavelet, or Locallab.

But actually, there is a lack of tutorials (and translation from french in some cases) for Rawtherapee, especially for algoritms that come out of “common sense”, such as Retinex, Tone-mapping or Wavelet.
Wavelet does not limit itself to a restricted view which consists of using only the contrast sliders.
Many innovations “wavelet” , especially for this image, can be used to reinforce the effects of contrast and perspective,
for example “Residual image” and “Final touchup” (compression, contrast balance, etc.)

Paradoxically I am not a treatment specialist: what treatment for such an image? So it’s not me who will develop the tutorials
But the result is above all a matter of taste :slight_smile:

I agree that there are trade-offs with retinex (as with any other tool), and of course the result is also a matter of taste. I was trying to do this with retinex, as I took your question as an excuse to learn (by experimenting) about it myself :slight_smile:

FWIW, I usually do this kind of processing with the tone-mapping tool, not with retinex. Though I’m not guaranteeing that you will like the result any more than my previous attempt :wink:

tonemapping.pp3 (10.1 KB)

alberto as i said u obtained a truly better result than me, and i’m thankful for your help i would lurk from your pp3 too and grasp some info from. if u give a look of the couple of link i posted u would see that retinex could do amazing thing, and i’m sure the implementation on RT could do the same, the thing is How…

Jdc, u give us a wonderful set of instruments, and in rawpedia there’s the explanation, and eg for wavelet is pretty extensive… but are too complex, to grasp (at least for me), without something simple and stupid, to follow.
The taste in the result is ininfluent in this case the scope is not have a pretty picture is understand a tool.

Ihmo is matter of have a basic example of how the tool work in order to understand it. And not playing in an empyrical way, a base to start from, the floor. where to put feet on.
EG:
As example in the link below we have, input various method, (unexplained) but i could grasp how it works, (the mask).
Non-Local Image Dehazing

In our case with Retinex (could be valid for everything)
I fatigue to find someone better than you that could make a basic example, input–>result, and at side the explanation of the parameters, and why,
is like teaching 1+1=2 to someone that do not understand the simbol 1 done with a couple of apples became more easy.

I understand that you could have, nor the time, or the patience or the will, you are already doing a lot of work, but is a pity, some instruments into rawtherapee are there, but are much more less used cause not undestood, and if u notice there’s just googling, when we come to rawtherapee that could blow out of water almost 90% of other software out there, there’s few too few or no tutorials on the advanced tools…
cheers.

The tool in RawTherapee which is now called Retinex was originally called Dehaze. I too am curious as to how it could be used to remove haze from the distant parts in the middle of this image without significantly affecting the rest.

@graypixel
You are not at all stupid, nobody is stupid, I recognize - the reproach has already been made - that the explanation I give for Retinex, as for Wavelet better explains the algorithm (how it works, its principle, … ) than its operating instructions (what to do, what to do to obtain a result).

Some time ago, Paul (Paul Matthijsse) started a process of developing tutorials, but for some time I have not seen anything new.

I will try, on a more significant example than the one you give, to describe an approach, but I do not guarantee anything. I would do it in French.

To be complete, I would also use “retinex in wavelet” in branch “Newwaveletgtk3” which is almost “dead” (no comment) for 6 months

@Morgan_Hardwood
To deal with what you are talking about, there is “locallab Retinex”

Jacques

@graypixel

Don’t worry about it. Everyone has to start somewhere. I often feel the same way because for much of my life I have been around terrible people who say and do terrible things.

But you know what? When you continue to ask questions and investigate, eventually what you are pursuing will make sense. I believe you will figure this out with the help of the good people here.

Also, you need to be super hands-on. Until you get a feel for it, like riding a bicycle or anything really, any amount of theory won’t help you.


You are on the right track by reading papers online. However, they tend to be, well, scientific and esoteric, which is hard to understand from an intuitive level.

  • Before doing that I suggest that you do a quick search on this forum. If you type “retinex” or “haze”, you will get lots of threads and posts that ask very similar questions. E.g., my post.

  • A website I enjoy is http://www.ipol.im/.

It is excellent because its papers are quite simple in comparison to the meatier ones that you have linked to. Each paper comes with a demo and its source code, which you can play with at your leisure.

Take a look under the “Color and Contrast” topic category. Don’t just look at “retinex” but read the other papers as well to get a better understanding of the topic.

Hope this helps.

Applied neutral profile, and adjusted exposure (+1) just to stretch the histogram. I think it is important to start with Retinex first before other manipulations. Previously I have applied Retinex after my usual edits, but always found it a bit too much and have ended up reducing strength to very low values to control it.

Then switched Retinex method to highlights, HSL-linear.

Then applied a contrast curve to darken the darks back to normal.

Then reduced LAB chromaticity to taste.


_DSC4138.jpg.out.pp3 (9.6 KB)

3 Likes

@graypixel, I tried to understand what are various tabs in the Retinex tools are. Here is my first approximation to an understanding :grinning: Please let me know of my mistakes.

Method: High, Low and Uniform signifies the size of areas this tool will operate on. Therefore, the Low method will act on Foliage and small details and High method acts on broader areas like the sky or the town (in this example). In your example, we do not want to tamper with the green foliage so choose High method.

Strength is self-explanatory!

Radius also decides the size of details on which this tool operates. (So choose high radius)

This choice of Method and Radius automatically determines a mask which will be applied to the image and the tool is only applied to the white part of the mask.

Contrast slider seem to do the opposite of what one expects. The lower it is, we seem to get higher separation between low and high tones. (Does it act on the mask rather than the image?)

Process gives choices between seeing the image as it changes (Standard) or the Mask (genertaed above) together with Gaussian Blurr applied (so the edges are not sharp) or the mask with wavelet tool applied. We can further tweak this mask by the mask equaliser curve (which is just like the curve tool on luminosity.

By choosing to see the m ask in the Process drop down menu, one can see how the mask changes as we adjust the luminosity curve.

The Highlight slider protects the highlight with the width of highlight being determinable by the next slider. Same with Shadows slider.

After this we get the L curve adjustment (Like in L,A,B tab) and we can further add contrast by making the curve steeper. Then we have a tone mapper added to it (very thoughtful!)

I am yet to figure out the Transmission tabs.

Now, with this understanding (right or wrong!!!) I applied the following Retinex setting to get the following image. I have uploaded a higher resolution image so you can enlarge and see for artifacts.

_DSC4138-1.jpg.out.pp3 (10.0 KB)

Of course, before all this, I applied the D300 profile in the colour management tab.
Thanks for the image. It pushed me to overcome my inertia about understanding Retinex. Now if only I could read French :grin:

1 Like

@graypixel

I don’t use RawTherapee, so I am a beginner just like you. But I was curious about its implementation, so I gave it a try. Takeaways:

  • It is always helpful to toggle Before/After. I also zoomed in, enough to see the details but not to the point where I cannot see the overall composition.

  • Read the tool-tips. Hover the mouse over things and a tool-tip pops up to give you info about the control. The tool-tips are surprisingly detailed. Good job RawTherapee devs.

  • Unlike @shreedhar, I found Method:Low to be good because it heightens the detail of the far off city, which I like. I guess it depends on taste; which areas you want to emphasize.

  • Process:Transmission reveals the transmission map, which is what is going on behind the scenes under settings. This will allow you to observe what changes as you tweak the controls and curves. Through experimentation, you will begin to understand what works for you.

  • Transmission maps are like it sounds. Ask yourself this question: If conditions weren’t hazy, where would the light be? If you took this picture (I like it btw), you would have a good idea. The usual reason that retinex looks funny is that we tend to want to equalize everything.

These points are just from my experience. If I am wrong about something, someone please correct me.

so the "rt implementation of retinex could not give us the total removal of haze, like fattal algo or true algo.
ok i’ve to install the local lab version a step ahead :smiley:
Jdc in French in spanish in japanese :smiley: google translate help always.
Apart from jokes thanks, even for the i would look into doing that, i understand that would be an effort do that, and that u could not guarantee anything.

then, with james and shreedar we are are almost there, shadows a bit uplift but not “bitmap effect”,i’ve got an idea of workflow thanks to all you tomorrow i would try out and report… :smiley:

Afre if u give a look on rawpedia u will discover that retinex have a lot more to offer.afre i u could share you result,
only one thing, the scope the help i asked is in this case is understand how to remove haze with the aid of retinex mantaining the photo usable, taste is a bit secondary, cause once remove dthe haze we could think about of how make the photo pretty, if we manage to get the rid of the mist we would have a common starting point,

the trasmission is the key, how to manipulate that mask, correctly… for the result…

where would the light be? for that photo to be honest is right were is :smiley: i choosed that photo cause could be corrected, not cause really need to be cured, and could be prettier in various way, as shreedar have demonstrated using only lab curves.
I thinked this photo would be decent cause is not too badly exposed, the fog is more on the second plane, so a “standard” condition for a “dehaze”.
Retinex by definiton of the thing could work for a lot of different scenarios not only with mist or fog, with lights… recovery of part of a photo from deep shadow. think about concert or other much more harsh condition where this tool could be really useful once truly grasped.

ps thanks for the like of the photo, is one of a row, for a pano,. when finished i would post it here

@shreedhar
This is a good summary :slight_smile:

jacques

1 Like

_DSC4138.NEF.pp3 (10.7 KB)
The goal here was to see more of the rooftops and forest, so I cropped it down. Retinex and negative tone mapping were applied, other adjustments made to lightness, contrast, Lab* color effects.

The haze tends to de-contrast the offending area of photos, so I use a high radius shadow mode burn tool (a shadow deepening effect) in McGIMP…

Followed by highlight dodge (a highlight brightener).


This way I notice less haze and more roofs.

@graypixel

Effort is not a problem. :slight_smile:

What is problematic is pedagogy, because each image is different, and the tastes of each are different. One will prefer a natural image - one that the photographer has seen - another prefer an artificial image with reinforced chroma, accented contrasts, visible perspectives.
For all agorithms that are not “natural” (Retinex, Tone-mapping, and some parts of Wavelet), this problem will arise.
I will add to Rawpedia, at the end of the current sections Retinex, a summary of recommendations and an “average” frame.

1 Like

I have add, in Rawpedia, a “tutorial” for a Haze Image
http://rawpedia.rawtherapee.com/Retinex/fr#Un_exemple_possible_-Dehaze-_quelques_recommandations

The goal is not to do a “good image”, but to explain how to use Retinex…and Wavelet in this case :slight_smile:
Jacques

Good summary.

Jdc
yeah! really really really well done! :smiley: u have to think about doing this for everything,:joy:
is clear short and detailed exactly what needed…
from that example start to dig into this tool and re-read the section up of the example understanding the technical explanation is much more easy.

i’m playing a bit following the steps, then i would try to move them to my photos, as fast as i get a decent result for me i would post it, (too many things too few time…sigh).

Thanks to all, Afre HIRAM shreedhar Morgan_Hardwood james agriggio and off course to you Jdc, for the patience the kindness and this come out a really nice thread.

Thank you, I’m glad that this help satisfies you.
I have just made a few minor changes to “Rawpedia”, essentially syntax
:slight_smile:

This is my try at the image:
Uploading…
I did a little of everything, noise reduction, white balance, vibrance, retinex, contrast, lightness, dark level, exposition compensation, saturation, light compression, shadow compression.
_DSC4138.jpg.out.pp3 (9.8 KB)

I added the color component to “Retinex at the beginning of the process” (with the same principle as in Retinex in Wavelet and with a slider “chroma”).

For this you must use the branch “newwaveletgtk3”.

The “Chroma” slider acts as a percentage of “strength” (luminance component).

Attention, the processing times are doubled (if the chroma slider is> 0) and the memory requirements are increased.
:slight_smile:

1 Like