0

I'm trying to write video analysis software to check compliance with WCAG 2.0 seizure guidelines. But, in the definition of 'general flash', it states the following:

A general flash is defined as a pair of opposing changes in relative luminance of 10% or more of the maximum relative luminance (...)

I am confused about the usage of "maximum relative luminance". It's not specified in which context we are considering the maximum. Does it refer to 1.0 luminance? Or the maximum luminance achieved in the webpage? Or something else?

I couldn't find any clarification. I would just assume that it refers to 1.0 luminance, but, if that assumption were wrong, my code would produce false negatives in flash detection due to an incorrectly high threshold.

Sorry if I'm missing something obvious or if this is the wrong place to ask.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Astrono2
  • 3
  • 2
  • I would not assume 1.0 luminance as maximum relative luminance. I cannot answer this specifically, but whiter then white was done in past (e.g. on analog TV signal), and possibly it will return in future (for HDR). – Giacomo Catenazzi Jun 08 '21 at 10:00

4 Answers4

2

Maximum relative luminance is simply the maximum luminance using the equation at the end of this answer.

The reason "maximum relative luminance" is used is that there are other colour spaces, but as this is web the RGB colour space is used. (so for example you could use the CMYK colour space and a different calculation would be used. However the end result is the same, 1 would be white and 0 would be black).

The 10% maximum refers to the difference between the maximum luminance vs the minimum luminance (but 10% of the maximum luminance as the difference not 10% of the minimum as that would result in a smaller difference).

So for example:-

  1. If the lightest value has a luminance of 0.9 then the minimum luminance for the darkest point is 0.81 (0.9 * 10% = 0.09, 0.9 - 0.09 = 0.81).
  2. Due to a second rule the following is acceptable despite being greater than a 10% variance - lightest value 0.99, darkest value 0.8 - this has a ~20% difference but the darkest value is at 0.8 relative luminance so it is OK.
  3. If the lightest value has a luminance of 0.9 but the darkest luminance is 0.72 then this would require that less than 3 flashes a second occur as the difference is 20% (1 - (0.9 / 0.72) = 0.2 or 20%)

The second statement is ok due to the following note on the rules:

A general flash is defined as a pair of opposing changes in relative luminance of 10% or more of the maximum relative luminance where the relative luminance of the darker image is below 0.80; and where "a pair of opposing changes" is an increase followed by a decrease, or a decrease followed by an increase

There is a brilliant codepen that explains the relative luminance equation (points 1 to 4):

https://codepen.io/bcdon/full/qBWwWyx

Included as you have to include code with a codepen...this is the formula for Luminance using the RGB colour space.

 L = 0.2126 * R + 0.7152 * G + 0.0722 * B
GrahamTheDev
  • 22,724
  • 2
  • 32
  • 64
  • Ohhh okay, thanks. So, if I understood correctly, "maximum relative luminance" refers to the relative luminance of the brighter image in a pair of opposing changes, right? – Astrono2 Jun 08 '21 at 12:04
  • After working with your answer for a few months, I ran into a serious problem and got a different answer from someone else that seems to make more sense. The details are on another answer to my original question. I'd appreciate your opinion on this. – Astrono2 Oct 25 '21 at 17:14
0

There's a wiki page for WCAG 2.0 Relative Luminance:

The relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Jaime López
  • 448
  • 3
  • 11
  • Yes, I've read that, but I'm worried that the specification of 'of the maximum relative luminance' might refer to the maximum achievable for the page. For now I'll follow this and work assuming that it refers to 1.0 luminance until something indicates otherwise. Thanks! – Astrono2 Jun 07 '21 at 17:57
0

I got a very helpful answer from someone working on a similar problem:

I'm going to give some background first, which helps to figure out the right interpretation. In the Ofcom and ITU broadcast standards, the general flash threshold is defined as 20 candela/m^2 (=20 nits) where the darker image is darker than 160 nits. When WCAG 2 was in committee, common screens used CRT technology and the committee figured on a max brightness of 200 nits.

So, you can assume bright white #FFFFFF on your monitor to be 100% maximum relative luminance--and just assume this is 200 nits for typical viewing environments. This means that the 0.1 difference in relative luminance corresponds to a brightness difference of 20 nits. The 0.8 cutoff corresponds to 160 nits.

