Experiments with a scene-referred local contrast module - proof of concept

I agree with this stance, even though I imagine that the spectrum of reactions will be… broad :slight_smile:

DT’s codebase is large and complex. Documentation in the code is present but not sufficient if you are an outsider. An LLM can do quite a good job of explaining how the different parts relate to each other, suggesting an implementation plan and sketching out an initial draft.

Then one has to go through it, make sure that things are done in the right way and that are not introducing any unwanted side effects. The LLM can do its part also there, as well as in finding subtle bugs that would otherwise go unnoticed (they are also very good at making up bugs that do not exist and implementing unrequested features, by the way, so it’s important to use them very carefully).

In the end, the quality of the code needs to pass the bar of the technical review from the core devs, who I am sure are especially thorough when they look at code from an outsider.

As long as it not AI slop, but well thought out and well implemented code, the question of how it was written becomes a bit irrelevant to me.

If (1) a module does something useful, (2) users like it and (3) the code is good, it would be a bit funny to turn it down just because it’s not 100% human-generated code. But again, it’s at least fair to disclose if the code is generated for the reason that @sqrooty pointed out above.

2 Likes

@priort , maybe you picked the previous version for your latest Windows built. It has the same file number and I can’t find the noise protection and CSF sliders.
Anyway, thanks for providing these windows versions so quickly.

Hello,

For your information, I have included two modules to test:

  1. Pyramidal contrast - without the addition of the two sliders.
  2. RGB contrast: with the addition of the two sliders.

My goal is to compare the two in order to be certain of their added value before going any further.

Greetings from Brussels.
Christian

Thank you for your constructive comment.

I completely agree; we are in an OPEN source environment.

Have a nice day,
Christian

1 Like

Yes thanks. I don’t see the RGB contrast module, just the Local contrast rgb (with color sliders) and Pyramidal contrast.

Hello,
Indeed, I just checked. The RGB contrast module is not present. I checked on GitHub, and the files seem to be correct. iop_order.c , CMakeLists.txt
To be honest, GitHub is not my friend :wink:
I’ll try to compile a Windows version on my “Win 11” VM at the end of the day, if Atlas OS hasn’t cleaned up too much.
By the way, I have the impression that this latest version is more responsive, but this needs to be confirmed.
Thank you for the information.
Christian

@Suki2019

Do you have more than one version of darktable installed on your computer?

Is the version of darktable that you are saying is slow found here: C:\Program Files\darktable\bin\? If not, change that to where the version you want to test is at.

Is the executable “darktable-cli.exe” found in the same directory as the version of darktable you want to test?

Is the XMP sidecar file found in the same directory as the photo? (some people do not have the option turned on to create XMP sidecar files, that’s why I ask)

When you open terminal, are you actually in terminal or are you in PowerShell? (I ask because I have my computer set to launch PowerShell instead of Terminal)

Open Terminal (or PowerShell) and go to the directory where the image and sidecar are located.

Run the command from there.

If you get errors, what are they?

If you do not get errors, wait until the command prompt returns to the screen.

The log file ‘GT950XT.txt’ should be in the same directory as the image and XMP file.

If you are in PowerShell: remove the quotation marks: C:\Program Files\darktable\bin\darktable-cli.exe DSCF0001.RAF DSCF0001.RAF.xmp test.jpg --core -d opencl -d tiling -d perf -d pipe > GT950XT.txt 2>&1

Upload the log to DT Performance Analyzer.

1 Like

My bad - I wrote that in a rush. My post should be read as follows: If “I don’t find this question [whether an LLM suggested these concepts or wrote the code] necessary to ask.” is an opinion that is generally shared by the majority of this forum community, then I’d prefer to not be an active part of it. Glad to hear that this is not the case.

To be clear, when I am referring to a “commit”, I am referring to its contents, not simply its message or the act of adding it to a Git branch.

Thanks for disclosing! I’m glad I asked :smile:

No worries, DeepL works pretty well in my experience. It can sometimes mess up the tone of what was said a little bit, but I don’t think that this is happening in your posts.

1 Like

I would like to point out that it is not AI that initiates a project or a development approach; it is just a tool like any other.

The CSF concept was born following an article I found during my online research, which was the starting point for this idea. https://www.sciencedirect.com/topics/engineering/contrast-sensitivity-function.

I have just finished testing these two additional sliders and I realize that I was mistaken about the temporality of its effect (CSF) on the different scales. It only acts on micro contrast and in an unweighted manner, which was not the intention. In light of the initial reactions, I have decided to halt development of this noise/CSF concept. I will revisit it later out of curiosity and for personal purposes.

I am returning to the “pyramidal” and “merged” proposals. It’s up to you to decide what to do with them!

2 Likes

:slight_smile:
Sorry it was a rush job before heading off to bed…

