Live data from Hacker News

Exploring the Visible Spectrum in Python

codedrome.com

11–20 of 25 posts

Re: Exploring the Visible Spectrum in Python

#13
This mapping of wavelength to RGB value is very misleading: in particular, when moving to higher and higher frequencies, blue does not wrap around to red creating purple. The perceptual color space that we are used to working in by mixing pigments or various frequencies of light is independent of light frequency. Unlike all other colors in the rainbow, there is no single frequency that will activate both the red and blue cones within your eye to create purple; if you had a single frequency between blue and red, it would look green. Instead, you must have two disjoint frequencies both stimulating the red and blue cones simultaneously (note that this is not strictly true, as for some people, the red cones do have some response down in the blue range, but the amount of red response within the blue region is extremely weak, and will not give the sensation of purple that is shown in articles such as this one).

This is why rainbows do not have purple at the edge, and why prisms do not create purple; it is a "non-physical" color (I made that term up, but it hopefully makes sense given my explanation above).

For a more physically-sound mapping of wavelength to color, see the CIE XYZ color system [1]. In particular, in Figure 2, the "pure wavelengths" are given as points along the outside edge of the curved surface, and as you can see, purple does not exist along that outside edge.

For those interested in simulation of color, I highly recommend Jiahao Chen's old notebook "The Colors of Chemistry" [2], which goes through a lot of these concepts, and accurately simulates things like the color of solutions just from knowing their chemical composition. Truly fascinating stuff.

[1] http://www.fourmilab.ch/documents/specrend/ [2] https://github.com/jiahao/ijulia-notebooks/blob/master/2014-...

Re: Exploring the Visible Spectrum in Python

#14
post #7

Earlier quoted context omitted.

No. We are not display-bound. There are tunable lasers and optical parametric oscillators commercially available that will output a specific frequency under computer control, throughout the visible spectrum. There are also frequency comb laser devices that emit a picket fence of frequencies, spanning the visible spectrum, each with a precisely known frequency. Tunable laser sources exist from the far infrared to the…

I think it's fair to say that, as far as commercially available consumer computer displays are concerned (and thus anything relevant to anyone viewing the OP website), we are indeed display-bound.

