Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.81k stars 318 forks source link

ICC input profiles with LUTs not handled properly. #2107

Closed Beep6581 closed 9 years ago

Beep6581 commented 9 years ago

Originally reported on Google Code with ID 2123

ICC profiles with a color matrix only are straightforward, apply with no worries. We
don't even use LCMS for this.

ICC profiles with LUTs is a bit of black magic though. The main problem is that in
order for a LUT to produce the expected output (ie the proper colors), it must have
the input pre-processed in a way the ICC profile expects. Unfortunately there's no
standard way to do this so different vendors do in different ways, and one has to find
out how they do it. The easiest way is to use the vendor's own raw converter and produce
a TIFF output file with the ICC profile embedded (*if* possible that is), then you
know that in order for the ICC profile to work properly the data should be pre-processed
such that it looks like the data in the TIFF file.

The key issue is that LUT will produce different color depending on what curve the
input has. Rawtherapee assumes a linear curve, and if an ICC profile expects a gamma
that is applied (eg 1/1.8 for Phase One profiles), but the that only compensates gamma,
the effective curve is still linear. Tested through a number of Phase One profiles
I've noted that with this linear curve they produce a greenish cast on skin tones,
but if I instead pre-process such that the curve is close to the expected "standard
curve" in Capture One, the colors look good. Not strange that their bundled ICC profiles
have been designed with the standard curve in mind. After LUT processing one can reverse
the curve and get back to RTs expected linear space.

Currently we support generic ICC profiles (only matrices, which thus require no pre-processing),
Phase One (=Capture One, Leaf excepted) ICC profiles and Nikon NX.

I've started to look deeper into Capture One ICC profiles. As I Leaf owner I'd also
like to get the Leaf ICC profiles to work (I've now managed to reverse-engineer them,
so I can add support for them).

I've got a patch 90% complete which contains general colorconversion cleanups and fix
for Phase One profiles (and added support for the Leaf ICCs) as well as structured
the code so it should be easier than before to add and tune support for more ICC profile
types, but I'm stuck on a highlight problem that needs solving first. I like the fact
that RT can import profiles from other software that you may own, so I like to have
this feature in good shape.

The difference in color rendering is generally not huge, you typically need to layer
two images on top of each other and look at skin-tones to see the improvement, but
it depends on profiles, some are more sensitive than others and produce rather bad
colors with the linear input.

Reported by torger@ludd.ltu.se on 2013-12-13 14:33:59

Beep6581 commented 9 years ago
I own a Leaf back so this ICC stuff to get Leaf ICC support was one of my egoistic patches,
many of my patches are egoistic as I use RawTherapee a lot for my own photography :-).

I generally don't need lens correction so I haven't actually used the LCP feature,
but it seems to be a popular one among many other users so it's probably something
someone should look into. I'll keep it in mind and ask you if I get into it, I'll try
to stay a bit lower on work now over Christmas at least. I've done various image processing
stuff, but generally I learn as I go, I'm sure there's a lot of new things for me to
learn when getting into LCP, learning new things is part of the joy of doing contributions.

Reported by torger@ludd.ltu.se on 2013-12-18 07:54:35

Beep6581 commented 9 years ago
The task at hand with LCP would mainly be a math problem, as the engine itself if already
there. We had a very bright guy for those kind of math problems, Emil. But unfortunately
he's not actively developing RT anymore. So if you'd like to grab your head around
it, give me a call :-)

Reported by oduis@hotmail.com on 2013-12-18 08:37:20

Beep6581 commented 9 years ago
Can we close this 4.1 blocker?

Reported by entertheyoni on 2013-12-30 10:45:15

Beep6581 commented 9 years ago
Bump

Reported by entertheyoni on 2014-02-02 15:53:51

Beep6581 commented 9 years ago

Reported by torger@ludd.ltu.se on 2014-02-03 09:48:38