jcelaya / hdrmerge

HDR exposure merging
http://jcelaya.github.io/hdrmerge/
Other
354 stars 78 forks source link

Extreme Magenta Artifacts #196

Open fanckush opened 4 years ago

fanckush commented 4 years ago

so i needed some new HDR samples for some bugfixes i'm working on and here's what i got:

LEFT: V0.6 the highlights are simply magenta/purple and nothing can done about it RIGHT: V0.5 better than 0.6 but there is a magenta tint all in the highlights image

What i'd like to know is why magenta? what is the technical reason behind it? files can be found here https://gofile.io/?c=QBkfj6

shot on: a6300 + 10-18mm

Beep6581 commented 4 years ago

@fanckush see: https://discuss.pixls.us/t/magenta-highlights/6136

fanckush commented 4 years ago

Thanks for the link, in there it says that (2.0, 1.0, 1.4) is magenta which I find hard to understand. Magenta is #FF00FF meaning no green.. doesn't a fully saturated clipped raw image result in fully saturated values for each channel (after demosaicing) aka: white. why is purple happening? If anyone has any explanation I would be very grateful

Beep6581 commented 4 years ago

@fanckush if my understanding of this is correct: if raw values are in the range [0;1], clipped would mean rgb(1.0, 1.0, 1.0), and multiplying that by those white balance coefficients would produce rgb(2.0, 1.0, 1.4), which scaled to [0-255] for better viewing produces rgb(255, 127.5, 178.5)

fanckush commented 4 years ago

that makes a lot of sense. I tested in darktable to disable white balance and indeed the magenta turned into gray ( shade of white). I understand this now BUT it creates another problem for me that I don't get: normal raw images are also often clipped and saturated. why are they not magenta after white balance correction? isn't every channel fully saturated as well? for example my source files contain a bunch of saturated pixels but in darktable they look perfectly white and perfectly clipped :)

Beep6581 commented 4 years ago

I can answer part of that.

The raw file's channels can saturate at different levels, and differ by ISO and also sometimes by aperture. That is why we measure the white levels and find a good level at which to clip: http://rawpedia.rawtherapee.com/Adding_Support_for_New_Raw_Formats#White_Levels These levels are stored in the camconst.json file.

The image is white-balanced somewhere in the pipeline: http://rawpedia.rawtherapee.com/Toolchain_Pipeline In RawTherapee that seems to happen after decoding and demosaicing, if that page is correct, so after camconst.json. I either don't know or don't recall how white balancing does not lead to magenta whites. We could ask @heckflosse @desmis @iliasg how that magic works.

LigH-de commented 4 years ago

A v0.6 exists? ... Apparently not for Windows?

Beep6581 commented 4 years ago

v0.6 does not exist yet... Apologies for the delay, I'm 90% there, just need to find time for the last 10% of the work.