Differences between YUV and Cr CB

Source: Internet
Author: User

 

After searching for a long time on the Internet, I found various versions. Now I will summarize them to help people check them. By the way, I can give some comments to see which one is the one and which one is the one ····

 

The first statement:

[R g B]-> [y CB Cr] Conversion
-------------------------
(R, G, and B are all 8bit unsigned)
Y = 0.299 * r + 0.587 * g + 0.114 * B (brightness)
CB =-0.1687 * r-0.3313 * g + 0.5 * B + 128
Cr = 0.5 * r-0.4187 * g-0.0813 * B + 128
[Y, CB, Cr]-> [R, G, B] Conversion
R = Y + 1.402 * (Cr-128)
G = Y-0.34414 * (CB-128)-0.71414 * (Cr-128)
B = Y + 1.772 * (CB-128)
General, c
The value (including CB Cr) should be a signed number, but it has been processed here by adding
128.

 

Second statement:

The conversion formula between YUV and RGB is as follows (the RGB value ranges from 0 to 255 ):
Y = 0.299r + 0.587G + 0.114b
U =-0.147r-0.289G + 0.436b
V = 0.615r-0.515g-0.100b
R = Y + 1.14 V
G = Y-0.39u- 0.58 V
B = Y + 2.03u

Third statement:

The YUV color model comes from the RGB model, which separates brightness and color and is suitable for image processing.

Application: simulation field

Y' = 0.299 * R' + 0.587 * G' + 0.114 * B'

U' =-0.147 * R'-0.289 * G' + 0.436 * B '= 0.492 * (B'-y ')

V '= 0.615 * R'-0.515 * G'-0.100 * B' = 0.877 * (R'-y ')

R' = y' + 1.140 * V'

G' = y'-0.394 * U'-0.581 * V'

B '= y' + 2.032 * U'

The YCbCr model comes from the YUV model. YCbCr is
The offset version of the YUV color space.

Application: digital video, ITU-R bt.601 recommendations

Y' = 0.257 * R' + 0.504 * G' + 0.098 * B '+ 16

CB '=-0.148 * R'-0.291 * G' + 0.439 * B' + 128

Cr '= 0.439 * R'-0.368 * G'-0.071 * B' + 128

R' = 1.164 * (y'-16) + 1.596 * (CR '-128)

G' = 1.164*(y'-16)-0.813 * (CR '-128)-0.392 * (CB'-128)

B '= 1.164 * (y'-16) + 2.017 * (CB'-128)

PS: The above symbols all carry an apostrophes, indicating that the symbol is gamma corrected based on the original value. Gamma Correction helps to make up for the anti-aliasing process, the detailed loss caused by linear allocation of gamma values makes the image more detailed. Without Gamma Correction, the details of the dark area are not easily displayed. After this image enhancement technique is used, the layers of the images are clearer. Therefore, YUV in h264 should belong to YCbCr.

 

Fourth statement:

YUV uses red, green, and blue lattice combinations to reduce the amount of information in the signal. Y-channel description
Luma signal, which is a little different from the brightness signal. The value range is between bright and dark. Luma is a signal that can be seen on black and white TVs. U (CB) and
The V (CR) channel extracts the brightness value from the red (U) and Blue (v) to reduce the color information. These values can be combined to determine the red, green, and blue hybrid signals.

Conversion between YUV and RGB:
Y = 0.299 R + 0.587G + 0.114 B
U =-0.1687 R-0.3313G + 0.5 B + 128
V = 0.5 r-0.4187G-0.0813 B + 128
R = Y + 1.402 (V-128)

G = Y-0.34414 (U-128)-0.71414 (V-128)

B = Y + 1.772 (U-128)

 

YUV <--> RGB

Y' = 0.299 * R' + 0.587 * G' + 0.114 * B'

U' =-0.147 * R'-0.289 * G' + 0.436 * B '= 0.492 * (B'-y ')

V '= 0.615 * R'-0.515 * G'-0.100 * B' = 0.877 * (R'-y ')

R' = y' + 1.140 * V'

G' = y'-0.394 * U'-0.581 * V'

B '= y' + 2.032 * U'

 

YCbCr <--> RGB

Y' = 0.257 * R' + 0.504 * G' + 0.098 * B '+ 16

CB '=-0.148 * R'-0.291 * G' + 0.439 * B' + 128

Cr '= 0.439 * R'-0.368 * G'-0.071 * B' + 128

R' = 1.164 * (y'-16) + 1.596 * (CR '-128)

G' = 1.164*(y'-16)-0.813 * (CR '-128)-0.392 * (CB'-128)

B '= 1.164 * (y'-16) + 2.017 * (CB'-128)

Note: all the symbols above carry an apostrophes, indicating that the symbol has been Gamma Correction (Gamma Correction) based on the original value ).

The YUV color model comes from the RGB model, which separates brightness and color and is suitable for image processing.

Application: Basic Color Model Used in analog color TV broadcasting.

The YCbCr model comes from the YUV model. YCbCr
Is a scaled and offset version of the YUV color space.

Application: Digital Videos, ITU-R bt.601 recommendation

Through the comparison above, we can determine that the YUV we use in H.264, MPEG and Other encoding standards is actually YCbCr,

 

Fifth statement:

Mutual conversion between YCbCr and RGB  

Y = 0.299r + 0.587G + 0.114b

CB = 0.564 (B-Y)

Cr = 0.713 (R-Y)

R = Y + 1.402cr

G = Y-0.344Cb-0.714Cr

B = Y + 1.772cb

Sixth statement:

Mutual conversion between YUV and RGB

Y = 0.3 * r + 0.59 * g + 0.11 * B

U = (B-Y) * 0.493

V = (R-Y) * 0.877

In turn, the YUV formula for converting to RGB is as follows:

R = Y + 1.14 V

G = Y-0.39u- 0.58 V

B = Y + 2.03u

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.