📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Color Spaces: Explained from the Ground Up - Video Tech Explained

Video Tech Explained16:24

Transcription

So remember that video I made way back when about color spaces? You know, drawing triangles on this weird blob shape? Well, while that video wasn't wrong, exactly, it was a bit of a narrow view into the world of color spaces and color theory in general. So, in this video, I'd like to explain everything that you need to know about color spaces from the ground up, assuming no prior knowledge. So buckle up, because we're about to dive head first into a whole bunch of abstract math and really funky geometry.

[Music]

[Music]

Let's start at the very beginning. In order to answer the question, "What is a color space?" we first have to answer the more basic question, "What is color?" The sun emits electromagnetic radiation across a very wide spectrum, and in relative balance, all of the frequencies that comprise the visible spectrum are present in roughly equal quantities. But that all changes when light from the sun, or some other source, reflects off of an object. Different materials reflect different frequencies of light better than others. So, this creates an imbalance in the light's spectral power distribution, which is just a fancy term to describe the relative proportion of different frequencies that are present in a given sample of light. Being sensitive to these changes is a useful evolutionary trait, because it allows us to extrapolate additional information about what sort of object we're looking at. And so, our eyes sense the relative makeup of the light in our environment, and then our brains interpret those raw signals in order to create what we know as color vision. But the crucial thing is, these colors only exist inside our brains. Color isn't really a property of the physical world; it's just a subjective sensation that we experience in response to the light our eyes receive. While there is a correlation between the light around us and the color we experience, they are not the same thing. So, we can already see that there's a sort of translation going on between electromagnetic waves and subjective sensation.

Now, as artists, we have a clear interest in being able to recreate particular color sensations. But since we can't create color directly, we need some sort of system which allows us to consistently recreate the spectral power distribution that will result in a certain color inside the viewer's brain. Essentially, this is what a color space is: a system for consistently recreating particular color sensations.

Now, color spaces come in many different shapes and sizes, some more relevant to the world of digital video than others. But just as an example, let's take a look at the Pantone color space. The Pantone color space isn't used in the realm of photography very much, but it's incredibly useful when creating physical objects of a certain color. It works like this: the Pantone company developed a series of standardized pigments and assigned them names and numbers based on the subjective color sensation that they created. If an artist has a particular color in mind and they wish to communicate that color to another artist, they can look at their collection of Pantone references and choose the one that most closely matches the color in their mind. They can then share the ID of the chosen reference with the other artist. The other artist then picks out the corresponding material from their own Pantone set and gets an understanding of which color the original artist was referring to. So, we can see how the Pantone color space enables a much greater degree of precision when choosing colors. It allows someone to take the subjective color sensation in their mind and express it as an objective quantity, which another person can use to recreate the exact same color sensation.

Now, that's great and all, but how are color spaces relevant to digital video? Well, let's take a look at what's actually happening when a video is created. Light enters a camera, which needs to convert it into some digital data, basically a series of numbers. Then, at some point down the line, a monitor needs to read those numbers and turn them back into light. And ideally, the light coming out of the monitor should result in more or less the same color sensation as the light which entered the camera would. So, once again, we can see the need for a translation layer that converts light information into numbers and then back again.

But if we were to map every possible spectral power distribution onto a unique set of numbers, then we'd end up with a lot of redundancy. This is because of a phenomenon called metamerism. Sometimes, different spectral power distributions can result in the same perceived color. For example, the color yellow could be the result of pure yellow light, or it could be the result of red and green light mixed together. These different spectral power distributions result in the same color, so we can make our lives easier by assigning them to the same set of numbers. We're only concerned about how a human viewer will perceive the light coming out of the monitor, so it doesn't matter if our monitor actually produces a different spectral power distribution than what entered the camera, as long as they result in the same perceived color.

But how do we determine which perceived color a particular spectral power distribution results in? Well, let's start by looking at how our eyes actually sense color. Inside our eyes, there are three different types of cone cells, which are each sensitive to a different portion of the visible spectrum. We have one kind for long wavelengths, another for medium wavelengths, and then a third for short wavelengths. Let's call these cones long, medium, and short cones, or just L, M, and S. Using some empirical measurements, we can generate these functions which show how much each type of cone activates in response to a certain frequency. We can see that there's quite a bit of overlap, with every frequency activating at least two types of cones. And it's this response which creates a sensation of color. Different spectral power distributions can result in the same color because they activate our cones in the same way. So, by mapping every possible response from our cones, we also get a map of every possible color sensation without any of those duplicates.

Okay, so let's do that. To make the math easier, let's convert these L, M, and S values into a more friendly coordinate system, like X, Y, and Z. This allows us to map every frequency of light to a point in 3D space, which looks like this. But of course, in the real world, light almost never exists as pure frequencies; it's always some combination of them. But we can fill out this graph to map every possible color, like so. For example, if two frequencies are present in the same quantity, we can draw a line between them and pick the midpoint to represent this new color. If one frequency is present in greater quantity than the other, then we can slide our selection closer to that side of the line and choose another point. In this way, we can use combinations of pure frequencies to fill out the entire visible spectrum. And notice that because of the method we use to generate this diagram, when different combinations of frequencies result in the same activation from our cones, they also end up mapping to the same point on our chart. So, we can see that every point contained within this shape corresponds to a single color sensation. This is the CIE 1931 XYZ color space, which maps every possible color sensation onto a set of X, Y, and Z coordinates.

