# HSV

The HSV color model shares most of its properties with HSL. (It is recommended that you read about HSL first as this page will build on the page about HSL). The letter V stands for value and is sometimes interchanged with the letter B for brightness [BB09b, p. 205], which points to the fact that the third component is defined differently in this color model. Instead of transforming the RGB cube into a biconal shape, HSV starts with a single inverted cone as shown in the figure below.

Recommended exercises for this section:
• Color matching:
• Color selection:

## Conversion

The hue is again an angle which can be calculated in the same way as for HSL. With the value or brightness for an RGB color $$c_\text{RGB}=(r,g,b)_\text{RGB}$$ now being defined simply as $$v=\max\lbrace r,g,b \rbrace$$, the saturation $$s_\text{HSV}$$ is defined as follows for $$c_\text{RGB} \neq (0,0,0)_\text{RGB}$$ [JG78, p. 22]:

$$s_\text{HSV} = \frac{\max\lbrace r,g,b \rbrace - \min\lbrace r,g,b \rbrace}{\max\lbrace r,g,b \rbrace}$$

Calculating the RGB values $$(r,g,b)_\text{RGB}$$ from a given HSV color $$(h,s_\text{HSV},v)_\text{HSV}$$ works similarly as it does for HSL.

\begin{array}{cCl} c_1 &=& \lfloor h' \rfloor \nonumber\\ c_2 &=& h'-c_1 \nonumber\\ w_1 &=& (1-s_\text{HSV}) \cdot v \nonumber\\ w_2 &=& (1-s_\text{HSV} \cdot c_2) \cdot v \nonumber\\ w_3 &=& (1-s_\text{HSV} \cdot (1 - c_2)) \cdot v \nonumber\\ \left( \begin{matrix} r \\ g \\ b \end{matrix} \right) &=& \begin{cases} (v,w_3,w_1)^\mathsf{T} & \text{if } c_1 = 0 \\ (w_2,v,w_1)^\mathsf{T} & \text{if } c_1 = 1 \\ (w_1,v,w_3)^\mathsf{T} & \text{if } c_1 = 2 \\ (w_1,w_2,v)^\mathsf{T} & \text{if } c_1 = 3 \\ (w_3,w_1,v)^\mathsf{T} & \text{if } c_1 = 4 \\ (v,w_1,w_2)^\mathsf{T} & \text{if } c_1 = 5 \end{cases} \end{array}

A comparison of RGB and HSV is shown in the figure below; HSL and HSV are comparable in the figure below that

Recommended exercises for this section:
• Conversion selection:
• Conversion:

## Limitations

For the same reason as for HSL, the value or brightness of an HSV color does not correspond perfectly to a color's brightness as it is perceived by human beings. This means, if the value component is left constant and only saturation or hue are changed, one cannot expect the original and the new color to be perceived as equally bright. Therefore, both value and lightness may at best serve as an approximation of brightness.

## Literature

[BB09b]
Burger, Wilhelm; Burge, Mark J.: Principles of Digital Image Processing: Fundamental Techniques. Undergraduate Topics in Computer Science. Springer-Verlag London, 1st edition, 2009.
[JG78]
Joblove, George H; Greenberg, Donald: Color spaces for computer graphics. In: ACM siggraph computer graphics. volume 12. ACM, pp. 20–25, 1978.