This implies that the "10% or more of the maximum relative luminance" doesn't refer to the relative luminance of the brighter image involved in the transition. Where I was doing something like:

diff = brighter_img_rel_lum - darker_img_rel_lum
if diff >= 0.1 * brighter_img_rel_lum:
    # stuff

I should have been doing something like:

max_rel_lum = 1.0 # might be different in different systems
diff = brighter_img_rel_lum - darker_img_rel_lum
if diff >= 0.1 * max_rel_lum:
    # stuff

This contradicts Graham's answer

If the lightest value has a luminance of 0.9 then the minimum luminance for the darkest point is 0.81 (0.9 * 10% = 0.09, 0.9 - 0.09 = 0.81).

So I'm still not sure about this. I have been working with their answer the last few months and only came back to this question after that resulted in my code running into the following problem:

  1. Lighter color is #000001 and darker color is #000000
  2. Get relative luminances of 2.19E-5 and 0.0 respectively
  3. Their difference is 2.19E-5 as well
  4. The threshold would be 2.19E-5 * 10% = 2.19E-6
  5. 2.19E-5 > 2.19E-6
  6. This counts as a valid transition when checking for general flashes

This resulted in my code detecting compression artifacts, among other features barely visible to the human eye, as seizure risks.

Astrono2
  • 3
  • 2
  • Firstly an extra bit to consider: the combined area of flashes occurring concurrently occupies no more than a total of .006 steradians within any 10 degree visual field on the screen (25% of any 10 degree visual field on the screen) at typical viewing distance. Secondly: I would imagine a check for **absolute** difference of 0.02 luminance would solve this issue as this is an edge case that I don't think has been considered or guidance is lacking on. So 0.5 and 0.47 would need checking with the previous formula but 0.5 and 0.49 luminance would be ignored. Same for 0.02 and 0.01, ignore – GrahamTheDev Oct 25 '21 at 17:49
  • By having an absolute check first it should eliminate edge cases like black and near black like you experienced here. It is worth noting that this is my opinion and there may be guidance out there on how to deal with this but I have not seen it. I can't imagine a luminance difference of 0.02 is perceivable enough (or maybe even set it to 0.01 to be cautious). – GrahamTheDev Oct 25 '21 at 17:51
  • If you do find some guidance on this can you let me know so I can add it to my answer. – GrahamTheDev Oct 25 '21 at 17:52
  • 1
    To be 100% sure, given how false negatives can be a serious risk, I'll write an email to the W3C Web Accessibility Initiative asking for clarification and post a definitive answer. I probably should have done this earlier. Thanks for your help! – Astrono2 Oct 25 '21 at 18:16
0

Short answer

Refers to the calculated relative screen luminance using the IEC piecewise calculation for sRGB to convert a CSS color value.

BONUS: EFA 2005 Recommendations

The simuli should be:

  • Luminous intensity change less than 20 cd/m² (20 nits)
  • Change rate slower than 3 Hz
  • Less than 10% of central vision, or less than 25% of screen area
  • striped patterns should have no more than five stripes if the lighter stripe is brighter than 50 cd/m²

LONGER ANSWER

10 Per, Sent...

WCAG 2.0 is based in part on WCAG 1.0, the ITU BT 1702, and the 2005 Epilepsy Foundation of America recommendations, but as indicated above, EFA did not specify a 10% change, that's a WCAG thing, I assume because WCAG 2.x only specifies relative luminance for a variety of reasons.

The 10% thinking seems to come from the assumption that the monitor is going to be 200cd/m² and therefore the EFA's 20cd/m² recommendation is 10% of that 200cd/m².

The WCAG 2.x luminance is otherwise based on the 1996 sRGB spec which defines displays at 80 cd/m². The 200 cd/m² might be from ITU BT 500 which specifies 200cd/m² screen, 30cd/m² living room environment.

In 2005, many monitors were capable of brightness exceeding 200cd/m², with 300cd/m² to 400cd/m² not uncommon. Of course, even with a 400 cd/m² monitor, it's not likely that a user will calibrate to that level. 120 cd/m² to 160 cd/m² is more common when working in a typically bright office.

But that was before the mobile device explosion, today modern mobile devices are commonly 1200 cd/m² to 1600 cd/m², and used under brighter conditions. So potentially, 20 cd/m² is less than 2%. An important question then is the effect of adaptation level to the provocative flash level.

