RGB and YUV, YCbCr

Source: Internet
Author: User

Better articles to collect links:

https://www.douban.com/note/76361504/

Http://blog.sina.com.cn/s/blog_a85e142101010h8n.html

Here is what I pasted from the link article, convenient for me to query.

"1"RGB

RGB (red-green-blue) is defined by the color of the human eye recognition of the space, can represent most of the color. However, in scientific research, the RGB color space is generally not used because its details are difficult to adjust digitally. It will be tonal, brightness, saturation of three to put together to show that it is difficult to separate. It is the most versatile, hardware-oriented color model. The model is used for color monitors and a large class of color video cameras.

"2"YUV

In YUV space, each color has a luminance signal Y, and two chroma signals U and V. The luminance signal is the feeling of intensity, and it disconnects from the chroma signal, so that the intensity can be changed without affecting the color.

YUV uses RGB information, but it produces a black-and-white image from a full-color image, and then extracts three main colors into two additional signals to describe the color. The combination of these three signals can produce a full color image.

The Y-channel describes the Luma signal, which is a little different from the luminance signal, and the range of values is between light and dark. Luma is a signal that black and white can see. The U (Cb) and V (Cr) channels extract luminance values from red (U) and Blue (v) to reduce the amount of color information. These values can be combined from a new combination to determine red, green, and blue mixed signals.

YUV (YCBCR) sampling format:

The main sampling formats are YCbCr 4:2:0, YCbCr 4:2:2, YCbCr 4:1:1, and YCbCr 4:4:4. Among them, YCbCr 4:1:1 is more commonly used, the meaning is: each point to save a 8bit brightness value (that is, Y value), every 2 x 2 points to save a CR and CB value, the image in the naked eye does not feel much change. So, the original RGB (R,g,b are 8bit unsigned) model, each point requires 8x3=24 bits, and now only need 8+ (8/4) + (8/4) =12bits, the average of 12bits per point. This compresses the image data by half.

Above only gives a theoretical example, in the actual data storage is likely to be different, the following gives several specific storage forms:

(1) YUV 4:4:4

YUV Three channel sampling rate is the same, so in the generated image, the three component information of each pixel is complete (each component is usually 8 bits), after 8 bit quantization, uncompressed each pixel occupies 3 bytes.

The following four pixels are: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

The stored stream is: Y0 U0 V0 Y1 U1 V1 Y2 U2 V2 Y3 U3 V3

(2) YUV 4:2:2

The sampling rate of each chromatic channel is half that of the luminance channel, so the chromaticity sampling rate in the horizontal direction is only half 4:4:4. For uncompressed 8-bit quantization images, a macro pixel consisting of two pixels adjacent to each other horizontally requires 4 bytes of memory (for example, the first two pixels mapped below require only Y0, Y1, U0, V1 four bytes).

The following four pixels are: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

The stored stream is: Y0 U0 Y1 V1 Y2 U2 Y3 V3

Mapped pixel points: [Y0 U0 V1] [Y1 U0 V1] [Y2 U2 V3] [Y3 U2 V3]

(3) YUV 4:1:1

The chroma sampling of the 4:1:1 is a 4:1 sampling of the chroma in the horizontal direction. This is still acceptable for low-end users and consumer products. For uncompressed 8-bit quantization video, a macro pixel consisting of 4 pixels adjacent to each other horizontally takes 6 bytes of memory

The following four pixels are: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

The stored stream is: Y0 U0 Y1 Y2 V2 Y3

Mapped pixel points: [Y0 U0 V2] [Y1 U0 V2] [Y2 U0 V2] [Y3 U0 V2]

(4) yuv4:2:0

4:2:0 does not mean that there is only Y,CB and no CR component. It means that for each line of scanning, only one chroma component is stored at a sampling rate of 2:1. Adjacent scan rows store different chroma components, that is, if one line is 4:2:0, the next line is 4:0:2, and the next line is 4:2:0 ... and so on. For each chroma component, the sampling rate for both horizontal and vertical directions is 2:1, so the sampling rate of chromaticity is 4:1. For video with uncompressed 8-bit quantization, a macro pixel of each pixel adjacent to a 2x2 2 rows and 2 columns takes up 6 bytes of memory.

The following eight pixels are:

[Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

[Y5 U5 V5] [Y6 U6 V6] [Y7u7 V7] [Y8 U8 V8]

The stored code streams are:

Y0 U0 Y1 Y2 U2 Y3

Y5 V5 Y6 Y7 V7 Y8

The pixel points mapped are:

[Y0 U0 V5] [Y1 U0 V5] [Y2 U2 V7] [Y3 U2 V7]

[Y5 U0 V5] [Y6 U0 V5] [Y7u2 V7] [Y8 U2 V7]

Before the 4:4:4, 4:2:2, 4:2:0 has not been clearly understood, and the above explanation is I see the most intuitive, so I glance, enlightened.

RGB and YUV, YCbCr

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.