Color Choosing Paradox, also Warmer vs Cooler

Could you provide a link to the LUT and the code applying the LUT?

In ICC profile color managed editing applications, your eyes are presumed 100% chromatically adapted to your monitor. This assumption might be partially or even completely false given factors like how much of your field of view the monitor fills, the color of other light sources in your field of view, and so on. But for the sake of argument, let’s assume your eyes are adapted to “monitor white”.

Once your eyes have adapted to “monitor white”, that particular white point is a given, and ICC profile color management takes care of “adapting” the colors in the image from D50 (the V2/V4 profile illuminant) to the white point of the monitor profile.

When processing a raw file (painting isn’t photography, but the same principles apply here), the point of white balancing the image is to make it look like it was shot under the same illuminant as the camera input ICC profile, which for V2/V4 color management is D50. What your eyes actually see on the screen (assuming your eyes really are adapted to “monitor white”) are “the same colors except adapted to monitor white”.

So a technically speaking, a properly white balanced image doesn’t look warm or cool. It looks neutral. Even if the image is mostly just one color, say a close-up of a red apple, if the image is technically correctly white balanced, you don’t think, “well, the light on the apple must be warm because the apple is red”. You just assume it’s a red apple.

But what if you really don’t want the “color of the light” in a photograph to be “neutral”, to be the same as the color of white that your eyes are adapted to? What if what you really want to do is capture the color of the light source illuminating the scene, instead of white balance it away? The usual course of action in this circumstance is to use Daylight white balance; another option is to use Ciecam.

In the photograph below of a self-lit candle flame:

  • “a” shows the result of “capturing the color of the light” by using Daylight white balance. "
  • “b” shows the result of “white balancing the color of the light source away to make a neutral rendition neither warm nor cool” by white balancing on the light source, which in this case the light source is the flame itself.
  • “c” shows the result of playing with RT Ciecam sliders to get something less extreme than “a” or “b”, something closer to what I remember seeing when I took the image - less orange and more yellow than the result of using Daylight white balance.
  • “d” is just “a” converted to black and white.

161230-1938-1108-daylight-flame-ciecam-white-balances-plus-black-and-white

OK, I made four “final renditions” of the candle flame, using three different white balances, with the fourth verion not using any white balance at all. Instead it’s a “toned” black and white image. The next image shows two things: the tonality for all four final renditions, and “the color of early morning snow” taken from a photograph of early morning snow - this was quite a bit before the sun came, so no “rosy dawn light”, in fact the sky was completely overcast.

I took the “early morning snow” photograph in the early morning (duh!) and then immediately it processed in RawTherapee, setting the white balance to make the color of the snow on my monitor screen match the color of the snow just outside the window near my monitor. (In reality the blue should probably be a very slight bit more green - when I processed the image my monitor’s “monitor white” was a bit on the green side all by itself - after recalibrating and reprofiling several of my more recent images could use a bit of tweaking back towards green. Sigh.)

tonality-plus-color-of-morning-snow

OK, here are the four final versions of the candle image:

161230-1938-1108-daylight-flame-ciecam-snow-white-balance-and-color-variations

1 In my opinion, using daylight white balance really didn’t make the finished image look like it was lit by actual candle light, not at all. But this rendition represents an attempt to deliberately convey “a very warm light source (the candle flame itself) is illuminating the scene”.

2 White balancing on the candle flame also didn’t make the finished image look like actual candle light. But it did recover the actual color of the candle wax under “normal daylight” lighting. The candle wax is a sickly shade of purple-blue, one of the ugliest colors in the paint box (personal opinion, labeled as such). This represents a successful attempt to give the image a technically correct white balance. The represented light source is neither warm nor cool, but instead neutral (which looks really weird when the actual light source is the candle flame in the middle of the image).

3 Using RT’s Ciecam module to white balance the candle did fairly well capture what I saw when I photographed the candle flame, including the rather unappetizing “purple-blue wax as lit by the yellow candle flame”. This also is an attempt to deliberately convey “this is very warm light”.

4 Image number 4 shows the result of using “the color of early morning snow” to add color to the black and white version of the final image. This is not an attempt to convey “this scene is illuminated by a very cool light source”. Instead it’s merely an artistic decision to tone a black and white image using a particular blue color. The represented “color of the light illuminating the scene” is neither warm nor cool but rather is just “monitor white”. Or rather, there is no “color of the light” illuminating the scene. It’s just a monotone image that happens to be toned using blue.