Sidenote: ITU 1702 indicates that when the image is darker than 160cd/m², the flash specification is 20cd/m². When the image is above 160cd/m², and for HDR, the flash classification is a Michaelson contrast.

As I recall EFA's 2005 recommendations were based on research done in the late 1990s/early 2000s after the Pokémon incident. Those studies were of 21" CRT televisions as they existed in darkened living rooms. CRTs of the era were nominally 80cd/m².

New Stuff

The remainder of this post going to focus on more recent studies. Farther below is the new 2022 EFA recommendation, though it recites substantially the same guidance.

Considering the changes since 2005 in the use cases and proliferation of bright mobile devices, I would ignore the narrow-case SC of WCAG_2 as archaic, and instead follow the EFA's guideline directly, as among other things it's more accurate and more clear.

WCAG 2 for some reason indicates a central field of 10°, when it was actually stated by EFA at 10% of central vision (smaller is stricter, and 10% of central vision is much smaller than 10° of visual angle). The 10° comes from the solid angle 0.006 steradians, but the provacative area is specified to be 25% of that solid angle, and this works out to a smaller, if contiguous that's a square of ~5° of visual angle.

For CSS reference px, this is about 235px by 235px (5°/0.0213°, and0.0213° is 1px, CSS reference px). If you consider that mobile devices are often held much closer than the reference distance, even with the higher pixel density of a smartphone, that could easily be as small as 160px² perhaps even 100px².

Emerging Unknowns

There is still research to be done, such as for emerging technology like high dynamic range (HDR) and Ultra High Def (UHD). HDR is an concern due to the use of super-bright highlights; Readily available HDR monitors are over 1000nits, and the specifications can be up to 10,000 nits.

The UHD color space (rec.2100) has a red primary at a significantly longer wavelength than sRGB — long enough to stimulate an L cone in a manner virtually isolated from the M cone. The studies that raised concerns regarding saturated red flashes were using a deep, long wavelength red that stimulated the L cone in isolation.

By example, if we say the luminance on a surface that is 160px by 160px is 20 cd/m², if we were to maintain the same illuminance (lux) at a given distance, by emitting a higher luminance over a much smaller 28px by 28px area, that would be a luminance of 637 cd/m², easily within the range of even a modest HDR screen.

But take a look at this chart here you'll see that when the image on the screen is brighter than 100cd/m², even 20cd/m² flashes go unnoticed. On the other hand, darker images under 100cd/m² more people are affected, even by a mere 10cd/m² flash.

Based on these charts, we might say:

  • above 100cd/m² use 20cd/m² as minimum level
  • below 100cd/m² use 15cd/m² as minimum level
  • below 50cd/m² use 10cd/m² as minimum level

Now, for broadcast that might be a bit complicated, the ITU simplified saying that, under 160cd/m² make it 20cd/m². But if there is a long, dark scene in a film, where the audience is dark adapted to that scene, and then there is a flashing of 10cd/m² and faster than 12Hz, in my reading of the material, with a sufficient area of vision, this could be provocative.

Charts showing the number of patients affected various flash brightnesses, where 20cd/m² luminance for screens that are darker than 100, and it's still hits about 38% of patients who are photo sensitive

Also as things get brighter or we make things smaller, it's not a linear relationship between the stimulus size and the brightness. As we make the stimulus brighter the size makes a significant difference.

 chart showing luminance versus size of stimulus

A Reasonable Limit

A simplest way to define a limit might be: "no flash is brighter than 5cd/m² or no flash is faster than 3Hz". As I mentioned above, size in this case might be useful to disregard, simply because if we added "...or no flash is larger than 10px²" because that would mean a 9px² could be 10,000 cd/m² at 12hz, considering the HDR standard.


2.5Hz Example

This is an example flash at 2.5 Hz, and an area just slightly smaller than 160x160px. It is not likely to cause anybody problems, but I put it in the spoiler out of an abundance of caution. For instance, somebody using a high contrast mode could conceivably cause the parameters of this flashing example to exceed the intended brightness.

The initial flashes are of chromatic contrasts with zero luminance contrast (calculated). And following that are some flashes with different luminance levels and different Color variations.

Each sample flashes twice. Green, blue, orange, red, all flash with zero luminance difference (based on a calculated luminance), this is considered a potential risk because of flashing a saturated red.

