<p>Think about it this way. To calculate YCbCr of (1, 0, 0), you'll end up with Y = 0.299, Cb = -0.16873, Cr = 0.5. If you take the magnitude of the chroma channels (<code>sqrt(Cb*Cb + Cr*Cr)</code>), you get ~0.53 for the "saturation". The YCbCr color space has a different shape than RGB, so it may represent values differently enough that you don't get the exact same answer in both cases. Furthermore, our perception of luminance and saturation is not consistent among colors. </p>

<p>If all you want is to calculate the saturation of an RGB component, it can be calculated by:</p>

<pre><code>float saturation = max(r, g, b) - min(r, g, b);
</code></pre>

<p>Note that if you attempt to calculate perceptually uniform amounts of color saturation you end up with systems like the <a href="https://en.wikipedia.org/wiki/Munsell_color_system" rel="nofollow noreferrer">Munsell Color System</a> where the shape of the color space is highly irregular compared with the cubes and cylinders of other color spaces.</p>

<p>If you tell us what you're trying to achieve, we might be able to offer an actual solution to whatever the problem is.</p>

CC BY-SA 4.0
2018-05-31T08:08:23.793Z
Thank you for the answer. Well, I was trying to compute hue and saturation from Cb and Cr values. I read hue = atan2(Cr/Cb) and saturation is sqrt(Cr^2+ Cb^2). Saturation I see is nearly 0.5. Same for hue, for Red color it turns out to be 108 degrees when measured from X axis or 18 degrees when measured along Y-axis anticlockwise. Not 0 in any case.
Deepak Sharma
CC BY-SA 4.0
2018-05-30T02:06:09.350Z
2018-05-30T02:06:09.350Z
user1118321
<p>As per <a href="https://patents.google.com/patent/WO2006115784A2/en" rel="nofollow noreferrer">this</a> resource, there is an easy way to convert from YCbCr to HSV. Saturation is sqrt(Cb^2 + Cr^2). Now here is my issue. If I take pure red (1,0,0), green(0,1,0), and blue(0,0,1) colors, convert them to YCrCb, and then compute saturation, I do not get 1. Infact, all the saturations are different no matter which matrix I use for RGB to YCrCb conversion. Am I missing something?</p>

<color><color-science><color-management>
YUV to HSV to RGB issues
Deepak Sharma
# YUV to HSV to RGB issues

(Asked by: username_0 on 2018-05-29)

As per [this](https://patents.google.com/patent/WO2006115784A2/en) resource, there is an easy way to convert from YCbCr to HSV. Saturation is sqrt(Cb^2 + Cr^2). Now here is my issue. If I take pure red (1,0,0), green(0,1,0), and blue(0,0,1) colors, convert them to YCrCb, and then compute saturation, I do not get 1. Infact, all the saturations are different no matter which matrix I use for RGB to YCrCb conversion. Am I missing something?

**Tags:** color, color-science, color-management


---

## 1 answers

### Answer by username_1 on 2018-05-30. Score: 1

Think about it this way. To calculate YCbCr of (1, 0, 0), you'll end up with Y = 0.299, Cb = -0.16873, Cr = 0.5. If you take the magnitude of the chroma channels (`sqrt(Cb*Cb + Cr*Cr)`), you get ~0.53 for the "saturation". The YCbCr color space has a different shape than RGB, so it may represent values differently enough that you don't get the exact same answer in both cases. Furthermore, our perception of luminance and saturation is not consistent among colors.

If all you want is to calculate the saturation of an RGB component, it can be calculated by:

```
float saturation = max(r, g, b) - min(r, g, b);

```

Note that if you attempt to calculate perceptually uniform amounts of color saturation you end up with systems like the [Munsell Color System](https://en.wikipedia.org/wiki/Munsell_color_system) where the shape of the color space is highly irregular compared with the cubes and cylinders of other color spaces.

If you tell us what you're trying to achieve, we might be able to offer an actual solution to whatever the problem is.

> **Comments:**
> **username_0**: Thank you for the answer. Well, I was trying to compute hue and saturation from Cb and Cr values. I read hue = atan2(Cr/Cb) and saturation is sqrt(Cr^2+ Cb^2). Saturation I see is nearly 0.5. Same for hue, for Red color it turns out to be 108 degrees when measured from X axis or 18 degrees when measured along Y-axis anticlockwise. Not 0 in any case.  

---

