1
$\begingroup$

I am testing conversion from RGB to YCbCr in Python's pillow imaging module (formerly PIL), and am getting predictable results overall, except for green, as represented in the Cr channel component of the YCbCr version of image.

For blue, I get white (RGB (255,255,255); V in HSV of 100%) in the Cb channel, and black (RGB (0,0,0); V in HSV of 0%) for yellow in the same channel. In Cr, I get white for the red colour, but (RGB (21,21,21); V in HSV of 8%) for green. Shouldn't green be black in Cr?

I thought I would check here before claiming there is a bug in pillow. Perhaps I'm missing something about YCbCr, and the green of it is not the same as the RGB green. But I don't think so, as blue, yellow and red do match RGB.

$\endgroup$

1 Answer 1

1
$\begingroup$

Found the answer with more experimentation: the opposite colour to red in Cr is not green but cyan, RGB (0,255,255), and it does appear black in the Cr channel. This makes sense, as yellow, RGB (255,255,0), is opposite blue.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.