Who is familiar with Log Tone Mapping in ART? (Solved)

Hello Wayne_Sutton,
I think this is a good text for people who understand that. When I start reading it, the content blurs before my eyes because I don’t understand anything. I just hope that I will still learn to understand this tool. I’m prepared to work hard and chew hard and won’t give up if it seems too difficult today. I need more time and lots and lots of practice.

I will see if I can help. I am out baby sitting tonight … 6 year old granddaughter at a trampoline palace BD party… If I had a 10th heck 1000th of that energy… I will play with a few images since I don’t want to steer you wrong. As I said I am much more familiar with the nuances of filmic…similar tool…

1 Like

@micha
Trying to simplify is a difficult task. Explaining complex things simply is difficult. The notions of HDR and its counterpart SDR are complex and involve notions not used in everyday life.
Of course if I can contribute to understanding I am at your disposal.

To see another way of doing things than that of ART and that of DT (which are both remarkable) you can try on these subjects the "lacam16n’ branch, the PR currently under development.

In summary, I removed certain parts from the “Cam16” loop that were working very poorly.

  • Log encoding
  • Tone Response Curve and Midtones
  • Primaries and Illuminant, with CIExy diagram : you can choose predifine primaries, illuminant or manually change , gamut control, Refine colors (purity), etc.

https://github.com/Beep6581/RawTherapee/pull/6861

Executables
https://github.com/Beep6581/RawTherapee/releases/tag/pre-dev-github-actions

jacques

2 Likes

Hello @jdc,
of course you can contribute to my understanding, I would be delighted.

I have a few questions right away:

  1. what is "lacam16n’ branch, are you developing it?

  2. is this RT-lacam16n already suitable for use or still very young in development? I like that it seems to be a very good mix of RT and ART.

  3. the most important question for now is, when do you use this “Log Tone Mapping” or a variant of it? I’m not really interested in HDR images. But sometimes you have large contrasts between inside and outside when taking a picture, i.e. enormous differences in brightness. Is LTM good for this? So far I can do everything with the Tone Equalizer from ART or the options offered by RT. Maybe I’m just getting carried away with LTM and don’t need it at all.
    In short: When do I use LTM, what can it do better than the other tools?

@micha
Excuse my bad English, I am an old french man :wink:

  1. When doing development, it is often useful to make adjustments elsewhere than in the main code. For this case, here, the development of “Cam16 - Local adjustment”, I created a branch in the Github environment, which I called “lacam16n”. This allows other developers or users compiling to know where the code is located.

  2. This branch is accessible and usable without problem. Most of the principle and code is not (unless I’m wrong) used in ART. It’s Ciecam16 (Color Appearance).
    But I’m not saying it’s easy. For information, the concepts are significantly similar to those recently included in DT, but which have been in RT since 2012 (Scene, Display…)

  3. Difficult to give a good answer, but yes in general the conditions you describe are those where we can use “Log encoding”.
    But it is not the only solution. Often, and it is a question of learning, a user favors a tool, because he knows it. I think there is no right answer, but the right one is the one you master.
    For information:
    https://rawpedia.rawtherapee.com/Local_Adjustments#Five_ways_to_change_the_exposure_and_lift_the_shadows

jacques

1 Like

Ok, I’ll try to illustrate what the tool does in a simple, visual way.
For simplicity, I will not consider highlights precompression, regularization, and saturation control. These are just additional controls to fine-tune the tone mapper which do not change its fundamental behaviour.

For this, I will use a synthetic image, consisting of different bands of grey of different brightness. More, specifically, the image is in linear Rec.2020 color space, and the grey bands are exactly 1 Ev apart (meaning, that to get from band “i” to band “i+1”, when counting from the top, you simply multiply by 2 the value of the pixels). Here is the image:
mid.tif (3.4 MB)
There are 20 bands in the image, and the central one (the 11th) correspond to the “standard” mid gray with a value of 0.18.

