Topics

How does Luminance slider in Camera Raw split colors by their hue? #colortheory #photoshop #lightroom #colors


John
 

Hi,

the HSL panel in Camera Raw allows adjusting Luminance for 8 color ranges I assume.

 

Does anybody know how those ranges are calculated?

 

For ex. what does "Reds" actually mean, how does it determine what is red and not orange for ex.

it's clear that RGB or other color space values are in play here, but how does the math actually work.

For ex rgb(255,0,0) is pure red and rgb(255, 165, 0) is orange

then, a pixel with the color rgb(255,83,0) will be affected by the oranges slider, or the reds slider? and how is that determined, simply by dividing the "difference" between the 2 colors equally?

I know you can also convert rgb to hsl or hsb, is the separation between colors done by dividing the h ranges into 8 equal parts centered on the "pure" colors?

 

Also, I suspect that this uses the CIE LAB color space, but I have no idea how to split the the colors by hue in that colorspace.

 

Take a look at the following image. It marks the areas affected by the Luminance setting of the various sliders (Reds, Oranges, etc). It clearly shows that the ranges differ in size and they even overlap significantly (blues and purples).



any input is welcome!

 

thanks,

 

John


Dan Margulis
 



On Jan 20, 2021, at 8:39 AM, John <johnny.php@...> wrote:

the HSL panel in Camera Raw allows adjusting Luminance for 8 color ranges I assume.

 

Does anybody know how those ranges are calculated?

 

For ex. what does "Reds" actually mean, how does it determine what is red and not orange for ex.

it's clear that RGB or other color space values are in play here, but how does the math actually work.


John,

The flip, or wisecracking, response to the question is,

1) Probably nobody remembers what methodology was used. The Photoshop team often has picked up pieces of existing code to create new commands. Also there are several complicating factors in a command like this that might require some less than desirable shortcuts.

2) It is hard to see what good knowing this information would do. There are good reasons to have an exact knowledge of what curves or white balance do, or what constitutes “red” in sRGB as opposed to Adobe RGB as opposed to ProPhoto. But the nature of this particular command is that it can only be used in a by-guess-and-by-gosh way where we twiddle the sliders and try certain settings, and if we don’t like the particular way in which the affected area is computed we make a better mask ourselves.

The realistic response is:
If we are designing this command from scratch there are two basic approaches:

1) Do it in a logical mathematical way that will appeal to color scientists.

2) Do it in an illogical way with the idea that a slider labeled “Reds” will affect only areas that a non-color scientist might consider red.

These two approaches cannot be reconciled. Assuming that you have decided to select areas that the average person might consider red or blue or yellow, the size of the selection covered by each couldn’t possibly be the same. Yellow, for example, is only perceived as yellow in very light tones, whereas blues are recognized as blues in a range three times as large.

Assuming that you could somehow pinpoint the exact color that the average person considers red or blue or yellow, the selection areas would also not be symmetrical. The irregularities have been known for some time. In his 1858 On Colour John Gardner Wilkinson complained, 

I have stated that the names of colours are uncertain and indefinite, and in proof of this it is only necessary to ask what idea is conveyed to the mind by the mere mention of a red, or a blue, color? A scarlet coat is called red; and the term red is applied to a rose, a brick, port wine, mulberries, cherries, and other things of very different hues…

If you force people to pick one color and call it red, they’re probably going to choose something in the neighborhood of scarlet. So a command targeting “Reds” has to be strongest in that zone. In a command designed for color scientists, the selection would tail off equally on both sides. However, in real life we can’t go much in the yellow direction before declaring that the resulting color is orange and not red. All the objects above cited by Wilkinson are on the other side—we still consider things to be red when they have moved sharply toward magenta.

With blues it’s the same idea. If we have a basic agreement on what blue means we will accept quite a large hue shift before we call it aqua. But if the shift is in the other direction it won’t take much for us to call the color purple.

That ad hoc approach is the one I would take if I were designing the command.

Dan Margulis 

P.S. Welcome to the list. We request that everyone posting use their full name. We suggest editing your groups.io profile so that your full name appears in the message header.


