Undefined components in YCbCr color space

2 views (last 30 days)
Toma Sh
Toma Sh on 13 Nov 2020
Commented: Toma Sh on 29 Nov 2021
Is there any componen in the YCbCr color space undefined in some cases?
Like in HSV, the Hue plane is undefined when Saturation equals 0. Also, the Hue and Saturation are undefined when Value equals 0 'Black'.
Please help me.

Accepted Answer

DGM on 27 Nov 2021
Edited: DGM on 28 Nov 2021
I know this is dead, but I'm bored on a slow Saturday.
No, not in the same way. YCbCr is just a simple linear transformation of the color values.
% transformation matrix
A = [0.299 0.587 0.114;-0.1687 -0.3313 0.5;0.5 -0.4187 -0.08131];
Asc = [219; 224; 224]; % scaling for uint8
os = [16; 128; 128]; % offset
% convert to 8-bit YCbCr
RGB = uint8([100 100 100]); % a single uint8 color tuple
YCC = uint8((A.*Asc)*im2double(RGB(:)) + os)
YCC = 3×1
102 128 128
While in practice, you could use rgb2ycbcr(), the above demonstrates that the conversion is simple arithmetic. It's all just scaling and translation, no funny stuff.
In HSV or similar, you run into issues due to the polar model. What is the hue angle of a zero-length vector (when S = 0)? If saturation (S) is a normalized metric and the normalizing value is zero at the neutral corners, the meaningfulness of S collapses there since (e.g.) 50% of the distance from 0 to 0 is still 0. Does black lie on the neutral axis where S is 0, or does it lie on the surface of the cube, where S = 1?
There's nothing special about YCbCr in that sense. You can just as easily express YCbCr or LAB in polar coordinates and you'll have the same problem with hue ambiguity at the neutral axis. If you normalize the chroma axis, you'll have to make the same decision about how to handle the neutral corners.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!