Here is a do over…:slight_smile:

https://www.dropbox.com/scl/fi/rdbfkkf9wxvmtiwpbxyzx/darktable-5b94d20a03-win64-NSIS-deprecated.exe?rlkey=gy4mtjy47ntrh09t8qsbe8ovd&st=jukqghp9&dl=0

3 Likes

Todd, thanks for taking the time to create these, it’s really appreciated! One of these days I’m going to figure out how to do this for myself (or go back to Linux).

1 Like

Its really not too difficult I would be glad to try and assist you … I think the latest build instructions for Windows are decent and work well…I haven’t read them in sometime but once you set it up a script does most of the work…

3 Likes

I will some day take you up on that offer, thanks!

Gave your latest version a try:

I like pyramidal contrast a lot. For quick edits its possible to set local contrast on the different detail levels. I also like that the scaled version is available via a dropdown.

Since you already included a “feather fine tuning” dropdown it makes me wonder whether we could get rid of the “scaled” version by having a second dropdown for the individual scales? Then It would also make sense to put the feature scale into that dropdown. Currently I still feel like having a global feature scale that is automatically linked to all detail levels a bit cumbersome and “half baked”.

Contrast RGB seems bugged for me. Increasing the e.g. micro contrast slider decreases fine contrasts and seems to boost coarse contrast…?

Currently don’t have enough time to get into the visual adaptation you added in contrast RGB.

2 Likes

Developing two (or even three) prototypes, as it has been done, allows different UIs to be tested and compared. However, in my opinion, a solution such as the one proposed in the latest version, where the two prototypes are more or less kept as they were and “stacked” in the same module, is not a good solution for a module that has not yet been “released” (other modules may have evolved towards this after additions/updates, but it seems avoidable in a first release).

Testing the two UIs, with their respective parameters, should make it possible to identify the strengths and weaknesses of each, compare them, and ultimately arrive at a single proposal.

@masterpiga for example, has made an comparison and a proposal that follows this logic. The proposal is debatable I am sure, but at least it goes in the direction of a unified solution, which I find positive.

I would add to the discussion: what are the use cases to be covered? Modifying several scales at once is interesting, but the use case of adding local contrast to a single scale (as can be done with the “local contrast” or “diffusion or sharpness” module for example) probably is the most common one.
For this use case, I find the “per-scale” mode of @Wilecoyote simpler and easier to understand than the “pyramidal” mode when used for one scale. For this reason, I don’t really agree with the “expert” characterization for the “per-scale” mode, which I find simpler with one scale. And at the same time more precise when I want to modify several scales.

@Christian-B I hope you don’t take it harshly, it is not my intention! I hope to give a constructive feedback.

2 Likes

Not at all, I just compiled an appimage that combines the four proposals in this post so that I can test them in parallel. That is:
the latest version from @wilecoyote, the author of the algorithm
local contrast rgb

Jandren’s proposal: local contrast - RGB channels

My suggestion: pyramidal contrast

and finally, the last one: contrast rgb, which combines @wilecoyote’s suggestion and pyramidal contrast according to this schema

In this version, I abandoned the CSF idea and carefully reread the code, adjusted the values of the various sliders, and updated the tooltips.

Here is the latest appimage, thank you for testing it.
https://drive.google.com/drive/folders/1zahcvlAyaN03L1VmX5esOOyhBkO8jiko?usp=sharing
The code can be found on LC-test branch GitHub - Christian-Bouhon/darktable at LC-test

You’re right, I noticed that too, that if you pushed the micro contrast slider a little too far, there was interference with the CSF.

My first tests were so encouraging that I published them straight away! Big mistake on my part :frowning:

I’m sorry for the wasted time and to everyone who tried it.

Thanks again for your feedback,

Christian

1 Like

https://www.dropbox.com/scl/fi/4o2unia5r4gt3sdr549du/darktable-4411bffb6c-win64-NSIS-deprecated.exe?rlkey=w9zjl8ts2csntgnwvd7mveeol&st=fphgdg0g&dl=0

3 Likes

I’ll respond with a screenshot. :slight_smile:

The whole thing from my laptop.
I noticed that the resulting file is stored in the location where CMD is currently located. Most recently, this was system32, which is write-protected by default. That’s probably why I couldn’t find any files there. As you can see, I have now created a separate folder. The only problem is that the file created does not display any data in DT Analyzer.

See attachment for file.

GraKaLaptop.txt (4.2 KB)

Translated with DeepL.com (free version)

Its not finding the image see the last line in the file you shared at least or maybe that is what you are saying?? the log shows the process aborted…

For my testing of this I just unzipped the test files in downloads and ran the cmd prompt from the downloads path… and all good for the log files …they are created in the downloads directory…

1 Like