Contrast Management RGB : A new scene-referred approach (POC)

THX for sharing your thoughts Christian … I do fully understand your thoughts . Specially to discuss this AI stuff here in your thread … there is enough of these things going on in other threads .
I give you all the time … personally .
Would it be ok with you … if I compile it for myself , if I can manage ???
Just for personal use …

Have a nice weekend

Andreas

1 Like

Hello,

After careful consideration, as a free thinker, I have decided not to impose my vision by removing the AI integration. However, the models will not be pre-loaded or automatically fetched ; users who wish to use these features will need to download the models manually from the darktable github. This ensures that the use of these tools is a conscious and informed choice on the part of the user.

Here is the link to the latest version

Greetings from the Luberon :herb:
Christian

5 Likes

Wise decision … of yours !!!

2 Likes

Has this module’s development now come to a halt?

The discussion has certainly gone quiet on github. @jandren how’s it going over there :slight_smile: ? Wish I could help but I have zero relevant programming skills…

Hello,

Just so you know, I haven’t given up on developing this module; I actually fixed a bug related to masks yesterday.

The code is available on GitHub, along with the latest version of my experimental fork.

Greetings from the Luberon, :herb:
Christian

2 Likes

Hi Christian. Glad to know you’re still thinking about this, and that you kept the fix as an individual commit so we can all keep track of it more easily.

I just noticed that with contrast & texture (the version in the pull request, without including any newer fixes), the snapshot looks slightly different than the live image. The workflow is: enable my preset in c&t, take a snapshot, turn the snapshot on, and I can immediately see snapshot is brighter in the highlights. It happens with or without high quality processing enabled.

Is this experiment fairly safe to install and run now without special options? I’m going to keep using my own darktable build, but I’d like to check if this issue can still be reproduced, and try to do it with a publicly available raw file.

1 Like

I just use the " experimental build " till its been started …
So far no issues … for the most part .
Here on Mac m1 … no special options needed .
Running quite stable from my POV
You get your own config folder for the build … no interfering with DT at all .
Well just my experience

3 Likes

I found this does not happen in your experimental version so you must have already fixed it.

1 Like

Hello,

Thank you for your feedback. I think that was the same bug I noticed in some of the exported photos.
Since the last update, the module seems to be working properly.

Greetings from the Luberon, :herb:
Christian

Need to check that fix out then!

I have been working on a mergable first step late evenings, making progress but takes some time. Been spending a lot of time with the noise handling, do you have any examples of when it works well on high ISO images Christian?

8 Likes

Hello,

Thanks for the request. I revisited an old treatment and, to be honest, I was a little disappointed with the results.
So I spent the evening going over that small block of code and decided to try a different approach: adjusting the gain based on the pixel’s luminance.

// Noise protection — attenuate local contrast gain in low luminance
if (d->noise_threshold > 1e-6f) {
     const float floor = d->noise_threshold * 8.0f;
     const float ratio = fminf(lum_pixel / fmaxf(floor, 1e-6f), 1.0f);
     const float attenuation = ratio * ratio * (3.0f - 2.0f * ratio);
     correction_ev *= attenuation;
     }

We could reduce “noise_threshold” down to * 5.0f, but I still need to run some tests.

My goal isn’t to work with high-ISO photos, there are other modules for that, but to protect the shadows and blacks without introducing noise in the low-light areas.

Here’s an example using an image from a Playraw
In this example, I pushed all the local contrast sliders all the way up, so you can clearly see that I created noise in the blacks, and on the right side, we removed it using the “noise threshold” slider.

In this second screenshot, I disabled the “Contrast & Texture” module, and we can see that the noise present on the left side was indeed created by excessively increasing the 5 sliders


The code is available on GitHub, along with the latest version of my experimental fork.

Greetings from the Luberon, :herb:
Christian

4 Likes

Many thanks for this module. I have been using this Appimage. Is this module included in 5.6 release? Actually, I have problems with 5.6 after installing. So, I fall back to this Appimage or 5.4. Sorry, I am a newbie and know little about the technicals…

1 Like

No, this is not part of version 5.6. I believe the dt core developer evaluating and integrating this module is busy with other things for now.

Edit: I was mistaken. This module is being actively discussed by the developers on github.

2 Likes

Time for an update!

I volunteered for working on bringing this functionality to darktable earlier this spring and I have finally managed to pull it to the first of a multistage process to include it. Stage one is to merge a initial version of the module with minimal code that we can then build on with further additions.

I made a couple of changes and want to get some feedback from you before handing it over to the maintainers for review.

  1. The parameter for the size of the filter is now logarithmic 1/2^{detaillevel}, I think this makes it a lot easier to adjust for small features. Please try and see what you think! Adding the multiscale feature would then be as simple as instancing filter [-2, -1, 0, 1, 2] away from this slider value :slight_smile:

  2. Edge protection is also a logarithmic slider that adjusts the weight from a underlaying standard value which I inherited from Christians work. Please give feedback on potentially adjusting this value so that we most of the time are fine with the default value.

  3. Readded filter iterations as in tone equalizer but with one change, I try keep the edge protection constant when the iteration value is changed.

  4. Finally noise handling, first of all the effect of this slider is visible when enabling the mask so that it easier to understand its effect. I also propose a new method where noise is handled not by adjusting the scaling factor but by making it “irrelevant”. Basically most noise problems are in the dark shadows due to that where the signal to noise ratio becomes really bad which really shows the you take the log of a value. I simply add a fake signal bias before the log which fakes a higher signal to noise ratio and thus removes the noise problem. Any true signal will also drown in this but I think this is to be expected for any noise handling. Again, the effect is now clearly visible in the mask preview so I think it should be quite self explanatory that way.

Would be awesome with some user feedback before I go ahead and make a PR out of this first step. You can find the branch here: GitHub - jandren/darktable at add-contrast-and-texture-step-one · GitHub

20 Likes

I gave it a quick test, I think it’s really good. Very hard to overcook the image with it, the algorithm is fast, it looks great, controls are intuitive, etc. IMO darktable is missing a nice local contrast module and this one hits the spot.

7 Likes

Thanks very much for your work on this @jandren.

I’d be very happy to test this out if a Windows exe could be made, but no problem if you can’t.

I checked out the branch but when I build it, there is no contrast module so I’m not good enough with the build files to check and see if there is an issue…it might have to be added to a file so that the build script will include it?? Or I may have done something wrong??

1 Like

Which branch did you checkout? origin/add-contrast-and-texture-step-one?

1 Like

I did… Checked current branch to confirm but it was late I might have done something wrong …:grin:

1 Like