Pages

Sunday, January 30, 2022

Pigment of the Imagination

I've previously mentioned Janelle Shane's blog, AI Weirdness, about applying artificial intelligence software to unusual tasks, often producing hilarious results. This week's post was about coming with new paint colors, and after I shared it on social media, my friend Garrett brought up an interesting aspect: Computers typically express color using a standard called sRGB, but this is only a subset of the colors our eyes can perceive. Thinking about this sent me down a rabbit hole of reading about color perception, generation, and physical properties.

As a physicist, I think of color as synonymous with wavelength, a property of light. Visible light is a small slice of the EM spectrum, ranging from longer-wavelength red to shorter-wavelength blue:

Cropped from Wikipedia

However, this does not capture the full range of colors people see! Humans perceive color via cells in our eyes called cones. They come in three varieties, which are sensitive to different parts of the visual spectrum. I long believed these were evenly spaced in red, green, and blue, but it's not as clear-cut as that. While reading about this stuff, I found a Python package called Colour, which includes a tool to plot the different cone's responses to wavelengths:

As you can see, there's pretty significant overlap between the nominal red and green cones, and the red also can pick up blue light. People with color blindness are typically missing one type of cone, and you can see that that wouldn't decrease the range of wavelengths, just the nuance. [Correction from Garrett: This is actually the "standard colorimetric observer," which is different from the actual cone sensitivity, which doesn't include the bump in red.]

In 1931, a group called the International Commission on Illumination (CIE, since they were French) came up with a description of the space of colors humans perceive, using the responses of the 3 cone types shown above. We can transform those 3 variables to eliminate the overall intensity, and just look at the color variation in what's called a chromaticity diagram:

Around the curved border you can see labels for the wavelengths of those pure colors, but the interior colors can only be produced by mixtures. The lower edge is called the line of purples, and represents colors that have no single-wavelength equivalent.

Of course, everything I've showing you is being displayed on your computer screen. An LCD screen displays colors by mixing amounts of red, green, and blue light:

Woods et al., Figure 3

Once again we see that these colors have a fair amount of overlap, but they are more separated in wavelength than our cones. To specify the amount of each color to use, computers use one byte (up to 256 values) for each of red, blue, and green. That range of values results in the dashed triangle in the chromaticity plot above. As Garrett pointed out, this is only one corner of that space. The trouble is, We're looking at that plot on a computer using RGB color, so we can't even see what we're missing! The funny thing is, when I originally shared Shane's post, I was thinking of my artist-cousin Autumn using some of the new AI-named colors, but working in the real world her palette is even more expansive.

No comments:

Post a Comment