xi / apca-introduction

The missing introduction to APCA
https://xi.github.io/apca-introduction/tool/
8 stars 1 forks source link

You are comparing luminance to lightness #17

Open xi opened 1 year ago

xi commented 1 year ago

In https://github.com/xi/apca-introduction/issues/7#issuecomment-1217182023, @myndex wrote:

You are also comparing "non-perceptual lightness" of WCAG 2's luminance to the perceptual lightness curves of APCA. This is a fully invalid comparison. It is an "apples and apricots" comparison at best.

xi commented 1 year ago

You seem to be implying that WCAG 2.x compares raw luminance values while APCA first converts luminance to perceptual lightness and then does the comparison. That does not match my understanding of WCAG 2.x

In the current version of my analysis I try to disect how each algorithm does the conversion from luminance to lightness. APCA is based on the Stevens model. WCAG 2.x is based on the older Weber/Fechner model.

Even though WCAG 2.x is based on an outdated model, claiming that it is not based on perceptual lightness at all is just incorrect.

Myndex commented 1 year ago

You seem to be implying that WCAG 2.x compares raw luminance values while APCA first converts luminance to perceptual lightness and then does the comparison. That does not match my understanding of WCAG 2.x

I know it doesn't, because you don't understand the field, which is what I have been trying to convey to you. WCAG 2 takes a ratio of luminances. It does NOTHING with perceptual lightness pair-wise uniform contrasts. Weber makes an assumption regarding the adaptation state—the simplest way to put this is that for Weber to be "perceptually uniform in a practical way" the brightest color of a color pair must be the background, and it must be the same as the adapting field.

When you have a self illuminated display, and that display has a background at #fff, and then you have two colors #777 and #234, the Weber will not give you an accurate prediction of the perceived contrast of #777 and #234. Because the eye is adapted to #fff. That's a simplification but I don't know how else to explain it to you.

As a result, Weber is not fit for purpose, as one of the PhD peer reviewers stated in their review.

In the current version of my analysis I try to disect how each algorithm does the conversion from luminance to lightness. APCA is based on the Stevens model. WCAG 2.x is based on the older Weber/Fechner model.

No.

The 180 year old Weber/Fechner is not, and has never been referred to as "perceptual lightness" nor uniform. Weber/Fechner is log of the threshold, the just noticeable differences or JND between two stimuli, and with adaption to one of the stimuli. This is not perceptually uniform lightness.

I get that you are trying to compare the WCAG 2 ratio to the APCA Lc value, but I've gone over your math, and you are ignoring things and it is more than frustrating to understand why you are doing this, and the resultant comparisons are not correct.

Again, you can not just hand-wave away aspects that you don't understand or claim are "monotonic" (and APCA does not fit the definition of monotonic because it changes sign among other things) and then presume to make any sort of valid comparison, particularly as you are stuck on this idea of "thresholds" which demonstrates that you have not read the documentation for APCA.

Some History For You

A first attempt at quantifying perceptual lightness was Munsell.

Timeline of the last 100 years of lightness maths:

1920

Priest, et alia provide a basic estimate of the Munsell value (with Y running from 0 to 1 in this case):

$$V = 10 \sqrt{Y}$$ x

1933

Munsell, Sloan, and Godlove launch a study on the Munsell neutral value scale, considering several proposals relating the relative luminance to the Munsell value, and suggest:

$$V^2 = 1.4742 Y - 0.004743 Y^2$$ x

1943

Newhall, Nickerson, and Judd prepare a report for the Optical Society of America on Munsell renotation. They suggest a quintic parabola (relating the reflectance in terms of the value):

$$Y = 1.2219 V - 0.23111 V^2 + 0.23951 V^3 - 0.021009 V^4 + 0.0008404 V^5$$ x

1943

Using Table II of the O.S.A. report, Moon and Spencer express the value in terms of the relative luminance:

$$V = 5\left(\frac{Y}{19.77}\right)^{0.426} = 1.4 Y^{0.426}$$ x

1944

Saunderson and Milner introduce a subtractive constant in the previous expression, for a better fit to the Munsell value.

$$V = 2.357 Y^{0.343} - 1.52$$ x

1955

