next up previous contents index
Next: I.4 Color interpolation Up: I. Color Space: The Previous: I.2 HSV color system   Contents   Index

I.3 The color cube

We are going to try to give you a geometric picture of color mixing in RGB and HSV by means of a tour of the RGB cube depicted in Figure 7.11. The geometric picture is most helpful, we think, since HSV are not orthogonal coordinates and not found from RGB by a simple algebraic transformation. So here goes: Look at the cube face with black, red, magenta, and blue corners. This is the $g$ = 0 face. Orient the cube so that you are looking at this face with black in the lower left corner. Now imagine a right-handed cartesian ($r$,$g$,$b$) coordinate system with origin at the black point; you are looking at the $g = 0$ plane with $r$ increasing to your right, $g$ increasing away from you, and $b$ increasing up. Keep this sense of ($r$,$g$,$b$) as you look at the cube.

Now tip the cube such that the black corner faces down and the white corner up. When looking from the top, you can see the hue, contoured in gray solid lines, running around in 360° counter-clockwise. It starts with shades of red (0°), then goes through green (120°) and blue (240°), back to red.

On the three faces that are now on the lower side (with the white print) one of ($r$,$g$,$b$) is equal to 0. These three faces meet at the black corner, where $r=g=b=0$. On these three faces the colors are fully saturated: $s$ = 1. The dashed white lines indicate different levels of $v$, ranging from 0 to 1 with contours every 0.1.

On the upper three faces (with the black print), one of ($r$,$g$,$b$) is equal to the maximum value. These three faces meet at the white corner, where $r=g=b=255$. On these three faces value is at its maximum: $v$ = 1 (or 100%). The dashed black lines indicate varying levels of saturation: $s$ ranges from 0 to 1 with contours every 0.1.

Now turn the cube around on its vertical axis (running from the black to the white corner). Along the six edges that zigzag around the ``equator'', both saturation and value are maximum, so $s = v = 1$. Twirling the cube around and tracing the zigzag, you will visit six of the eight corners of the cube, with changing hue ($h$): red (0°), yellow (60°), green (120°), cyan (180°), blue (240°), and magenta (300°). Three of these are the RGB colors; the other three are the CMY colors which are the complement of RGB and are used in many color hardcopy devices (see below). The only cube corners you did not visit on this path are the black and white corners. They lie on the vertical axis where hue is undefined and $r=g=b$. Any point on this axis is a shade of gray.

Let us call the points where $s = v = 1$ (points along the RYGCBM path described above) the ``pure'' colors. If we start at a pure color and we want to whiten it, we can keep $h$ constant and $v = 1$ while decreasing $s$; this will move us along one of the cube faces toward the white point. If we start at a pure color and we want to blacken it, we can keep $h$ constant and $s = 1$ while decreasing $v$; this will move us along one of the cube faces toward the black point. Any point in ($r$,$g$,$b$) space which can be thought of as a mixture of pure color + white, or pure color + black, is on a face of the cube.

The points in the interior of the cube are a little harder to describe. The definition for $h$ above works at all points in (non-gray) ($r$,$g$,$b$) space, but so far we have only looked at ($s$, $v$) on the cube faces, not inside it. At interior points, none of ($r$,$g$,$b$) is equal to either 0 or 255. Choose such a point, not on the gray axis. Now draw a line through your point so that the line intersects the gray axis and also intersects the RYGCBM path of edges somewhere. It is always possible to construct this line, and all points on this line have the same hue. This construction shows that any point in RGB space can be thought of as a mixture of a pure color plus a shade of gray. If we move along this line away from the gray axis toward the pure color, we are ``purifying'' the color by ``removing gray''; this move increases the color's saturation. When we get to the point where we cannot remove any more gray, at least one of ($r$,$g$,$b$) will have become zero and the color is now fully saturated; $s = 1$. Conversely, any point on the gray axis is completely undersaturated, so that $s = 0$ there. Now we see that the black point is special, $s$ is both 0 and 1 at the same time. In other words, at the black point saturation in undefined (and so is hue). The convention is to use $h = s = v = 0$ at this point.

It remains to define value. To do so, try this: Take your point in RGB space and construct a line through it so that this line goes through the black point; produce this line from black past your point until it hits a face on which $v = 1$. All points on this line have the same hue. Note that this line and the line we made in the previous paragraph are both contained in the plane whose hue is constant. These two lines meet at some arbitrary angle which varies depending on which point you chose. Thus HSV is not an orthogonal coordinate system. If the line you made in the previous paragraph happened to touch the gray axis at the black point, then these two lines are the same line, which is why the black point is special. Now, the line we made in this paragraph illustrates the following: If your chosen point is not already at the end of the line, where $v = 1$, then it is possible to move along the line in that direction so as to increase ($r$,$g$,$b$) while keeping the same hue. The effect this has on a color monitor is to make the color more ``brilliant'', your hue will become ``stronger''; if you are already on a plane where at least one of ($r$,$g$,$b$) = 255, then you cannot get a stronger version of the same hue. Thus, $v$ measures brilliance or strength. Note that it is not quite true to say that $v$ measures distance away from the black point, because $v$ is not equal to $\sqrt{r^2 + g^2 + b^2}/255$.

Another representation of the HSV space is the color cone illustrated in Figure I.3.

Figure I.3: The HSV color space.
$\textstyle \parbox{0.54\textwidth}{\lq\lq Pure'' colors are around the edge of the c...
...black) at the bottom to 1 at the top. Gray shades are along the vertical axis.}$Image hsv-cone


next up previous contents index
Next: I.4 Color interpolation Up: I. Color Space: The Previous: I.2 HSV color system   Contents   Index
Paul Wessel 2010-07-14