Struggling to white balance an image (Darktable)

If you are mixing red into blue, if the input has no red, you won’t be adding anything to blue. A grey pixel will turn bluer, a predominantly red pixel will turn purpler, a pure green or blue won’t change.

In darktable, since color calibration is in the scene-referred, unbounded part of the pipeline, channels never get saturated, so you can push them beyond 100% (‘255’).

@thehatterman: you may find the rgb primaries module easier to use. It’s a bit more limited, though.

1 Like

This covers the terms used in both Sigmoid and RGB Primaries:

2 Likes

To the layman, ignoring the maths for a moment, increasing red in blue channel I should see with my eye that the predominantly blue parts of the photo shift towards red . Increasing red in green channel I should see that the predominantly green parts of the photo shift towards red. Increasing green in red channel I should see that the predominantly red parts of the photo shift towards green.

Off course, all parts of the photo are affected and when one colour shifts towards another it changes hue, but this should be the obvious effect I see with my eye.

In fact, I had missed what appears to be an obvious clue in the UI in that the RGB sliders in the channel mixer section of the CC module are coloured and indicate the general shift in colour. (Blue becomes purple for example).

Have I finally understood how the sliders work?

Your sliders appear to work differently than in the GIMP.

For example, increasing red into blue from 0 to 2 does not affect Koren’s cyan patch at all.

Regurgitating the math,GIMP cyan color picker before: 0 135 165 … after: 0 135 165 … because 0*2 = 0

If I set red in blue to 0.2, the blue will increase from 151 to 151 + (49 * 0.2), the patch will then have the value 49,61,161 which is a slightly brighter blue. The yellow patch will become 238,200,79 which is slightly brighter yellow.

Have I got that right?

I am going to try this out in GIMP and Darktable later when I get back to my computer. I think I have a much better idea of what I am expecting to see, let me see if I can predict the general change when I adjust channel mixer.

I am going to use a real photo, use the colour picker to check actual pixel values and I will have the histogram set to vectorscope to see how it shifts.

I don’t think I have RGB primaries in my version, I am using 3.8.

I also think that channel mixer might not be the tool for this photo, that said I am going to push through with this and try to get an intuitive feel for channel mixer because (if I am being honest) I am jealous of those who understand it.

Understood. So for the primary that is being adjusted, the effect is greater the more of that colour is available in the input.

Just to be clear, I know it is unhelpful when I say “let’s ignore the maths”, it can’t be ignored, I am just trying to get a more intuitive understanding.

1 Like

Actually, I think you have that reversed. Increasing the red input to the blue output channel will increase blue. Here are the original color patches from above:

You can see the colors are evenly distributed around the vector scope display on the top right. Now, I slide the red input all the way to +2.0 in the blue output channel:

Everything has shifted to blue and all the colors on the vector scope have moved to blue. Patches with more red will shift more add more blue, and patches with no red will not change at all.

1 Like

According to the GIMP manual, yes.

Irritatingly, my GIMP 2.10 does not conform to the manual that came with it:

Koren’s red patch = RGB in = 178 44 55

1 0 0
0 1 0
0 0 1 identity matrix, RGB out = same as RGB in.

GIMP manual says that, if I add 0.5 G in top row, red now = 178+(44*0.5)+2 = 200

But my GIMP changes red to 180, not 200. Duh.

Agreed … same in the GIMP on my machine.

1 Like

My take on the channel mixer is that it’s a more refined control for adjusting white balance, seeming to create a custom illuminate to balance scene colors that the traditional white balance doesn’t handle as well. Of course, Boris is also very talented in coming up with novel applications for using the mixer for creative editing.

Part of the problem with the sunflower edit from his most recent video is that there are still residual effects in the sky and foliage from the mixer that might require correction, which I think is part of his point. But you could just as easily apply a mask use the mixer to bring out the orange from the bloom while leaving rest of the scene untouched. And the way he went about it appears much simpler than using the other modules to coax out adjacent colors.

I create a box in GIMP, paint it with RGB colour (100,60,20). I use the channel mixer to set Red in Blue output channel to 1. According to what I think I have learned here, I expect the new colour to be (100,60,120), but it is actually (100,60,100).