OK. Back to paintings. I think it’s fair to say that some paintings represent “neutral light”. Some represent attempts to capture the various colors of ambient natural light sources (Monet’s haystacks). Some paintings use colors for reasons that have very little to do with capturing “colors of light” or “neutral light”, but instead use colors in other ways, for other reasons.

Anyway, for the longest time I assumed that “adapting to a light source” such as direct sunlight or deep shade or the light on an overcast day or candle light, meant that we stop noticing that the light actually has a color, that we only notice “warm or cool light” when the light source is actually changing. But in reality, I’m fairly sure most of us continue noticing the color of the light, at least for many light sources. Leastways, I don’t ever seem to “forget” that on an overcast snowy day (like today is here in Central New York), the light is a cold blue color. And likewise, warm candle light at the dinner table always looks warm even if it’s the only light source.

So I’m guessing that “adapted” really just means we can still make judgements like “the red apple is still red and the yellow banana is still yellow”, even when the color of the light changes fairly drastically across the spectrum from warmest to coolest natural light.

I suppose this implies that somewhere between the cold light of deep shade or an overcast snowy day and the warm light of a candle-lit dinner, there might be “the color of light” most people think of as “neutral” - is there such a thing as "the color of light that everyone or most people think is neutral, neither warm nor cold? Is that color D65 daylight (mix of sky light and direct sunlight)?

Anyway, “warmer and cooler” requires a context. The context is obvious if the goal is representing a particular color of light illuminating a scene. In other contexts, I suppose it just means moving a color’s hue closer to or farther away from some pre-chosen “warmest” and “coolest” colors in the painting’s color palette.

Regarding @briend 's painting, I would guess that there really isn’t a represented color of light illuminating the scene. I say this because the shadows under the chair don’t seem to be using cooler hues than the highlight areas that seem to be illuminated by a presumed directional light source.

So “warmer” for this painting would mean means closer to whatever color is intended by the artist to be the warmest color. Somewhere on the handprint website one of the pages talks about how for some artists yellow is “the warmest” color, and for other artists it might be orange or red. But “warmest color” in @briend 's painting doesn’t seem to mean an “attempted representation of an actual light source, different from some presumed neutral light source”.

I’m sure there is some fuzzy thinking above. Comments, corrections, and insights are very welcome! @jdc - is my explanation of what “chromatically adapted” does and doesn’t mean at least somewhat close to being more or less correct?

2 Likes

Wonderful observations! Personally, I would prefer something in between 2.flame and 3.ciecam. I think the difficulty with candlelight is that it emits a variety of hues at any given moment. Not only that but the flame is also changing in shape, density and intensity. That would in turn affect how you would set up the shot, how the camera would interpret it and how light would bounce and go through the glass and candle.

@Simon

Here 1 filecolor .txt (223.4 KB)
, with all Munsell LUT, function, void, etc.

It’s not the .cc file (upload impossible !) but it is the same file

Sorry for discussion but my computer is sick :slight_smile:

:slight_smile:
jacques

@Elle

My english is too bad, to understand exactly what you say.

Globally I think you are true, but what I know, it is that White balance in Rawtherapee is “incomplete”.

When my computer (new) will work, I will adapt WB with CIECAM :slight_smile:

jacques

2 Likes

Regarding “variety of hues” and white balancing on the flame, absolutely true, it’s not exactly obvious what part of the flame to choose when setting the white balance, but putting a gray card in the scene wasn’t practical. So I chose the part of the flame that’s the least translucent, not sure if that’s where most of the light comes from or not.

Regarding “somwhere between 2 and 3”, I agree. I think what 3 really needs is to make the flame brighter, it just doesn’t look bright enough relative to the rest of the image. This would also require reducing the chroma, making the flame look a bit less yellow. Capturing the color of the light isn’t easy!

@jdc - thanks! for looking over what I wrote. I’m very much looking forward to the revised RT white balance - WB with CIECAM sounds wonderful.

Could you point me at the code where you undertake these LAB corrections? I’d be very interested in seeing how you do it.

I have post a file “color.txt” , 17 days ago
I think there is all need to understand: LUT creation, usage, etc.
The main(s) function(s) are “Labgamutmunsell” and “AllMunsellLch” and “MunsellLch”

Jacques

So I’ve been fooling around a bit with python-colorspacious, and jammed it into MyPaint to do some experiments. Adjusting lightness and colorfulness in realtime with CIECAM02 and various illuminants can be pretty interesting and (hopefully) somewhat useful.