Ladd and Pinney of Eastman Kodak are interested in the Munsell value as a perceptually uniform lightness scale for use in television. After considering one logarithmic and five power-law functions (per Stevens' power law), they relate value to reflectance by raising the reflectance to the power of 0.352:

$$V = 2.217 Y^{0.352} - 1.324$$ Realizing this is quite close to the cube root, they simplify it to:

$$V = 2.468 \sqrt[3]{Y} - 1.636$$ x

1958

Glasser,et alia, define the lightness as ten times the Munsell value (so that the lightness ranges from 0 to 100):

$$L^\star = 25.29 \sqrt[3]{Y} - 18.38$$ x

1964

Wyszecki simplifies this to:

$$W^\star = 25 \sqrt[3]{Y} - 17$$ This formula approximates the Munsell value function for 1%<Y<98% (it is not applicable for Y< 1% and is used for the CIE 1964 color space.

Myndex commented 1 year ago

Here's an interesting paper from 1924 detailing the limitations of Weber.

https://jila.colorado.edu/~weberjm/course-materials/CHEM-5591/Hecht%201924%20Weber-Fechner%20Law.pdf

bruce-usab commented 1 year ago

WCAG 2 takes a ratio of luminances. It does NOTHING with perceptual lightness, PERIOD.

@Myndex – Is not the WCAG2 formula for relative luminance based on human perceptual brightness?

WCAG2 then uses a (somewhat arbitrary) difference formula for a contrast ratio. But that ratio is uses two relative lumanances as input. Why is WCAG2 relative luminance not analogous to perceptual lightness?

Myndex commented 1 year ago

Hi @bruce-usab

@Myndex – Is not the WCAG2 formula for relative luminance based on human perceptual brightness?

No, not at all. Luminance is a physical measure of light, it is NOT a perceptual lightness.

Luminance does have a human spectral weighting, but luminance does not reflect the human perceptual response for lightness/darkness/brightness.

WCAG2 then uses a (somewhat arbitrary) difference formula for a contrast ratio.

The ratio formula is essentially an inverted Weber. But Weber is only really useful for the JND (just noticeable differences) i.e. at threshold. Weber is ALSO not a perceptual lightness in the current meaning of the term.

But that ratio is uses two relative lumanances as input. Why is WCAG2 relative luminance not analogous to perceptual lightness?

Here is a graph that illustrates the issue more clearly:

light vs lightness

WCAG 2 is using a ratio of physical light, not considering perceptual lightness.

bruce-usab commented 1 year ago

Thank you @Myndex – that is helpful but it also reinforces what I understood to be going on with WCAG2 maths. I acknowledge I may be missing some foundational knowledge.

Luminance does have a human spectral weighting...

Right:

L = 0.2126R + 0.7152G + 0.0722*B

Does this not reflect how humans are much more light/brightness sensitive to Green as compared to Red as compared to Blue?

Of course, those three colors are used because humans (typically) have three type of color-sensitive cone cells in their eyes — and humans built CRT (and then LED monitors) up from RGB primaries because this biological aspect has been know for a very long time.

As I understand it, when people write about light being linear, that is because The Sun puts out light rather evenly across the electrometric spectrum. Of course, one needs specialized equipment to measure much of that spectrum, and to affirm (for example) that there is just as much (i.e., just as bright) Red light as Green or Blue.

WCAG 2 is using a ratio of physical light...

I do not understand how this is meaningfully correct when WCAG2 maths use only RGB samples which apply a weighting.

Modern light bulbs, and even single color LEDs, are manufactured to give all due deference to human perception. But if I have three LEDs each of specific wavelength and equivalent resistance and provide one Watt to each: Would not the Green appear much brighter than Red and Blue?

The ratio formula is essentially an inverted Weber.

Okay, and I understand Weber to be oriented to human perception and and not physical linear light.

But Weber is only really useful for the JND (just noticeable differences) i.e. at threshold.

That also seems to validate use of Weber in the current WCAG2 application (which picks a few thresholds as good enough (or not)).

Weber is ALSO not a perceptual lightness in the current meaning of the term.

Instead of perceptual lightness what is a better term to use for what Weber measures?

Myndex commented 1 year ago

Hi Bruce @bruce-usab

I am going to answer more in depth below, BUT I see where the disconnect is.

Visual perception is very multi-dimensional.

The spectral aspect relates to the frequency/wavelength. It is separate from the lightness/darkness aspect. Luminance is physical light, but with a weighting for the "frequency response" but not the "intensity response".

Luminance does have a human spectral weighting...

Does this not reflect how humans are much more light/brightness sensitive to Green as compared to Red as compared to Blue?

It does reflect the combined sensitivity based on wavelength. It does not reflect sensitivity to, or perception of, relative or absolute intensity.

Of course, those three colors are used because humans (typically) have three type of color-sensitive cone cells in their eyes — and humans built CRT (and then LED monitors) up from RGB primaries because this biological aspect has been know for a very long time.

I recently wrote an article describing the reality here in plain language detail. I had originally centered on the "common red green blue" explanation as being simplest, but one of the peer reviewers encouraged me to work toward "setting the record straight". And indeed, even the CIE is active in correcting the current basic model of human color perception.

A short answer is while it may make sense for a monitor to use red, green, blue primaries, the human vision system is not nearly as simple.

Here are some snippets:


...the scientific names for the cone cells in our eye are L, M, and S cones, for the long, medium, and short wavelengths of light they are most sensitive to....

The L cone actually has a peak sensitivity near yellow/green—but the fact its response curve extends into deep reds gives a differential from the M cone, that allows humans to perceive “red” as a unique hue. As you can see from the graphic, the responses of the cones all overlap very substantially.

normalized cone response curves. Showing the L M and S cones

...one reason the cones are mislabeled as "red green blue" is how they are used in television and displays;.... Not at the peak response, but intended to be "as independent as practical"....

And this is not where the sensation of color really takes place—that rabbit hole is just a bit deeper.

(And by just a bit deeper I mean all the way to China.)

The first stage of the visual cortex looks at the lightness/darkness contrasts first,

(but not color)

finding edges and fine details.....Later stages separately process the color information...


But there is also much more to the "biological aspect" including things such as the opponent process of color, and then the neurological processing, wherein color and luminance are processed in a very context sensitive way. We refer to all this as the "psychophysical" aspects of perception.

As I understand it, when people write about light being linear, that is because The Sun puts out light rather evenly across the electrometric spectrum. Of course, one needs specialized equipment to measure much of that spectrum, and to affirm (for example) that there is just as much (i.e., just as bright) Red light as Green or Blue.

That's a different linear. And so here, the spectral emission from the sun as a blackbody radiator through our atmosphere at noon is like this:

Screen Shot 2022-08-18 at 2 50 54 PM

But this is not at all what I am talking about.

"Non linear perception of lightness" MEANS that as the distance between a BG and a stimuli increases, the value of that distance does not have a linear relationship to the change in physical light.

Put another way, physical light, and I include luminance in this, is linear in terms of additivity.

If you have 100 photons of light, and you triple it, you then have 300 photons of light.

BUT the human visual system DOES NOT see that as a tripling, it sees it only as a modest, small increase. And there are many contextual factors that define this, including distance to the current adaptation, edges or flat areas, spatial frequency...

WCAG 2 is using a ratio of physical light...

I do not understand how this is meaningfully correct when WCAG2 maths use only RGB samples which apply a weighting.

It is still physical light, weighted for spectral sensitivity, but not intensity change.

Modern light bulbs, and even single color LEDs, are manufactured to give all due deference to human perception. But if I have three LEDs each of specific wavelength and equivalent resistance and provide one Watt to each: Would not the Green appear much brighter than Red and Blue?

Not necessarily. There it depends on the efficiency of the light emitting device. Among other things, LEDs are not true monochromatic lights (but a laser is). This paper gets into some of this: https://www.osti.gov/pages/servlets/purl/1421610

But Weber is only really useful for the JND (just noticeable differences) i.e. at threshold.

That also seems to validate use of Weber in the current WCAG2 application (which picks a few thresholds as good enough (or not)).

Those are a different meaning of the term "thresholds". And the WCAG 2 levels are not really "thresholds" they are just arbitrary levels.

Weber is ALSO not a perceptual lightness in the current meaning of the term.

Instead of perceptual lightness what is a better term to use for what Weber measures?

Weber gives a contrast ratio, or a Weber contrast, which is specifically the magnitude of the JND (just noticeable differences) threshold for a stimulus and background at a given intensity.

It is threshold, meaning the narrow region between visible and invisible.

Supra-threshold means above threshold. And the farther we get above threshold, the more the maths that define that or predict how it will look, change.

APCA is a contrast appearance model that predicts perceived contrast for high spatial frequency stimuli at supra-threshold intensity levels as displayed on self-illuminated monitors.

Myndex commented 1 year ago

~https://www.tiktok.com/dead link/~

I don't recall what that link was, it is now dead. I think it was Color_Nerd who is a great educator in color, describing perceptual lightness.