Highlight reconstruction darktable vs. rawtherapee

Wanted to share quick extra thing… if I lower the exposure slider in DxO Photolab some more (manually, from it’s default ‘preserve highlights’-detection point) and then export as a DNG with no further edits (I have to make sure to use the ‘write normal full dng’ option, not the ‘optical corrections only’ thing, that doesn’t apply DxO’s reconstruction to the DNG and prevents Darktable from applying theirs :frowning: ).

It renders the sky as this in Darktable:

Which makes more sense compared to the others :wink:.

As another dirty ‘maybe it works trick’, instead of messing with local contrast after filmic or other things, you can use the tone equalizer to lower bright parts. As a sort of simple ‘thing to try’, I apply the tone equalizer preset ‘compress shadows/highlights (eigf)’ in soft/medium/strong. But I do two things:

  1. Since I want to only affect the highlights, I reset the curve in the darker parts. I do this by simply double clicking the sliders in the ‘simple’ tab:
    image

  2. To prevent me from having to mess with the exposure compensation and other parameter in the tone equalizer, for simple things I often try placing it before the exposure module in the pipeline (ctrl-shift dragging in Windows):
    image

I’ll upload the DxO DNG output and my Darktable sidecar file for this.
Although it’s kinda besides the point for this topic, since I’m bypassing ‘dealing with magenta’ by having a DNG from commercial software with it already prefixed…

The same rights apply to this DNG as the original CR2 from the author.
If the file needs to be removed for some reason, drop me a DM or any mod is (of course) free to act on it.

2014-05-30_19-47-01_fix-1.dng (50.2 MB)
2014-05-30_19-47-01_fix-1.dng.xmp (15.7 KB)

Thanks for pointing it out to me !
But I am still thinking ‘reconstruct color’ ‘color propagation’ is the same algorithm. Is that correct?
Why does Darktable give artifacts but RT doesn’t in this case ?

I don’t know where you read that they are the same algorithm. They work on different data (demosaic vs raw) and looking at the code they don’t really look the same.

See the RT header:


////////////////////////////////////////////////////////////////
//
//      Highlight reconstruction
//
//      copyright (c) 2008-2011  Emil Martinec <ejmartin@uchicago.edu>
//      copyright (c) 2019 Ingo Weyrich <heckflosse67@gmx.de>
//
//
// code dated: June 16, 2011
// code dated: July 09, 2019, speedups by Ingo Weyrich <heckflosse67@gmx.de>
//

DT first reconstruct color commit:

Probably the DT color propagation module is more similar (but not equal). I tried to use it sometimes putting it before the exposure module but it doesn’t always work and only with some filmic norms like none.

RT color reconstruction gives quite always really good results and also works on Fuji X-trans CFA and linear DNGs. I just miss the ability to tune some knobs.

Also If both this and also DT highlights reconstruction module could have multiple instances and masks it’ll help users to apply different reconstruction logic to different image parts.

I’m fine with this and any other use.

I didn’t read it , I assumed. So my (to be honest, expected ) mistake . They seem similar in name and results everytime I tried them.
My linear DNGs don’t open well in RT so i don’t know if it even works there or not. In DT the behavior is also quite different with a linear DNG (of the entire highlight reconstruction module to be honest ) so things line up. Same kind of name , same results (in my testing ) , same limits…

… and i just assumed that if one had clearly better results, the algorithm would’ve been shared already.

Here is the information about the highlight reconstruction algorithm that is in development for Darktable

If you are familiar with testing development builds, please give it a go.

2 Likes

I have to agree that I wanted to try masking and using multiple instances of highlight reconstruction. I presume there are logical reasons this is not an option.

Would there be value in offering two options for highlight reconstruction where one is before and the other after demosaicing? Could the code from RT be adapted to DT for this purpose?

I presume there’s no windows build yet? Maybe @priort’s next weekly(?) version will have it? Looking forward to trying it out :grin:

Ha you are fishing…maybe have a go at getting set up to do WIndows builds… not too hard …

Build it from here until it gets merged…

If I have some time tomorrow I will build and post a version