Kenneth Harris
 

If you want to puzzle this out, you can use a granger rainbow to see which clean colors are affected.  A long time ago (PS7) I worked out which areas were selected by H/S for each color using calculations.  I don't have my notes in front of me, but IIRC, H/S is colorspace agnostic, it's just ratios, and it corresponds to the peak  angle + rolloff in the old HSV/HSL colorspaces.  Again IIRC, conversion into HSV via the plugin is also colorspace agnostic.  Further, if you take a granger rainbow, and add a Z dimension of saturation, H/S will continue to affect the same ratios.  For instance, run each range in H/S to zero and any images, and it should be greyscale.  Although now I use the logic of how selective color cuts the image apart regularly (via an action), I've totally forgotten what is is, although again, it can be emulated via calculations.  Selective color doesn't cut deeply into unsaturated areas.  If you put selective color to zero on all the blacks, and set to "absolute," the image will turn to white, you can then move and individual range up and see if you you're catching what you want for the purpose of masking, eg, "reds.".  I did not come up with this method, perhaps someone here can attribute, it was circa 2005.  

I have tested how ACR handles it, but I know the hit on peak response is much higher, and the rolloff to low response faster while the range is broader, for a given color.  My sense is that it's still looking at RGB equivalent ratios even though ACR should be in a CIE space.  I'll happily be disabused of my ignorance.

Combining these methods, it's possible to go from a particular/known colorspace into a space that looks ~95% like Lab using only calculations, that is, if you know what kind of reds you want, and what kind of greens you want, ditto yellows/blues, you can get a/b.  The L is trivial.  I could never get the reds perfect, however, too dark.  A granger rainbow was invaluable in testing all that.

Ken Harris


John
 

First off, thank you for your answers! For sure you know way more about colors than me.

Just to clarify my objective a bit - I'm working on a photo editor software and I'm trying to implement color controls which would look familiar to a Lightroom/Photoshop user.
I've got the basics working, but can't figure out which color model to use.

For the images processed in the software I start with RGB and I've tried converting to HSL, HSV & CIE Lab. For each model I allow the user to change the values that make up the color model then convert it back to RGB for displaying on the screen in real-time.

The issue I have is setting the "intervals" affected for a certain color. For ex. for red #FF0000 I tried converting it to HSL and tried to consider reds the colors with a close hue value (I know it's wrong). I've also tried using some vector math to determine the distance between various colors in the image to "clump" them together around red.

I'm not really getting good results, aside from the CIE Lab model - however, that gives me a few aberrations and unexpected overlaps of colors.

So probably the right question to ask would be which is a good algorithm to determine color similarity?

thanks!


Doug Schafer
 

On Tue, Jan 26, 2021 at 06:12 AM, Dan Margulis wrote:
Does anybody know how those ranges are calculated?
My thought process (in no way disagrees with Dan).....
Suggest you run your own tests. You won't get the math answer and I doubt Adobe would ever release the info (proprietary), but you will have a mathematical relationship result.

Create a full spectrum rainbow color wheel or similar; or just larger than the range of colors you expect to test...then save/look at several results on the colors of moving 1 slider, a specific amount, and analyze  (i.e. color sample eye dropper the results) and tabulate a chart of the results vs. the changes made; and draw your own conclusions.

I would guess the range is not a specific color number set (RGB or Lab), except to start at the exact Hue, 100% away from the center for some amount, and then  a gradient taper from that color to the next with a specific color number cutoff at an end point where there is no effect on image being adjusted.  I think the result will be of a somewhat flattened "normal curve" with the peak at Hue = 0 (for "red") extending partly to Hue = 60 for yellow and partly to Hue = 240 for blue  (for RGB) with slider effects of no impact before yellow or blue. Where the colors cutoff (i.e. the range you are looking for) will be measurable by the color picker and will probably vary by the amount the slider is moved.

If you do so, most here would appreciate your results summary. Once done for 1 color, I'd likely assume a similar scheme is used for each color....unless visual interpretation is used....like Dan said: a difference of science vs. illogical; thus the "normal curve" may not be symmetrical and could be different for each color.

Doug Schafer