# YUV to HSV to RGB issues

As per this 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?

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.
float saturation = max(r, g, b) - min(r, g, b);