Essentially, what the log tone mapping tool does is to remap the values of the image so that the following hold:

  • the selected “white relative exposure” (i.e. the value that is obtained by applying an exposure compensation of the given Ev stops to the middle grey value of 0.18), is remapped to 1
  • the selected “black relative exposure”, corresponding to the user-selected number of Ev stops below middle grey, is remapped to 0
  • the input middle grey, obtained by applying the selected “gain” to the standard mid gray of 0.18, is remapped to the “target grey point” value.

In its default configuration, this is essentially an identity operation, because:

  • the default “black relative exposure” is -13.5, and 0.18 * 2^{-13.5} \approx 0
  • the default “white relative exposure” is 2.5, and 0.18 * 2^{2.5} \approx 1
  • the default target grey is already 0.18, and the default gain is 0, so both the source and the target grey are already 0.18.

If you move the sliders, the following will happen:

  • increasing the “white relative exposure” will shift the white point, causing a higher compression of the highlights, leaving the mid gray unchanged;
  • changing the gain will move the source gray point, and as already discussed is equivalent to apply an exposure compensation to the input;
  • changing the target gray point will affect the brightness of the midtones, leaving the white and black points unchanged.

I made a video that tries to illustrate all of the above. Hope this helps.

6 Likes

Hello Micha,

I hope that Alberto’s explication of this tool will help you to better understand the mysterious part of it.

On the other hand, my opinion is that this log tone mapper isn’t the easiest tool to master. The Auto button often changes nearly nothing, exposure wise, and never gives satisfying results. Apparently this is not an auto-exposure thing, but something else…

I usually correct the exposure of my photos with the Tone Equalizer plus the contrast slider in Tone Curves, and if needed with some exposure compensation in the Exposure tool. Or I use the tools in the fourth tab, Local Editing, to do all.

That said, I exposed your photo by hand with Log Tone Mapping only - except for a slight increase of contrast with the Tone Curve tool.

B.jpg.out.arp (11.0 KB)

1 Like

Hallo @paulmatth,
Yes, I normally do exactly the same as you:

But here I would really like to get to know this “Log Tone Mapping”.
Your example is excellent, because you use it exclusively here, plus just a little “contrast”.

The main sliders here seem to be Target gray point and Gain. The others are presumably used to compensate for their unbalanced effect.

Your image example is very good to show the effect of the tool, even if too much of a good thing has already been done here, so that the cloudy evening mood is lost, but this is excellent for learning.

Unfortunately, you can no longer see the history in the saved .arp file. But, perhaps you could do the same thing again with several snapshots showing each stage of your settings. If it wouldn’t be too much extra work for you. Or you could simply describe with a few lines what you start with, how you recognize that the value found is sufficient and what you then continue with.
I think I will also benefit greatly from this, and so will everyone else who reads this.
So, thank you for this and thank you in advance for what’s to come, if you feel like it.
Micha

PS:
How can you understand that? The contrast is reduced with “Log Tone Mapping” and increased again with “contrast” in Tone Curves. The results are excellent. But isn’t that contradictory? I suspect that contrast is not the same as contrast. What is the difference?

Attached is the arp file with some snapshots. I have no “plan” when using the log tone mapper, I just change sliders, starting with the upper one, then the second one, etc. Then I re-adjust the sliders until something comes out that is reasonable.

B.dng.arp (79.8 KB)

1 Like

Hello Alberto,
are you kidding? … in a simple way?

Yes, there’s probably no easier way to explain why and how Log Tone Mapper works in just a few minutes.
I see the great effort you have made, but for me the numbers are and remain an unsolved mystery:

“black relative exposure” is -13.5, and 0.18 * 2^{-13.5} \approx 00.18∗2−13.5≈0 …

I fear, or hope, that I am not the only one who finds this far too mathematical.

But you didn’t do all this for nothing. I think I have a good understanding, especially because of the video, of what shifting the gray point and the white point means.
What an interesting graphic mid.tif is: It normally contains a lot of white, and with ART (also with Gimp), you can change the tonal values so that the white is gradually drawn again.

