Why use YUV color space instead of RGB color space?
The most common color representation is the RGB color space, which uses red, green, and blue colors to combine other colors. YUV is similar to RGB and is also a color encoding method. Among them, Y represents Luminance, U and V represent Chroma.
Why can YUV color space be used to compress colors?
Human eyes are more sensitive to brightness information and relatively insensitive to color information. This separation characteristic of the YUV color space allows more brightness information to be retained and part of the chrominance information to be discarded during image compression, thereby achieving a higher compression ratio with less impact on visual quality.
How does YUV color space compress colors?
- First, RGB can be converted into YUV representation through simple matrix operations.
2. Then compress the chroma, mainly by reducing the resolution of the chroma, also known as Chroma subsampling. YUV subsampling is usually expressed as a ratio, such as 4:2:2 or 4: 2:0. These ratios describe the sampling rate ratio of the chroma component to the luminance component. For example, 4:2:2 means that there are two chroma samples for every four luminance samples, and 4:2:0 means that there is one chroma sample for every four luminance samples, as shown below:
Application scenarios of YUV
Although YUV is not commonly heard of, due to its excellent compression characteristics, it is currently widely used in various image-related technologies:
- Television broadcasting: YUV is a common color coding method in analog and digital television broadcasting. The Y channel is used for black and white signals, while the U and V channels are used for color information.
- Video processing: Many video encoding standards, such as MPEG and H.264, use the YUV format.
- Computer graphics: The YUV format can be used for color space conversion, which is very useful for certain image processing algorithms.
- Video conferencing and streaming: YUV format is used to compress videos to reduce bandwidth requirements.
- Image and video editing: YUV format is also often used for color correction and special effects processing.
- Machine learning and artificial intelligence: YUV format is used for preprocessing of images and videos to improve the performance of algorithms.