What is YUY2 byte meaning? Y0?,U0?Y1?.....?Are they for color, which color?
Could you explain?
I have an image YUY2 format and I want to image processing on this format. But I dont know image byte value.
+ Reply to Thread
Results 1 to 7 of 7
Bytes line up like this across the line.
YUY2 is a 4:2:2 standard
Y0 is a 8 bit luminance pixel component
U0 is a 8 bit (R-Y) pixel component
V0 is a 8 bit (B-Y) pixel component
All three represent a pixel on the screen. Since UV are half sampled, the next pixel would look like this
and so on ...
BTW: Green = Y-(Red-Y)-(Blue-Y) = Y-U-V
Does that help?
I understand from your note,
Y0= luminance of macropixel that is two pixel of image.
U0= red value of macropixel....
V0=blue value of macropixel....
but Y1 =? Is this also for luminance of macropixel?Sinan
"but Y1 =? Is this also for luminance of macropixel?"
Pixel 1 = Y0-U0-V0
Pixel 2 = Y1-U0-V0
The two pixels represent a macropixel. Data byte order Y0-U0-Y1-V0
The logic is that Y0 and Y1 do share the U0 and V0 Color compounds.
in YUY2 the HORIZONTAL Colorfrequency is half the lumafrequency in planar YV12 its even that Colorfrequency is a quarter (half vert. and half horiz.) of the Lumafrequency.
The YUYVYUYVYUYV order of YUY2 describes a packet/interleaved format where for example YV12 is a planar format.
So for parsing the Y Values you need to peek every second byte in the MemorySpace starting from first byte of the YUY2 Data memory adress+zero where the YUY2 Data is stored. For U then its the first byte +1 and then every fourth, for V its the first byte +3 and also here every fourth.
Put these into separate Y U V Arrays and you'll see again that the U and V arrays do will have a quarter of the Y array in their size each.
That alocation of bytes makes it possible to keep YUY2 and YV12 Data byte-alignet. BUT you have to watch out when parsing the values of these Y U V bytes as Y Values are stored as least significant bits (LSBs) and U and V values are stored as most significant bits (MSBs).
Means if Y < 0 then Y = Y + 256 ... for getting the common used Y value out of the LSB value.
So if Y = -16 the Y is 240! .. means highest lit value in Y luma range.
Also a very good page (dunno if it already has been mentioned in the posts above):
When doing RGB to YUV conversions there are several maths according to CCIR Standards available as to bee seen in this link like posted some posts above:
Originally Posted by incredible
Y = (0.257 * R) + (0.504 * G) + (0.098 * B) + 16
U = Cb = -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128
V = Cr = (0.439 * R) - (0.368 * G) - (0.071 * B) + 128