YUV Color Space
YUV[1] defines each pixel has:
- one Y Luminance, luma vector
- two chrominance vector , where..
- U is
blue projection
. - V is
red projection
.
- U is
It can be convert to and from RGB model and other color spaces.
Luminance:
Chrominance (U, V) (Blue, Red projection):
❓Why YUV instead of RGB
Typical RGB has 8 bits per compoment (R, G, B) with a total 24 bits per pixel. However, YUV can be 4 bits per compoment (Y, U , V) with a total 12 bits per pixel.
This reduce the space when storing pixel in the memory and reduce the bandwidth when video transportation.
❓What is YUV 8bits and 10bits?
YUV 8 bits and 10 bits are represent as the depth
of each compoment, e.g. Y
, U
and V
.
Common YUV format
YUV Format | Bits per Pixel (8bit) | Description |
---|---|---|
#YUV4 4 4 format | 24 | |
#YUV4 2 2 format | 16 | |
#YUV4 2 0 format | 12 | also known as i420 |
#YUV4 1 1 format | 12 |
YUV4:4:4 format
Each pixel contains Y
, U
and V
compoments and each compoments are 1 byte
.
YUV4:2:2 format
Each 2 horizontal
pixels contains 2 Y
, 1 U
and V
compoments and both pixels share the same U
and V
. YUV4:2:2 has different packed format, check here.
YUV4:2:0 format
Each 2 horizontal
and 2 vertical
pixels (total 4 pixels) contains 4 Y
, 1 U
and 1 V
compoments and four pixels share the same U
and V
.
YUV4:1:1 format
Each 4 horizontal
pixels (total 4 pixels) contains 4 Y
, 1 Y
and 1 U
compoments and four pixels share the the same U
and V
.
⚙️ YUV444 to / from RGB888 conversion
to YUV Fomula:
to RGB Folula:
Where:
- *
- *