Hi Todd, yes I was hoping you might bite… :wink:
I should look into building! Not sure when I will though :thinking:
Don’t hurry to build a version on my account - but it would be great :face_with_peeking_eye:

2 Likes

Wow!!! that was quick :grinning: now I want to try it instead of doing the work I was going to do… decisions…

Thanks Todd!

1 Like

Quick attempt with new HLR mode…

Second one with a bit more color…

You will need a build with this mode to open this…
2014-05-30_19-47-01_01.cr2.xmp (10.9 KB)

2 Likes

That looks good… one of the best DT versions yet IMO. (viewed on my laptop again - which is calibrated but has only 68% sRGB…colors sometimes look a bit off)
Edit: I might actually say the best yet.
Edit no2: At this point I think it’s a toss up between this one and one of @kofa’s using laplacians HR

Obviously I can’t make my mind up :roll_eyes:

Mine are a bit crushed…I used the tone eq to raise the foreground so tweaking that would likely improve that and some masking to protect or enhance some aspects… also I just pushed around the sliders on the new mode I really have not control over it or idea what I am doing :slight_smile:

I didn’t try to do a “best edit” at all. A few comments though

  1. Unfortunately the “whitepoint” is not exposed in a proper exif tag in this image, instead canon chose to use a makernote tag dt does not use so far. You can read that for example like
[hanno@fedora recovery]$ exiftool 2014-05-30_19-47-01.CR2 | grep White
White Balance                   : Auto
White Balance Red               : 0
White Balance Blue              : 0
Normal White Level              : 11767
Specular White Level            : 12279

and you should set the white point before doing fancy stuff. This will aide any hl handling algorithm (and more btw).

  1. You can now check much better the blown out sections, either by the “raw overexposed” button or the button in highlights module beside clipping threshold.

  2. To check for effect of any hl algorithm or compare i would switch off modules like filmic, color balance rgb, and reduce exposure so everything if easy to be evaluated. Your image will loke like


    , the xmp is
    2014-05-30_19-47-01.CR2.xmp (6.1 KB)

  3. Now try hl recovery or other algos and see how the colour cast is handled or details from unblown channels are used to keep details.

You may of course do how you like but this would be the technical way and would be the basis on all following modules. Masking stuff or whatever method you choose would always like “best available” in the input stage. Plus: colours are “calculated” in the demosicer and all algos used in that module would like best input data too.

3 Likes

Thanx for all the input. Judging from the shown results, the new tool look very promising. Will have a look on my desktop how well it works the next days. Is there a snap version for unstable, or do I have to build it on my own? And special thanx are going to the dt developers, for making a brilliant piece of software better and better!

I merged the new highlight recovery mode into R-Darktable, and wanted to show what it did by setting white-level and just enabling it… @hannoschwalm beat me to it by showing his own work :wink: .

I get a bit of red ‘hints’ around the brightest clipped area on the right, but this might be fixed by twiddling with the sliders (which I didn’t). Filmic’s ‘maxrgb’ default mode will bring that color more to the foreground, so I choose ‘luminance Y’. A bit of extra local contrast to the bright sky (not the dark clouds), a bit of diffuse-dehazing on the mountain in the background, and other regular ‘fixers’… not saying you have to like the edit, but it shows what can be done right from Darktable after @hannoschwalm’s work is available.

2014-05-30_19-47-01_01.cr2.xmp (17.9 KB)

Another - time consuming :stuck_out_tongue: - trick, I tried using Rawtherapee as a preprocessor. Opened the file, cleared everything to ‘neutral’. Switched demosaicing to RCD to match Darktable’s defaults, enabled chromatic fix in demosaicing, switch color profile to Rec2020, and export to Rec2020 16bit tif. Enable color propagation, lower exposure so nothing is clipped (but touch nothing else).

Load this tif into Darktable, raise exposure where you want it (to expose the foreground properly), enable filmic and other tools as you wish, the highlights are now already recovered in Rawtherapee so DT doesn’t has to deal with them. Things like denoise-profiled and lens-corrections pick up the original metadata so that appears to be working. Only white-balance changes with ‘color calibration’ is a bit of a PITA, but there are other ways to correct white balance if you need.

2 Likes