Log in

View Full Version : converting RGB levels to YUV levels


kingmob
7th October 2005, 15:44
It seems to be impossible for me to create anything logical with YV12lut to adjust levels. I cannot seem to grasp how the colors are going to change or what i need to tweak, while i do not have this problem with RGBlut.
So now i was thinking, isn't it possible to somehow convert these numbers to YUV? I'm guessing you can describe either Y, U or V by using RGB values, so each RGB combination is linked to a YUV combination. Extrapolating on this it should be possible to use this while changing levels.
If so, this would save me the colorspace conversion to RGB and back to YV12, which i now need to do on my underwatervideos.
So, am I way off with this or is it possible?

To show what i mean here is something i found by googling:

From RGB to YUV


Y = 0.299R + 0.587G + 0.114B
U = 0.492 (B-Y)
V = 0.877 (R-Y)


It can also be represented as:


Y = 0.299R + 0.587G + 0.114B
U = -0.147R - 0.289G + 0.436B
V = 0.615R - 0.515G - 0.100B




From YUV to RGB


R = Y + 1.140V
G = Y - 0.395U - 0.581V
B = Y + 2.032U