And given consumer media are RGB encoded (or any triplet of colour flavour), it will be long before having consumer displays with more than 3 usable bands. Sharp Electronics had a display with RGBY(ellow) filters, i.e. Quattron (https://en.wikipedia.org/wiki/Quattron), but no media existed with the 4 required channels, not only that but there was no Yellow primary thus it was "useless".

Re: Exploring the Visible Spectrum in Python

#15

Earlier quoted context omitted.

I think it's fair to say that, as far as commercially available consumer computer displays are concerned (and thus anything relevant to anyone viewing the OP website), we are indeed display-bound.

And given consumer media are RGB encoded (or any triplet of colour flavour), it will be long before having consumer displays with more than 3 usable bands. Sharp Electronics had a display with RGBY(ellow) filters, i.e. Quattron ( https://en.wikipedia.org/wiki/Quattron ), but no media existed with the 4 required channels, not only that but there was no Yellow primary thus it was "useless".

Given we are trichromats I don't get why we would need a 4th band to cover more colors instead of continuing to expand the current 3 bands until the resulting color space encompasses our own.

Re: Exploring the Visible Spectrum in Python

#16
post #8

Earlier quoted context omitted.

It’s better than that. There isn’t a single definition for white. Perhaps someone has one. The best I can do, having studied Color Science at RIT, is that white is any spectral power distribution a person identifies as white. Yes, it’s a circular definition. The topic is deeper than it might seem. I can put someone in a room and show them a color they would swear to be white. And then, in an instant, I can change tha…

Did the course use a particular text? As an oil painter I'm interested in rigorous color science, but I have no affiliation with a university.

It's been about 15 years. There were a number of books as well as other materials. If I remember correctly this was one of them:

https://www.amazon.com/Appearance-Models-Imaging-Science-Tec...

I went looking around to see if I could find a better resource to help you dive into the topic in a more accessible manner. To my surprise Khan Academy seems to have a decent sequence of lectures on Color Science. I didn't watch the videos but the topics cover a reasonable portion of the basic knowledge one needs to start exploring Color Science:

https://www.khanacademy.org/partner-content/pixar/color

Re: Exploring the Visible Spectrum in Python

#17
post #8

Earlier quoted context omitted.

It’s better than that. There isn’t a single definition for white. Perhaps someone has one. The best I can do, having studied Color Science at RIT, is that white is any spectral power distribution a person identifies as white. Yes, it’s a circular definition. The topic is deeper than it might seem. I can put someone in a room and show them a color they would swear to be white. And then, in an instant, I can change tha…

Did the course use a particular text? As an oil painter I'm interested in rigorous color science, but I have no affiliation with a university.

Joseph Albers' 'Interaction of Color' covers how perception of color differs based on context.

Re: Exploring the Visible Spectrum in Python

#18

Earlier quoted context omitted.

And given consumer media are RGB encoded (or any triplet of colour flavour), it will be long before having consumer displays with more than 3 usable bands. Sharp Electronics had a display with RGBY(ellow) filters, i.e. Quattron ( https://en.wikipedia.org/wiki/Quattron ), but no media existed with the 4 required channels, not only that but there was no Yellow primary thus it was "useless".

Given we are trichromats I don't get why we would need a 4th band to cover more colors instead of continuing to expand the current 3 bands until the resulting color space encompasses our own.

Short answer: because the space of real colors is convex. It cannot be fully encompassed by any linear combination of three (or in fact, any finite number of) real primaries.

You can entirely encompass it using imaginary primaries, which is what some color spaces do (e.g. ProPhoto RGB), but it is physically impossible to manufacture a linear primary-based display which does. Adding extra primaries however does greatly help. DLP did this by having 6 (I think) primaries, but I don't think it was widely taken advantage of.

For a visual representation of the problem, look at the first diagram on https://en.wikipedia.org/wiki/Color_space and imagine how to encompass the colored region using a linear combination of three (or more) points within said region. (You can't.)

For the long answer, study up on human tristimulus response curves and how those interact to create the Planckian locus on CIE xy colorimetry diagrams.

Re: Exploring the Visible Spectrum in Python

#19

Earlier quoted context omitted.

I think it's fair to say that, as far as commercially available consumer computer displays are concerned (and thus anything relevant to anyone viewing the OP website), we are indeed display-bound.

And given consumer media are RGB encoded (or any triplet of colour flavour), it will be long before having consumer displays with more than 3 usable bands. Sharp Electronics had a display with RGBY(ellow) filters, i.e. Quattron ( https://en.wikipedia.org/wiki/Quattron ), but no media existed with the 4 required channels, not only that but there was no Yellow primary thus it was "useless".

You don't need a 4th primary to represent all visible colors. You just need imaginary primaries. Heck, even something with real primaries like Rec. 2020 [1] can represent information outside the standard sRGB primaries that a 4th primary would be useful to display. (Granted, a better choice of green primary would work better in that specific case, but such choices aren't always physically realizable.)

Another use is enhancing saturation of an image. My DLP projector has a mode like this to take advantage of its 6 primaries. Enhancing saturation can produce a convex gamut even from a non-convex one (e.g. sRGB), the only means of reproducing of which may be with additional primaries.

By my estimation, the main problem with Quattron wasn't that it had a 4th primary, which is legitimately useful. It's that - as you point out - it didn't. It literally did not have a yellow primary; just a yellow filter illuminated by the red and green primaries. Thats, like, total hokum.

Re: Exploring the Visible Spectrum in Python

#20

This mapping of wavelength to RGB value is very misleading: in particular, when moving to higher and higher frequencies, blue does not wrap around to red creating purple. The perceptual color space that we are used to working in by mixing pigments or various frequencies of light is independent of light frequency. Unlike all other colors in the rainbow, there is no single frequency that will activate both the red and…

Apropos fourmilab, just be warned, years ago the site had errors around whitepoint handling, some later fixed, some clearly not. That Figure 2 has the whitepoint label "W+" very offset from the rendered whitepoint (the Y crossing).

My very fuzzy recollection is it was this specrend code that was behind the oops of a "The Universe is green!" NYTimes front-page(?) article - someone's research generated spectra, and for PR they derived a color using off-the-web code, but didn't recognize the bogosity of the output value. Red-shifted faces.

The Wikipedia discussion of violet[1] currently seems plausible - yay. Unlike the "Black-body radiation" article,[2] which again has a CIE chromaticity diagram with a blackbody curve going through yellow and missing white, which is indicative of broken whitepoint math. Oh well.

> This mapping of wavelength to RGB value is very misleading

As is so much science education content. It can be fun to imagine how different science learning might be if content wasn't so broken.

[1] https://en.wikipedia.org/wiki/Violet_(color) [2] https://en.wikipedia.org/wiki/Black-body_radiation

Post reply on HN