Here’s Blue adjusted via the axes of +lightness and -colorfulness with D65 on the left and A on the right. I suppose it shouldn’t be that surprising that “A” looks quite a bit like a sunset, since illuminant A is pretty close to sunset as far as Kelvin goes (2856K vs 3200K):

Screenshot%20from%202018-01-27%2021-26-07

and here’s Red adjusted with D75, D55, and A from top to bottom, only adjusting the colorfulness:
Screenshot%20from%202018-01-27%2019-31-48

I made a couple videos in case it helps
https://www.youtube.com/watch?v=FOwTDlGzyMY
https://www.youtube.com/watch?v=6Sh4Zu0LBpQ

1 Like

Observe the Hue and RGB columns.

Source: Standard illuminant - Wikipedia

I’d like to add some others from this table, or even a custom option. Even after seeing this table, it still surprises me to get a rich color from “A” when fully desaturating a color. It’s just odd, even though it totally makes sense (the white point is the “grey/white/black” point).

I’m trying to implement channel-locked color pickers but having a really annoying problem gamut mapping the color back to within-gamut. Say I take a blue color and convert that to CIECAM JCh with python-colorspacious:

from colorspacious import cspace_convert
cspace_convert((0,0,1), “sRGB1”, “JCh”)
array([ 21.074306 , 90.51466637, 257.9160105 ])

then I change the hue and convert that back to sRGB:

cspace_convert((21.074306 , 90.51466637, 0), “JCh”, “sRGB1”)
array([ 0.57352534, -0.3367575 , 0.26130328])

Now I have a negative value and want to perform gamut mapping to get back to sRGB. LittleCMS should do this but I can’t seem to find any way to use it from within python. PIL Image/ PIL ImageCMS doesn’t seem to support floating points for more than one channel. So, not sure how I can do CM with an Image object without 3 channels… dohh

im=PIL.Image.new(“F”, (1,1), color=(0.5, 0.5, 0.5))
Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python2.7/dist-packages/PIL/Image.py”, line 2063, in new
return Image()._new(core.fill(mode, size, color))
TypeError: a float is required

I haven’t gotten around to ciecam02 even though I have been meaning to do so. This stuff takes me a lot of time to digest because I am no artist, color, photo, math or dev wiz. ATM, I still have the wrong python installed lol. Anyway, at one point, I bookmarked this (see examples), which might be relevant to this thread.

1 Like

That might be exactly what I need, actually (thanks!!). I wonder if that gamut.limit function is equivalent to a perceptual rendering intent or a relative chromatic, etc.

Now I just wish it was already ported to python.

Edit: Now I’m not quite sure if the gamut.limit function is exactly what I want to do. In my example, I want to take a Blue sRGB(0,0,1) and manipulate it to the nearest color with CIECAM hue angle 0. I don’t want to interpolate or modify h-- only J and C. That is, I want the resulting hue to be 0 and J and C adjusted if necessary to stay within sRGB. I suppose my assumption is that all hue angles are going to be possible as long as the illuminant is somewhere within the sRGB locus.

edit. It dawned on me that really Lightness and Hue are the two dimensions that are always going to be possible, and it is only Chromacity that is going to have to be adjusted to stay within the sRGB gamut. So, I should be able to build a loop where CIECAM—>sRGB and reduce chroma some small amount between loops until all sRGB values are 0-1. Once within a certain small threshold I could then clip it to account for rounding errors. edit: I guess there is a name for this kind of thing: Newton’s method.

I wonder what happens if you make the illuminant sRGB(0,0,1) (XYZ[0.18049265, 0.0722005 , 0.95049713])? Does that make a lot of hue angles out-of-gamut? Or, does that simply mean that a lot of hue angles are identical to sRGB(0,0,1) but perfectly valid?

Getting back to the red apple example… if I paint a red apple under a warm light, it seems that as the apple turns to face the light the color is going to be desaturated by the illuminant. So, choosing a warm illuminant (like A) might be very helpful to get this gradient. The shadow side of the apple must also have an illuminant if we are to see it, obviously. This is where it gets more confusing. In my red gradient example above, the saturated reds are sRGB red colors, so I suppose that implies a D65 illuminant. If I painted a red apple using this gradient, would that imply that the ambient/shadow side is a D65 light source and the lit side is an “A” light source? image

So I’m still doing naive clipping of sRGB values, but already the gradient generator is looking pretty nice. Here’s a couple examples, top to bottom order is RGB, HSV, HCY, then CIECAM (JCh w/ D65):

