Understanding color calibration channel mixing in darktable

I’ve been reading about and experimenting with the color calibration module, and I’m having some trouble understanding the color mixer feature.

I was expecting the three color mixing tabs to simply work as interfaces to input coefficients OI in a matrix, where O is the name of the tab (either R, G or B) and I is the name of the slider, which is the multiplied with the input channels to produce the output:

\begin{pmatrix}RR & RG & RB\\GR & GG & GB\\BR & BG & BB\end{pmatrix} \begin{pmatrix}R_{in}\\G_{in}\\B_{in}\end{pmatrix} = \begin{pmatrix}R_{out}\\G_{out}\\B_{out}\end{pmatrix}

So for example setting everything to zero except for any of the entries in the R tab would produce a red image, and this is true when adaptation is set to none (bypass).

So far, so good. Now, the manual suggests using the color mixer with the CIECAM16 adaptation (i.e. color model?) enabled, even if the CAT tab is not used (in which case the manual suggests setting illuminant to same as pipeline (D50)).
I understand that by changing a different color profile (or color model or …? as is probably obvious I’m not familiar with these concepts) than the pipeline, repeating the same thing as above (everything to zero except one slider in one channel) the resulting image will likely contain a mix of R, G and B due to the mapping back from CIECAM16 at the output of the module.

However, at this point the result puzzles me: while setting only input R in the R tab does produce a mostly red image (with some blue) as I expected, doing the same with G or B produces a perfectly black image. Here are some screenshots with a bit of the image, the histogram and the color calibration settings to illustrate what I mean:

What am I missing?

Also, another question that I suspect might be related: why are the colors in the R and G sliders basically identical (though reversed) and those in B completely different? I expected these sliders to be different in each tab, as they indeed are when the adaptation is set to none (bypass):

I tried to figure this out by reading the documentation of this Darktable module, about CIECAM16, and so on, but I guess that I lack knowledge of some fundamental concepts that are required to understand this. I’ve also seen quite a few similar-sounding questions posted here, but they did not help me in understanding this.

P.S. I’ve posted this question on stackexchange about two months ago (I didn’t know about pixls.us yet), and I’m only reposting it here because nobody was able to answer there and someone suggested I ask it here.

That sounds like a bug. I think you should open an issue on GitHub.

1 Like

What version of DT…

EDIT

I just tried it…ran 5.01 in a Win 11 VM on my laptop…I don’t see the black…all works as expected…

Are you doing these edits on a second instance of CC…if not maybe its your interact ion with WB or maybe you are on an older version of DT…

I did my check in a second instance with the tonemapper off otherwise standard starting conditions…

The blue in the red channel comes from the default level of gamut compression used by the module…set it to 0 and you should just have the red…

As for the slider color…this might be what you are referring to??

Note : The actual colors of the CAT or RGB primaries used for the channel mixing, projected to sRGB display space, are painted in the background of the RGB sliders, so you can get a sense of the color shift that will result from your altered settings.

1 Like

I did not even think to interpret it in the midset of a potential bugs!

Tonight I’ll check the version, update if it’s not the latest, etc., and come back to you with some more detail (or to say that everything was fine after an update).

1 Like

So, I was finally able to repeat the same experiment in a more controlled environment, and I still get a black image for the B channel.
I’m on macOS, running a freshly downloaded v5.0.1.

As you can seen in the screenshots below, only “white balance” and “color calibration” are active (besides raw black/white point, demosaic, and input/output color profiles around color calibration). The waveform (and of course the colors in the picture itself) shows that none of the channels is zeroed out.

Adaptation is set to CAT 16; repeating the same experiment in both linear and nonlinear bradford the screenshots would show a red, then green, then blue image (as I would expect), while in XYZ it is black, green, black.

Using any other image produces a similar result.

You look to be in input red not blue…and all channels are set to zero??

EDIT
I do see black when you see it… Win11 and current master from today…

1 Like

yeah sorry I uploaded the wrong screenshot, I just fixed it. Anyways the parameters were set correctly, I just took a screenshot of the wrong tab.

Also, I’m puzzled by the fact that the colors in the sliders appear to be the same in the R and G channels. Shouldn’t they be different in each tab? I’m sure I’m missing something about how this CAT16 adaptation works…

It might be that there are no blue elements in your image.

I replicated it with a random image… it’s likely a bug. I will report it when I get time…

I got a response from Aurélien Pierre on stackexchange, I think that explains everything: color correction - Darktable: understanding channel mixing - Photography Stack Exchange.

Basically, as I understand it, the point is that the R G B channels in the CIECAT16 space are defined in a way that mimics the physiological response of the human eye, and are very different from a typical RGB space: the spectral curve of the R and G channels are very similar, while B is quite far away. So playing with B only, with the other two zeroed out, almost inevitably produces out-of-gamut colors, which are clipped by the color calibration moduleresulting in a black image. To apply strong RGB channel mixing effects one should use the pipeline RGB space, while the CIECAM16 space is good for chromatic adaptation. Please refer to the link above to see Aurélien Pierre’s full answer.

Anywhays, thanks to everyone for your responses and interest in my question.

3 Likes