With a real photo in Darktable, I use the colour picker to sample a green looking pixel, it is (32,82,6). U se the channel mixer to set Red in Blue output channel to 1. I expect the new colour to be (32,82,38) but it is actually (29,82,59).

I don’t think i am ever going to understand this, it is no wonder I can’t get some kind of roughly intuitive feel for what is happening.

I am a bit frustrated.

I understand your frustration, but I’ve always found this to be a very vexing module. It’s very simple, but results can be unpredictable. I’ve been trying to wrap my head around the channel mixer function for quite a while and I think I’m only now beginning to understand it. And if it makes you feel any better, that’s in large part because of the discussion that you initiated

I wouldn’t get hung up over the specific settings. It sounds like you’re getting a handle on the relationship between input and output

You might want to experiment with some color patches or a color wheel and try to neutralize colors to grey. Set the histogram display to vector scope, pick a color point and then try different inputs to see how that point floats around. Try to get that point to dead center, which is neutral gray

Keep plugging, and you’ll get it.

So I just commented on Ted’s post…I see a blend mode setting of replace which in your case seems like what happened rather than adding the value…what are the blend options in GIMP…I don’t have it installed so I cant test…I could but I have affinity photo so I don’t really have a need for GIMP…

I am like a dog with a bone. I think if I give up on channel mixer and just crack on post processing my photos I will be just fine. But I can’t get it out of my head :joy:

Everyones help in this discussion is great, I have to say you are all very patient.

Just watchin this video for the second time, it’s quite good.

The picker values come from the histogram profile and so you have the pipeline to deal with…what if you drag your channel mixer to the end of the pipeline…is it closer… You might also have the normalize button checked… that is like GIMP maintain luminance I think… but uncheck it and you should get what you expect or close…

So using this example… small group of modules with CC second instance being used in bypass and normalization off in the blue channel…

Channel mixing not yet enabled… flower petal color…

Enabled in normal pipeline… in this case only sigmoid and output but in some edits this could be many other modules that would modify the color…after you do the mixing…

Now moved to the end so nothing comes after…

And pretty close to what you would expect …

This is why when you watch Boris he is moving some things around… if he left them in the default place then the effect could be nullified or altered by subsequent modules so he will often make some strategic moves to avoid this…

HTH

Now that is interesting. I never thought at all about moving the modules around. To be honest, because I don’t know what I don’t understand, I have always been out of my depth moving modules around. I will try moving the channel mixer to the end, even if just while I am learning. In reality, close enough might be good enough.

As a side question, I did wonder what the normalize channels did. I know what normalisation is, but don’t know how it is implemented in this case. Something else for me to play with I think.

The channel mixer is just one link in the chain and the only readout you get is from the end so you can’t expect a 1 to 1 math translation with that but as you can move it or do a very simple edit so there are not modules after it and then play with the colors to confirm better your math …in the end it will take the input pixels and perform that math but then that output just feeds the next module and so on so it gets modified depending on the module set before it gets to the readout stage…

@Ofnuts just explained this to me in another thread:

https://discuss.pixls.us/t/channel-mixer-output-not-same-as-manual-predicts/43751/3?u=xpatusa

The actual GIMP mixer math is complicated by it first converting the channel’s RGB values to linear (not gamma-corrected), adding them up and then converting the result back to gamma-corrected. No fun at all and my old brain certainly can’t handle 3D exponents on the fly …

… so blue in = (20/255)^2.2+(100/255)^2.2 = 0.0037 + 0.130 = 0.1337 (the dot product, sorta). Then 0.1337^(1/2.2) = 0.401x255 = 102, close enough to your 100, ipso facto.

even simpler, avoiding the 255 constant

(20^2.2+100^2.2)^(1/2.2) = 101 - even closer!

Because there are multiple colour spaces involved, don’t expect the colour picker to show results of the type blueOut = blueIn + redMix * redIn. What I mean is, if you mix colours in linear Rec 2020, the values from the picker won’t show what simple maths would suggest. You read an RGB triplet from the picker, but those are not the numbers that will be mixed, and then the result of the mixing will be converted back into whatever space the picker works in. Plus, if you have modules in the pipeline after the channel mixer, such as filmic, they will tweak the colours further.

1 Like