2

$$ \begin{pmatrix} Y \\ Cb \\ Cr \end{pmatrix} = \mathrm{Round} \left\{ \begin{pmatrix} 0.2126\times\frac{219}{255} & 0.7152\times\frac{219}{255} & 0.0722\times\frac{219}{255} \\ -\frac{0.2126}{1.8556}\times\frac{224}{255} & -\frac{0.7152}{1.8556}\times\frac{224}{255} & 0.5\times\frac{224}{255} \\ 0.5\times\frac{224}{255} & -\frac{0.7152}{1.5748}\times\frac{224}{255} & -\frac{0.0722}{1.5748}\times\frac{224}{255} \end{pmatrix} \begin{pmatrix} R \\ G \\ B \end{pmatrix} \right\} + \begin{pmatrix} 16 \\ 128 \\ 128 \end{pmatrix} $$

Is it possible to derive formula from above matrix that converts YCbCr to RGB? I am newbie to maths.

I have YCbCr value already available, I want to convert it to RGB.

kennytm
  • 7,495
SunnyShah
  • 139
  • 1
    You should be able to translate the formulae in the wiki page to matrix format... – J. M. ain't a mathematician Oct 27 '10 at 12:06
  • 1
    I interpreted his question as asking how to invert that transformation in his linked equation; hence the wiki entry containing the YCbCr▶RGB conversion, which can be translated to a matrix-vector format if one wishes. As it stands, I don't know how to invert something that has the rounding function in it. :) – J. M. ain't a mathematician Oct 27 '10 at 13:11
  • @J.M.: You're right, I misread the question. I shouldn't be browsing this site late at night... :-/ –  Oct 27 '10 at 18:28
  • The round function just round up or down the number? if that is the case, just take it out and then it not hard to do. – yiyi Jan 26 '12 at 19:03

1 Answers1

2

This is just a linear matrix. All you need is to do a complete reverse. (This will not take into the account Round part)

So let:

C - you YCbCr matrix
M - be your transformation matrix (the one with a lot of math inside)
V - your [16 128 128]' vector
R - your RBG matrix

So your starting formula is:

C = round( M * R ) + V

So in reverse this will be

R = M^(-1) * (C - V)