image
image

That first step from blue towards yellow seems pretty harsh on the CIECAM, but I’m hoping that is because of the clipping RGB.

edit: I implemented a naive gamut squishing logic. I think it looks a bit better:
image

I think I’ve wrapped my brain around this a bit more, and it has everything to do with the illuminant. I may be regurgitating a few things @Elle has already said, so bear with me.

In order to make any color “warmer”, we need an illuminant that is a warm color, and then we can just “desaturate” our color and it will progressively become “warmer”. Likewise, in order to make any color “cooler”, we need a cool illuminant and then, again, desaturate our color.

I think the specific term is “Excitation Purity”, Colorfulness - Wikipedia. Basically the distance from your arbitrarily set white point, which is your illuminant.

I’m going to add another “picker” thingy to MyPaint so that you can pluck the illuminant from the canvas. My thinking is that if you’re painting a picture you can define your light sources either in the painting or off to one side. Then you can swap illuminants whenever you want and adjust your brushcolor accordingly. We’ll see how that goes.

Ok I’ve got an “illuminant picker” thingy working and it is kind of interesting. Here’s a little demo:

image

So I started off with that violet color on the first flower in the middle. After I painted the center, and “picked” that color as the illuminant and then increase the chroma just a bit. Then I rotated the hue and drew the petals. So, for a cool illuminant, all the hues are cool and the hues were limited to one side of the color wheel, just like a limited palette. This was keeping CIECAM J+M static and only adjust the hue.

As I progressed from flower to flower, I picked a new illuminant for each center and adjusted the chroma a bit (so that the hue stayed on one side of the color wheel), then rotated the hue around and tried to guess which hue was most “north/south/east/west” of the whitepoint, which was difficult because the whitepoint was not the center of the HSV wheel but some point elsewhere. The only way to identify the center was to hold down the rotate hue button and visualize the circular shape it was making. Sometimes the shape is very oblong or erratic depending on the illuminant.

1 Like

Here’s an example of a single “hue” (that blue color on top) modified via lightness and colorfulness (CIECAM), with a very warm orange illuminant. It really is pretty neat, although it turns everything upside-down… lightening or reducing the colorfulness of the blue brushcolor moves it towards the orange illuminant… whilst darkening or increasing colorfulness moves it towards the original blue. Does this make sense? I’m not sure, but it is pretty lovely to play with.

1 Like

Hi @briend - your new color code makes awesomely lovely colors with artistically valid uses. As far as conceptually what the code is actually doing, I’m still confused about how the paint swaths turn from blue to orange back in post 55. I understand that “A” is much warmer than “D65”, but I don’t have any clue how mathematically you are producing these results. The fact that you can manipulate the CIECAM02 equations is very impressive - to me those equations are not easy to figure out. And python is not a language that I can read.

1 Like

Thanks @Elle! I can’t say I understand the CIECAM equations at all, I’m “cheating” by using the colorspacious library: http://colorspacious.readthedocs.io/en/latest/reference.html#specifying-colorspaces (it seems this library is limited to sRGB? sigh). Maybe one day I’ll try the really spiffy-looking colour-science library: http://colour-science.org/

I guess for the blue–>orange–>white behavior it seems to make sense if you consider that reducing the colorfulness or making a surface color lighter both imply that you’re going to see more of the illuminant color. I’m still a bit foggy as to why it goes to white eventually, but I read somewhere that with enough intensity all colors turn white because our visual system is peaked out on all channels (or something to that effect).

Now I’m trying to figure out if it makes sense to mess with the gui and the picking of colors from the palette. Right now it is a bit odd in that it lets you choose impossible colors for a given illuminant. Normally with D65 the range of lightness and colorfulness is between ~0-100 and ~0-40 for any given hue. But things get wonky with extremely colorful illuminants. Say I make my illuminant a pure sRGB blue (0,0,1). It should be pretty hard to get a pure yellow surface color, right? Nope, if I pick yellow from the palette, it will happily paint with that color. Internally it computes a ridiculous set of ciecam attributes to accommodate the color-- a lightness of 12,000 and colorfulness of 3,000. I guess that might be totally rational-- in order for an object to appear bright yellow under a pure blue light it would have to be super-natural?

The other thing I just noticed is that the blue illuminant is the most extreme example, any other colors for an illuminant are not nearly as bad, only increases the lightness range to 0-400, and colorfulness 0-300 or so. I suppose that means that a blue light is possibly the worst light for color reproduction?