Forum > General
[SOLVED] How do I use YCbCr Color space?
(1/1)
lulZghost:
For a school project I have to make an converter that extracts Y, Cb and Cr channels from a picture.
I found the calculations on the internet but the result doesn't look like any example. So I think I didn't use the calculated value right. I don't really find anything for YCbCr in Pascal ... because I don't really know what to do I rounded them which brought the result you can see on the attached image.
y:= R * 0.29900 + G * 0.58700 + B * 0.11400;
cb:= R * -0.16874 + G * -0.33126 + B * 0.50000 + 128;
cr:= R * 0.50000 + G * -0.41869 + B * -0.08131 + 128;
//
Edit: I figured it out. I did an rough mistake while drawing the new canvases. New and correct result : https://i.gyazo.com/35034be3de10217561b98ddb4b4f243c.png.
lucamar:
You have probably seen this already but just in case: Wikipedia: YCbCr.
It includes the (correct) formulae to convert from RGB.
ETA: Charles Poynton's Color FAQ is a must-read-and-keep-close if you intend to do much work about color.
jamie:
G = 59%
R = 30%
B = 11%
Summed = Y; (Chroma)
As for the B and R channel color channels the two of them are at 50% for a gray scale.
By calculating the percentage of B and R difference of G you get the 50%+/- depending on which
direction it is with the R channel.
So if R and B were both at 0 then Green would be the dominate color.
going the other way, that is B and R in the + range would reduce the G gain etc
Its hard to think about but I've done some slow scan software where I had to support these older style
of color formats.
Navigation
[0] Message Index