I have translated your text into German and copied it into my private ART-manual. I will read it more often and make sure that I understand more bit by bit.

Alberto, you have already made a short video about LTM, albeit in an older version of ART.

1st request: Could you make a video of the development with LTM with a suitable picture?The whole world of ART will certainly thank you.

2nd request: Could you describe in more detail which images give LTM an advantage over other tools such as Tone Equalizer? Or can you achieve the same results with Tone Equalizer as with LTM?

2 Likes

Unfortunately, the snapshots are not displayed for me. Do I have to do anything special?
Are mine displayed on your computer?
B.dng.arp (151.8 KB)

I’m probably only going to expose my shortcomings :slight_smile: but this is a non-technical summary of how I interpreted @agriggio’s explanation:

  • The lightest linear / unbounded value is mapped to bounded (display) white, or 1
  • The darkest linear / unbounded value is mapped to bounded (display) black, or 0
  • The “balance” of the grey (gradient) slope between these two values is determined by where the Target gray point slider is positioned.

I.e., using the two equations he provided, the brightest and darkest points are mapped to (display) white and black, with the center grey point being relatively set by the Target gray point slider. He’s basically remapping white and black relative to the Target gray point slider value.

Now, someone can correct me. :smiley:

1 Like

Now this is funny.

2 Likes

I think one thing right off the bat you could use is the jpg. If its still got deep shadows, bright sky etc then you know it has been tone mapped and processed and still it has DNR issues… Then to use the raw and to manage that and produce a better result your likely going to benefit from the Log tone mapper…

I think also when you look at the Tone eq map … it does appear that the “zones” are nicely feathered generally and I don’t exactly know how they are determined however if you hunt and peck with sliders in the tone eq you might sort of break the image tonality where as the tone mapping (with filmic or this sort of module) is a global edit with smooth gradients and can be used to capture (compress) the dynamic range and set you up for further processing… some of which might be the tone eq to fine tune things…

Hello Alberto,
I very much hope I haven’t upset you. My poor head, which is already 69 years old, is smoking. But for some reason I want to know.
I’ve watched your video over and over again and especially studied your text. Now I understand the two important controls: target gray point and white relative exposure pretty well.
And I took your “recipe, for most images” to start with target gray point to heart. And look: it works very well. For this picture I only use: Target gain +50, Gain -2 and with Tone Equalizer I make the sky a little darker and the result is very fast, just as I imagined.

I just want to tell you not to be annoyed if it takes me so long to understand.

Your efforts are bearing fruit. And for that I thank you and everyone who was involved.

Micha

1 Like

I am sorry if you didn’t understand something. That’s not what triggered me, I just took your reply in the wrong way, and I apologise. I did my best trying to explain how the tool works, and yes, this includes a little bit of math. I tried to keep this at a minimum, and in my view it was more like an extra, the video explanation would have been the main point.
Anyway, it’s all good now!

3 Likes

I am glad that we were able to clear up the misunderstanding.

I never questioned the quality of your explanation. I just realized that the way it works is too “high” for me and I understand so little about these numbers.
I just wanted to know how to apply log tone mapping. It was my mistake for asking how it works - there’s a big difference.

The video was very descriptive, but your text is hugely important to me because now I understand much better what the sliders do. This makes it much easier for me to see what they do in practice, I know what I have to pay attention to in order to see and understand the effect.

It has clarified a lot and now I have enough knowledge to practice and gain my own experience with it.

Big thanks to your patience.

The image Alberto provided is quite useful for seeing the effects of sliders, without the distractions of a real photo.

It’s not the lightest, it’s just the user selected value. The tool doesn’t clip anything, and brighter tones can still be compressed later (e.g. by a lut or by the new “base curve” options in the tone curve).

For me, “Target gray point” changes the mid tones the most, but also the dark tones and the black. Only the white remains untouched. Is that different for you?