Caution ⚠️ Inside this spoiler is a flashing gif.

This gif is flashing at 2.5 Hz.
The value above each color patch indicates the APCA lightness contrast (Lc).

This is an animated GIF which is flashing at 2.5 Hz demonstrating a variety of colors with zero luminance yet substantially visible flashes. Please do not distribute this gif or post it anywhere without the appropriate warnings.

Please do not distribute this gif or post it anywhere without the appropriate warnings.

REFERENCES

Visually sensitive seizures: An updated review by the Epilepsy Foundation

PMID: 35132632 2022 the Epilepsy Foundation of America

Snippet of Main Recommendation

...Images with flashes brighter than 20 candelas/m² at 3-60 (particularly 15-20) Hz occupying at least 10 to 25% of the visual field are a risk, as are red color flashes or oscillating stripes.... Prevention of seizures includes avoiding provocative stimuli, covering one eye, wearing dark glasses, sitting at least two meters from screens, reducing contrast, and taking certain antiseizure drugs.....

To draw your attention to: it says flashes brighter than 20 nits a deeper reading of the historical material indicates this means 20 nits brighter than an off state.

That's actually pretty dim, and it's an interesting value because that's Close to the perception of 18% mid gray, which on a monitor calibrated to a dim 110cd/m² peak white is #777

A monitor that's adjusted to a more common 160cd/m² peak white, then 20 cd/m² is an sRGB value of only #505050rgb(80,80,80) assuming it's flashing against Black. example

For the same 160cd/m² monitor, if the flash was between full white the color 20nits darker would be #f0f0f0rgb(240,240,240) which is barely an SAPC contrast of Lc 6 (out of 106), because of how the HVS weights lightness.

An additional interesting snippet from the main paper (emphasis added)

.....seizures can be provoked by Fourth-of-July fireworks, certain types of cognition, Mah-jong, wind turbines presenting flicker of the sun, and massively multiplayer online role-playing games. Attending a discotheque in The Netherlands tripled the risk for a seizure.

Seizures provoked by an undulating water surface were reportedly provoked by a TV advertisement for the London Olympics in 30 susceptible watchers. Seizures due to “sunflower epilepsy” can be self-induced by waving fingers in front of a light A PPR response, but not a seizure, occurred with the rapid flashes of an iPhone designed to constrict pupils and reduce red eye during taking of a “selfie.” ....

And important 2022 guidance relating to chromatic flashes as well:

a flash is a potential hazard if it is brighter than 20 candelas per square meter, occupies at least 10% of the visual field, flashes or changes color at a frequency between 3 and 60 Hz, and endures for at least half a second. Similar parameters apply to color changes, which are particularly problematic when to and from saturated red with a large chromaticity difference. Red flashes induce more photoparoxysmal responses than do other colors and color sensitivity tends to occur at lower frequencies than does sensitivity to white light.

For reference, the abstract of the 2005 recommendations that WCAG2 is based on:

Photic- and Pattern-induced Seizures: Expert Consensus of the Epilepsy Foundation of America Working Group

Epilepsia, 46(9):1423–1425, 2005

Results: A flash is a potential hazard if it has luminance ≥20 cd/m2, occurs at a frequency of ≥3 Hz, and occupies a solid visual angle of ≥0.006 steradians (∼10% of the central visual field or 25% of screen area at typical viewing distances). A transition to or from saturated red also is considered a risk. A pattern with the potential for provoking seizures contains clearly discernible stripes, numbering more than five light–dark pairs of stripes in any orientation. When the light–dark stripes of any pattern collectively subtend at the eye from the minimal-expected viewing distance a solid angle of >0.006 steradians, the luminance of the lightest stripe is >50 cd/m2 , and the pattern is presented for ≥0.5 s, then the pattern should display no more than five light–dark pairs of stripes, if the stripes change direction, oscillate, flash, or reverse in contrast; if the pattern is unchanging or smoothly drifting in one direction, no more than eight stripes. These principles are easier to apply in the case of fixed media, for example, a prerecorded TV show, which can be analyzed frame-by-frame, as compared with interactive media.

A SMPTE paper

This paper has some additional background that is interesting.

https://www.researchgate.net/publication/253969507_Characterizing_the_Flashing_Television_Images_that_Precipitate_Seizures

Myndex
  • 3,952
  • 1
  • 9
  • 24