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.
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 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.