2
$\begingroup$

$$ \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.

  • 1
    You should be able to translate the formulae in the [wiki page](http://en.wikipedia.org/wiki/YCbCr) to matrix format...2010-10-27
  • 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. :)2010-10-27
  • 0
    @J.M.: You're right, I misread the question. I shouldn't be browsing this site late at night... :-/2010-10-27
  • 0
    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.2012-01-26

1 Answers 1

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)