views:

73

answers:

4

Hi Below is a matrix to convert YCbCr to RGB, Can you tell me how can I get formula to convert YCbCr to RGB? I mean, I have YCbCr value available and I want to get RGB from it. RGB to YUV Image

+1  A: 
Y = 0.2126*(219/255)*R + 0.7152(219/255)*G + 0.0722*(219/255)*B + 16
CB = -0.2126/1.18556*(224/255)*R - 0.7152/1.8556(224/255)*G + 0.5*(219/255)*B + 128
CR = 0.5*(224/255)*R - 0.7152/1.5748(224/255)*G - 0.0722/1.5748*(224/255)*B + 128
Thanks for quick answer, but question is about how to have YCbCr to RGB converion.
Sunny
Why are you not satisfied with this formula?
I mean I have YCbCr available and I want to convert it to RGB.
Sunny
+1  A: 

http://www.fourcc.org/fccyvrgb.php has YUV to RGB conversions.

I82Much
I have YCbCr aleready available, I just need a formula to convert that YCbCr to RGB. That formula should be based on above table.
Sunny
@Sunny, did you check the link? Both formulas are available.
Mark Ransom
@Mark Ransom, But I want formula derived from above matrix only.
Sunny
+1  A: 

If you are asking how the formula is derived, you may want to search for "color coordinate systems". This page has a good discussion on the YCbCr space, in particular.

We know that almost any color can be represented as a linear combination of red, green, and blue. But you can transform (or "rotate") that coordinate system such that the three basis elements are no longer RGB, but something else. In the case of YCbCr, the Y layer is the luminance layer, and Cb and Cr are the two chrominance layers. Cb correlates more closely to blue, and Cr correlates more closely to red.

YCbCr is often preferred because the human visual system is more sensitive to changes in luminance than quantitatively equivalent changes in chrominance. Therefore, an image coder such as JPEG can compress the two chrominance layers more than the luminance layer, resulting in a higher compression ratio.

EDIT: I misunderstood the question. (You should edit it to clarify.) Here is the formula to get RGB from YCbCr, taken from the above link:

r   =   1.0 * y'    + 0 * cB    + 1.402 * cR
g   =   1.0 * y'    - 0.344136 * cB - 0.714136 * cR
b   =   1.0 * y'    + 1.772 * cB    + 0 * cR
Steve
I have YCbCr aleready available, I just need a formula to convert that YCbCr to RGB. That formula should be based on above table.
Sunny
Nice link, but the formula is not quite right - as stated it's for values 0.0-1.0, not 0-255.
Mark Ransom
Yes, good point. The link also contains the extra (yet simple) modification for [0,255].
Steve
+2  A: 

I'm not going to account for the round portion, but since M looks invertible:

alt text

You can round the resulting vector.

Jacob