How to convert YUV and RGB

Publisher:YuexiangLatest update time:2024-04-29 Source: elecfansKeywords:YUV Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

YUV and RGB conversion

Everything rendered to the screen (text, pictures or other) must be converted to RGB representation, so how is the conversion between YUV representation and RGB representation performed?


In order to achieve format conversion, we must first clarify the characteristics and mutual conversion relationship between the format to be converted and the target format, which is the core of programming to achieve conversion. For the process of RGB to YUV, we must first get the data of the RGB file, and then calculate it through the YUV calculation formula in the above figure to obtain YUV data, so as to achieve conversion. For YUV to RGB, we must first obtain YUV data, and use the second set of RGB formulas to calculate RGB data. In this experiment, the conversion formula is as follows.

Y = 0.298R + 0.612G + 0.117B; 
U = -0.168R - 0.330G + 0.498B + 128; 
V = 0.449R - 0.435G - 0.083B + 128; 

R = Y + 1.4075( V - 128); 
G = Y - 0.3455( U - 128) - 0.7169( V - 128); 
B = Y + 1.779( U - 128);

Video Encoding

Why do we need to encode? The reason is simple, because the video data in YUV RGB format is too large. The purpose of encoding is to compress it,
making the size of various videos smaller, which is convenient for storage and transmission.

The role of video encoding: compress video pixel data (RGB, YUV, etc.) into a video code stream, thereby reducing the amount of video data.


Keywords:YUV Reference address:How to convert YUV and RGB

Previous article:Comparison of H.265 and VP9 encoding quality
Next article:Audio and video introduction UV representation image

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号