Introduction to the RGB2YUV of image and Yuv2rgb format

Source: Internet
Author: User

1 YUVformat andRGBFormat Description

Due to the different image formats supported by TV signal systems in different countries, there are YUV Format Imaging and RGB format imaging, so in order to ensure compatibility, RGB and Interactive transfer in YUV format.

In addition , YUV format has the characteristics of luminance information and color information separation, but most image processing operations are based on RGB format , need to convert RGB format to YUV format. And when the image is later displayed, you need to convert YUV to an RGB domain.

2 RGBformat toYUVFormat Conversion Formula

  

The above matrix multiplication is expanded, andYUV ( level ) can be calculated directly from 8 -bit RGB as follows:

Y = 0.299 R + 0.587 G + 0.114 B

U =-0.1687 R-0.3313 G + 0.5 B + 128

V = 0.5 R-0.4187 G-0.0813 B + 128

3 YUVformat toRGBFormat Conversion Formula

  

The above matrix multiplication is expanded, and8 -bit RGB can be calculated directly from YUV ( level ) as follows:

R = Y + 1.402 (V-128)

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

B = Y + 1.772 (U-128)

4 RGBformat toYCbCrFormat Conversion Formula

The YCbCr format is an offset based on the YUV format, which is translated as follows:

Y' = 0.257*r ' + 0.504*g ' + 0.098*b ' +
Cb ' = -0.148*r '-0.291*g ' + 0.439*b ' + 128
Cr ' = 0.439*r '-0.368*g '-0.071*b ' + 128

5 RGBformat toYCbCrFormat Conversion Formula

The conversion format is as follows:

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)

Introduction to the RGB2YUV of image and Yuv2rgb format

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.