Pages: [1]   Go Down

Author Topic: Hue rotation - is Photoshop right or wrong?  (Read 3954 times)

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1854
    • Frank Disilvestro
Hue rotation - is Photoshop right or wrong?
« on: December 04, 2015, 08:26:24 pm »

I was curious about the issue raised by forum member TRANTOR about getting different results using the same numbers in Photoshop when working in different color spaces.

http://forum.luminous-landscape.com/index.php?topic=105479.msg870588#msg870588

I'm not referring to RGB values, since it is obvious that the same numbers will lead to different results depending on the color space, but to Hue rotation. I though (and I guess TRANTOR did too) that changing Hue should lead to the same result as long as you stay inside the color space gamut.

Well, it turns out that is not the case, and Hue rotation is relative to the color space, which might affect those who work by numbers (I don't, but know some people in the graphic arts industry that do)

I started with the same color sample L=70; a=-30; b=45 and rotated the Hue all the way from -180 to +180 in three color spaces, sRGB, Adobe RGN and Lab, and plotted the resulting color in Lab coordinates.

Here are two views from a 3D plot (Y=L; X=a; Y=b. White=Lab; Green=sRGB; Red=Adobe RGB. The small yellow circle is the starting point)







The surprises (at least to me) are:

   - The difference in the L value between RGB spaces and Lab, especially for large Hue rotations

   - The shape in Lab is square (I was expecting a circle)


The following image shows the difference in the three color spaces compared with the original with a hue rotation of 45. The upper part is the original color, then from left to right sRGB, Adobe RGB and Lab.



And the following with a Hue rotation of 180 (again, the upper part is the original color, then from left to right sRGB, Adobe RGB and Lab).




Intrigued by the rectangular shape of the results in Lab, I calculated the DeltaE between each sample (Hue was increased in steps of 15) and got the following results:



Even if the Lab shape is rectangular, the DeltaE between samples remains between 13 and 16, while in the RGB cases the variation is higher.

Is this expected? Does it makes sense to work by numbers or do you have to work in Lab for this? Or is HSL wrongly implemented in Photoshop?

D Fosse

  • Guest
Re: Hue rotation - is Photoshop right or wrong?
« Reply #1 on: December 05, 2015, 06:51:07 am »

It never occurred to me to treat HSL as absolute, precisely because it obviously relates to the color space primaries. Lab has four primaries, RGB three. In sRGB vs Adobe RGB, the green primary angle is shifted considerably between them and so a hue shift by angle is expected to differ.
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8914
Re: Hue rotation - is Photoshop right or wrong?
« Reply #2 on: December 05, 2015, 07:12:20 am »

It never occurred to me to treat HSL as absolute,...

That's my take on it as well, HSL is derived from RGB, so it uses what ever primaries are defined there.

As the Wikipedia article says,
Quote
HSL and HSV are simple transformations of RGB which preserve symmetries in the RGB cube unrelated to human perception, such that its R, G, and B corners are equidistant from the neutral axis, and equally spaced around it.

HSL is useful for retouching and masking, but one must be careful with regard to conclusions involving human perception and colorimetry.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

D Fosse

  • Guest
Re: Hue rotation - is Photoshop right or wrong?
« Reply #3 on: December 05, 2015, 07:43:40 am »

Also the white point is different, D50 in Lab and D65 in sRGB/ARGB. That might also affect things.
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1854
    • Frank Disilvestro
Re: Hue rotation - is Photoshop right or wrong?
« Reply #4 on: December 05, 2015, 04:06:53 pm »

Also the white point is different, D50 in Lab and D65 in sRGB/ARGB. That might also affect things.

As far as I know, color spaces inside photoshop and many other applications are adapted to a common illuminant, normally D50. The following is a quote from a direct response from Bruce Lindbloom to a question I emailed him.

Quote
In most real-world applications and workflows, this is the only thing that makes practical sense. It is what ICC, Photoshop, Lightroom, etc. are based on. Although AdobeRGB is specified relative to D65, its ICC profile contains the primaries adapted from D65 to D50 using the Bradford chromatic adaptation method (use a profile inspector to examine the rXYZ, gXYZ and bXYZ tag contents). So any ICC-aware app that uses this profile is transforming colors in the D50 world, not D65. R=G=B is a D50 neutral, no matter what the native reference white of the color space.

Doug Gray

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2197
Re: Hue rotation - is Photoshop right or wrong?
« Reply #5 on: December 05, 2015, 11:14:50 pm »

The changes from a hue shift date back to the beginning of computerized color editors (computers were 3 orders of magnitude slower in computation). Initially, they used the simplest possible algorithms which did simple ratio changing regardless of the 3 illuminant cords. Since Y determines, by definition, the G channel has the most effect followed far behind by the red and blue. So when the G value stays constant (each of the RGB values take turns staying constant as the hue "angle" rotates) luminance is relatively constant but when it is varying luminance changes much more.

Lab is a different critter with 6 variables from which the L, a, and b are determined. These are X, Y, Z, and white point coordinates. Conventionally D50 is used for Lab white point so only X, Y, and Z matter. Since Y alone determines luminance, the value of Y fixes the L in Lab.
Logged

TRANTOR

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
    • Nuclear Light | Home of Color
Re: Hue rotation - is Photoshop right or wrong?
« Reply #6 on: December 06, 2015, 05:20:24 pm »

Not only HSL works odd.




Levels fail in Hue:



Curves fail in Hue again. Really Luminosity blending? No.



Selective Color fail on all of them:



And so on, and so on.
« Last Edit: December 07, 2015, 10:54:06 am by TRANTOR »
Logged

GWGill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 608
  • Author of ArgyllCMS & ArgyllPRO ColorMeter
    • ArgyllCMS
Re: Hue rotation - is Photoshop right or wrong?
« Reply #7 on: December 06, 2015, 07:15:56 pm »

Lab has four primaries, RGB three.
L*a*b* has three primaries - the X,Y and Z it is derived from.
Logged

GWGill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 608
  • Author of ArgyllCMS & ArgyllPRO ColorMeter
    • ArgyllCMS
Re: Hue rotation - is Photoshop right or wrong?
« Reply #8 on: December 06, 2015, 07:21:17 pm »

Also the white point is different, D50 in Lab and D65 in sRGB/ARGB. That might also affect things.
L*a*b* is not D50, it is whatever the white point has been set to in the conversion. It can be D65 or anything.
It will be D50 if it is derived from an ICC profile PCS (Profile Connection Space) value, because PCS values are typically adapated to a D50 white point.
Logged

D Fosse

  • Guest
Re: Hue rotation - is Photoshop right or wrong?
« Reply #9 on: December 07, 2015, 02:16:44 am »

L*a*b* has three primaries - the X,Y and Z it is derived from.

Not in the context the question was asked - hue shift in a color wheel rotated by angle. Then it's plus/minus a and plus/minus b.

The question was functional, not technical.
Logged

GWGill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 608
  • Author of ArgyllCMS & ArgyllPRO ColorMeter
    • ArgyllCMS
Re: Hue rotation - is Photoshop right or wrong?
« Reply #10 on: December 07, 2015, 06:25:11 am »

Not in the context the question was asked - hue shift in a color wheel rotated by angle. Then it's plus/minus a and plus/minus b.
There's nothing very mysterious about the relationship between rectangular (a* b*) and polar (C*, h*) coordinates.
The mere fact that the zero's are at neutral, does not somehow turn 2 dimensions into 4!
Quote
The question was functional, not technical.
I've no idea what point you think you are making.
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1854
    • Frank Disilvestro
Re: Hue rotation - is Photoshop right or wrong?
« Reply #11 on: December 07, 2015, 07:52:30 am »

I also fail to see why Lab would have 4 primaries

D Fosse

  • Guest
Re: Hue rotation - is Photoshop right or wrong?
« Reply #12 on: December 07, 2015, 08:52:44 am »

OK, nevermind. I was just trying to answer the OP's question - which nobody else has so far.
« Last Edit: December 07, 2015, 09:42:24 am by D Fosse »
Logged

GWGill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 608
  • Author of ArgyllCMS & ArgyllPRO ColorMeter
    • ArgyllCMS
Re: Hue rotation - is Photoshop right or wrong?
« Reply #13 on: December 07, 2015, 05:01:42 pm »

I was just trying to answer the OP's question - which nobody else has so far.
It was answered by BartvanderWolf in reply #2.
Logged

Peter_DL

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 544
Re: Hue rotation - is Photoshop right or wrong?
« Reply #14 on: December 07, 2015, 05:43:08 pm »

   - The shape in Lab is square (I was expecting a circle)

... me too.
Just to reverse-engineer the math:

The corners of the square are at /a/ = /b/ = the /max./ value of the initial color. From then on the Hue slider just adds or subtracts a or b, while leaving the other variable at the corner value. Quite simple, just +/- on the ab channels. No Lab->Lch transform to maintain the chroma (saturation), no consideration of dE along the hue rotation. L* is maintained - at least.

--
Logged
Pages: [1]   Go Up