Color Choosing Paradox, also Warmer vs Cooler

@jdc - thanks! for the equation and relevant parameters. It will be interesting to see if I can make sense of what happens when modifying those parameters in the RT Ciecam module.

I don’t have any clear idea what you just said :slight_smile: but if/when there’s new code in a branch implementing what you just described, I’d be happy to compile and experiment with whatever’s changed.

I have a feeling - just from experimenting, not from having any idea of the mathematics - that Ciecam/CAT02 could play a very nice role in white balancing raw files, that currently people and raw processors aren’t taking advantage of. But maybe you are speaking of something else altogether?

No, the jeans hue also shifts, always complementary to the surrounding colors. @Carmelo_DrRaw makes GIMP 2.9 appimages for download (no installation required), and @partha provides Windows/Mac builds, if you want to do some experimenting.

For example, rotating the hues a little more towards yellow made the jeans a bit more violet-blue, and the color almost seemed even stronger than with the original colors.

Rotating the hues to make the skin tones either green or magenta made the jeans look magenta or green, respectively. But sometimes with these colors it seemed I could “dismiss the illusion”. And if I put both version of the painting side by side, the illusion vanished and the jeans looked gray in both versions of the painting.

Well, yes, of course you are right, these “illusions” are everywhere. I remember once adding blue color to a black and white image and being very upset that darker areas in some distance cliffs in the image stubbornly refused to look blue, instead looked orange or brown. The color picker was telling me one thing, my eyes something else. But maybe these are not really illusions so much as complications in the vast topic of color appearances. Color happens in our eyes/nerves/brain/mind. Apparently there is some advantage to having vision that accentuates whatever differences there are out there in the world. So to my mind (pun intended) if it looks blue, it’s blue. At least unitl I get close enough to see that really it’s orange. And vice versa.

This would be an interesting experiment if you were willing to give it a try: Put your painting on one side of the screen. Open a new image with a middle gray background and put it right next to the Portrait painting. Now paint onto the new image the same color blue that you see in the jeans - what color do you need for a visual match?

This thread has touched on a lot of topics. It seems to me that some topics that could use some additional discussion include (but of course isn’t limited to):

  • Advantages and disadvantages of various color wheels

  • How to better access the near-achromatic colors and how to perhaps improve the interface(s) of various color wheels to make it easier to choose a palette and to limit colors to a given color gamut.

  • A more complete consideration of warm/warmer, cool/cooler, and the idea of “neutral white” in a painting.

This last topic of making colors warmer and cooler has been touched on several times. But I think there is some important background information that’s been left out, that I’d like to try to help outline and fill in, though not in this post and not today :slight_smile: . But here are a few preliminary questions, and I’m sure there are a bunch of questions that could be added to the list:

Cooler or warmer than what? And for what artistic purposes do we make colors cooler or warmer? For the colors in a painting or photograph, is the color of the light illuminating the scene always obvious? If not, what makes the color of the light more obvious or less obvious?

@Elle I first discovered the problem with LAB back when I was experimenting with bringing grossly shifted skin color back into its natural range. As you know, I am pretty bad with colors so I rely on tools to tell me what is there.

One strategy was modulating the hue angle in LCHab and LCHuv. The intriguing thing was that even my eyes-brain could tell that the hue change was not uniform. I found that for certain rotations and color combinations LCHuv was better at maintaining color integrity, even though LUV has its own set of issues, which is why most people stick with LAB.

Since then, I have stayed away from LCH hue changes, and recently more cautious with chroma changes, because of the discussion from the LCH and JCH thread. I don’t feel like I have a good handle on the situation.

I won’t say too much about what @jdc said about RT (mainly because I don’t use RT much and I am not a dev) but I suspect that RT provides a correction factor for every deviation from the Munsell color system. Hence, the large number of LUTs involved. Sort of like how braces correct one’s set of teeth but that is probably a bad analogy :stuck_out_tongue:.

@Elle @afre

There is as much LUT as necessary. They are distributed according to the luminance, the chroma, and the hue, with a “concentration” all the higher as the Munsell-Lab differences are important.

There are no problems using the code elsewhere - except to quote my “copyright”. I do not know the code Gimp, but it is almost essential that all calculations are done in “real”, otherwise there will be artifacts.

What I propose is to implement a part of Ciecam (that relative to CAT02) to the local controls. Today it is the branch “newlocallab” which takes these modifications, it does not work with layers and masks, but in a manner close to the U-points of NikSoftware. Today, you can retouch luminance, contrast, chroma, retinex, tonemapping, contrat by detail levels, sharpening, denoise, vibrance, exposure, blur … often in “normal” or “reverse” mode.
Thus we could touch the white balance (CAT02) for a face, a cloud, a flower, etc.

jacques

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