Color Checker Based Color Calibration in Reverse?

So, I recently noticed that the feature that I have been eagerly waiting for since I first read the announcements has finally arrived in my Darktable installation: A big thank you to the developers for making it possible to now color-correct images based on a Color Checker. Great work!

Now, the more I have been playing around with the scene-referred workflow in general and the calibration module in particular, the more I have come to believe that the calibration module would actually be the correct place in the pipeline to apply any film emulations. I know that, traditionally, people have used all kinds of tools for that (curves, contrast and brightness, shadows and highlights, color zones, LUTs… to mention only a few) and most presets for that other well-known RAW development software seem to make heavy use of very similar techniques. However, now that we have that amazing and well-working color calibration module, I like to think that this would actually be the best place to do that - not only from an artistic, but also from a technical standpoint. (After all, most film looks can be described in terms of shifted primaries and modified transfer curves.)

So, I have been thinking… Would it be possible to allow the color calibration module - and in particular the calibration derived by measuring a color target - to work in reverse - i.e. assume that the color checker that I’m measuring shows the desired look that should be applied to other images? I’m assuming that in this case the calibration module would not actually need to apply any adjustments, but merely store the computed adjustments as a profile, which can then be applied to other images.

Any thoughts on this? Or am I thinking in the wrong direction and there is some fundamental obstacle?

1 Like

I would enjoy this as well, for what it’s worth

It just creates a set of channel mixer settings so you should be able to do what you what with them…

The challenge here would be that film emulations tend to have a lot of nonlinearities, and you would probably need quite a few more patches in the color target to identify those nonlinearities.

Thanks for the replies.

As to those non-linearities… Actually, I’m not even sure, if that’s really true. Or, even if it’s true, if it’s necessary. I have a feeling that most of the so-called film emulations that try to outperform each other in terms of accuracy are approaching the problem with the mindset that only a totally accurate emulation is a good emulation. Now, I don’t think that’s the case: I think, shifting the primaries in 3D space usually brings you very close to the overall feel already. And doing it by a channel mixer also gives you some non-linearities by introducing cross-channel talk. Finally, modifying the transfer curve (contrast/brightness?) of each single channel will do the rest.

That’s my understanding at least. In my view, many other presets - high-resolution LUTs especially - usually have the problem of overfitting. I think, creating an emulation based on a rather low number of color measurements, which map the whole color space (as in a color checker) will suffice to achieve a good approximation. (After all, there is a reason, why the color checker doesn’t have 17³ patches like most LUTs.)

And, of course, we are then free to add other creative tools on top of the calibration to modify the emulation, but shifting the primaries early in the pipeline would lay the groundwork.

As to your idea, Todd: Hmm, that sounds feasible. But is it really so simple? Would it suffice to simply invert all the numbers to go the other way round? Is it possible to stack to calibration instances with inverted numbers to come back to the original image?

Would be interested to see someone experiment with this. This being said I always place lut 3D film emulations as the last module in order to create “shared boundaries” to achieve visual consistency for all images in a series. I have experimented with an “in reverse” order (as you describe it) in Photoshop with layers, but that did not produce the results I wanted.

More patches don’t change the fact that it’s a 3×3 least-square solve.

Applying the color calibration in reverse is just a couple of lines of code to add (gaussian elimination inversion). As usual, the challenge is more about how to squeeze that cleverly in the GUI, how to call that mode, etc.

1 Like

I wrote my own tool that creates LUTs to imitate film emulations. Overfitting can indeed be a problem. So, to combat overfitting, like usual in cases like this, you need more data (I like to use around 100 different photos from which I extract around 100k - 200k camples and limit each photo’s influence on any single segment of the 3d space). I’m not sure how close one can get with just a color target regarding film emulations but… it’d be interesting to see!

1 Like

Overfitting can be addressed by using k-means clustering or simply post-processing the LUT with some low-pass filtering.

That is true, they help with overfitting (and I used both). Remaining question is the accuracy.

My biggest concern in any LUT scheme is to get a bijective transform, meaning no oscillations that may lead to color noise and gradients reversals.

Accuracy is optional, anyway there is no reference film look, processing temperatures and scene illuminant can change lots of things in the resulting colors, and the need for an exact 1:1 film reproduction is still a moot point. I think you get convincing-enough film emulations using algebraic emulations in color balance. Getting inspired by how film behaves, yes, and modelling it physically, ok. Reproducing it 1:1 ? You know Kodak started Ektachrome again, right ?

I seriously didn’t think it even needed to be said that a 3x3 matrix would obviously not meet the OP’s goals.

But as has been pointed out, there are many other ways to achieve their goals and I don’t think anything involving just a CC24 is one of them…

Hmm, actually - and as the OP I’m only speaking for myself, not for anybody else who might have different requirements - this would indeed meet my goals. In my view, total accuracy should not be the point in any kind of film emulation. LUTs with almost 5000 control points in 3D space, tone curves with 20 points or more… what’s the point (pun not intended ;))!? All that’s achievable by trying to achieve absolute accuracy, is overfitted data (non-monotonic functions and discontinuities all over the place), failing to yield a believable film emulation in all, but very few test cases.

At the end of the day, although being highly nonlinear, a film emulation can well be reduced to rotated primaries (with some channel-cross talk) and modified tone curves. Is it possible to achieve absolutely perfect emulations (Delta-E lower that, say, 2.0) that way? No, of course not. Would it be sufficient to portray the overall characteristics of the film? In my opinion, yes.

That said, I have, in the meantime, played around with the Color Lookup module (24 color checker points) and I believe this is giving me, what I want. Thanks to all of you for the helpful discussion! :slight_smile:

1 Like