Now, in reality, this is a three-dimensional space, but that's because we're mapping every possible luminance of a color in addition to its hue and saturation. So, for the sake of simplicity, we can use another transform to separate the luminance information out into just the vertical axis, and then we can look at a two-dimensional slice of the resulting graph to see every possible chromaticity at a given luminance level. This is what results in that weird blob shape that you've probably seen before. It's just a two-dimensional simplification of the complete three-dimensional XYZ space.

So, this is great. We can use the CIE color space to convert light into a set of coordinates and back again. But there's still another problem. Cameras aren't able to perfectly distinguish every frequency of light from every other frequency. The best they can do is put filters over certain pixels which only allow certain ranges of wavelengths to pass through. And monitors work in a similar manner, using color filters to produce a few specific frequencies of light in varying quantities. But this is actually fine, because remember, any given color can be created using many different combinations of frequencies. So, what we can do is choose a few primary frequencies for our cameras and monitors to work with, and then use those in various combinations to produce any other color we might need.

And this brings us to the ever-popular RGB color space. The RGB color space describes how to express almost any color as a combination of red, green, and blue. And this is a system that's used by most monitors. Every pixel is comprised of three sub-pixels, each of which only emits one of the primary colors. By controlling how much light is emitted by each of the sub-pixels, a monitor can use the RGB color space to create almost any color in the visible spectrum.

So, if monitors actually use the RGB color space, then why did I spend several minutes talking about the XYZ color space? Well, the problem with RGB is that by itself, it actually isn't enough to consistently recreate color. The RGB system is only consistent relative to the three primary colors. I mean, think about it: there are a wide range of colors that could be considered red under the right circumstances, and the same is true for green and blue. If two different monitors use different frequencies to create red, green, and blue, then they'll end up producing different colors when provided with the same RGB data. So, what we need to do is define those primary colors in absolute terms, so there's no ambiguity. And this is where the CIE 1931 color space comes back into play. Unlike RGB, it is an absolute color space, since it's defined in terms of physical phenomena. And we can use this to define the RGB color space in absolute terms as well. We can assign our primary colors of red, green, and blue to specific X, Y, and Z coordinates within the CIE 1931 color space. And since the XYZ color space is defined in absolute terms, our new RGB color space will be as well.

And this is how most color spaces used in digital video work. They define X, Y, and Z coordinates for their primaries, and then use the RGB color model relative to those primaries to define all of the other colors. So, color spaces like Rec. 709, DCI P3, and Rec. 2020 are all absolute color spaces, despite operating in RGB. The only differences between them are the points that they choose for their primaries.

You may have also noticed that these color spaces don't actually cover the entire visible spectrum. There are many colors within the CIE 1931 color space that can't be represented using the RGB primaries of a given color space. But this is actually okay, and in fact, maybe even desirable. Generally speaking, the wider the range of colors that a monitor will need to reproduce, the more expensive it will be. And the thing is, while the colors on the outer edges of the CIE 1931 color space are within the range of human vision, we just don't really see them all that often. So, by defining a color space that only contains the most commonly used colors, we can build monitors using this smaller color space for a fraction of the cost. Larger color spaces will allow us to reproduce more vibrant colors, but they'll also increase the cost of the monitors required to view them properly.

And so, this is how we maintain consistent color throughout the video production process. A camera uses RGB color filters on its sensor to measure the makeup of the light entering the lens, then records those RGB values into a file. Then, a monitor reads those RGB values and uses its own color filters to produce varying quantities of red, green, and blue light. As long as the color filters on the camera and monitor are designed around the same absolute definitions of red, green, and blue, then we know that the color will be consistent from the beginning to the end.

Now, of course, in the real world, it's never quite this simple. Cameras and monitors never adhere to color space standards perfectly. But by using an absolute color space as a reference point for calibration, we can achieve a much greater degree of accuracy than would otherwise be possible. Additionally, it's not uncommon for the native color space of a camera or monitor to differ from the one that's actually being used. The color filters that are used likely won't exactly match any standard primaries. But the good news is that as long as the absolute definitions of the source and destination color space are known, it isn't too difficult to transform between them. The RGB coordinates produced by one color space can be converted into their absolute XYZ coordinates, and then to a new set of RGB coordinates relative to the destination color space. So, it's okay for cameras and monitors to have different native color spaces, as long as the appropriate conversion happens at some point.

So, at long last, let's wrap this up. While color spaces are complicated and convoluted, properly understanding the inner workings of the color spaces used in digital video and other applications can be a very valuable skill. Once you know what's going on under the hood of your favorite graphics programs, you can take greater control of your post-production process and produce stunning results, no matter what sort of device you're delivering to. Anyways, I hope you all enjoyed this video. My name is Cayman Crocker, signing off.

[Music]