IOS Dev Intro - Color Space Convertion

103 篇文章 0 订阅


http://www.equasys.de/colorconversion.html


Color Conversion

This page contains the different equations for converting one of the luminance / chrominance based color formats (YUV, YCbCr and YPbPr) into the RGB color format and vice versa.

  • YUV - RGB Color Format Conversion
  • YCbCr - RGB Color Format Conversion
  • YPbPr - RGB Color Format Conversion

See also the page Color Formats to get basic information about the different color formats.

YUV - RGB Color Format Conversion

The YUV color format is used only for analog PAL or analog NTSC video - not for any digital video format. The following equation describes the conversion of an RGB color into the YUV color format:

RGB to YUV color conversion for analog TV

This is the inverse matrix to get the RGB components out of the YUV color:

YUV to RGB color conversion for analog TV

YCbCr - RGB Color Format Conversion

For digital component video the color format YCbCr is used. For standard definition TV applications (SDTV) the following equation describes the color conversion from RGB to YCbCr (according to ITU-R BT.601):

RGB to YCbCr color conversion for SDTV

To recover an RGB color from a YCbCr color, the following inverse matrix is used:

YCbCr to RGB color conversion for SDTV

The possible range of values for chrominance and luminance reserves some footroom and headroom, which is necessary to provide some space for overshooting, e.g. in combination with analog video equipment. For computer based applications using RGB and YCbCr color formats, in many cases the complete possible range of 8 bit is used, without providing a footroom or headroom. Typically, this full-range color format is used for JPEG images.

The conversion of RGB colors into full-range YCbCr colors is described by the following equation:

RGB to full range YCbCr color conversion

The other way round, to convert a full-range YCbCr color into RGB is described by the following equation:

Full range YCbCr to RGB color conversion

For high definition TV (HDTV), different coefficients are used. The possible range of values is identical to the SDTV, to provide the necessary footroom and headroom. The following equation describes the color conversion from RGB to YCbCr for HDTV (according to ITU-R BT.709):

RGB to YCbCr color conversion for HDTV

This is the corresponding inverse matrix to get the RGB color components out of a YCbCr color:

YCbCr to RGB color conversion for HDTV

YPbPr - RGB Color Format Conversion

The following equations describe the conversion from RGB to YPbPr color format for component analog video and vice versa. Again, different coefficients are used for SDTV and HDTV.

In case of SDTV, for converting RGB to YPbPr, the following matrix is used:

RGB to YPbPr color conversion for SDTV

This is the inverse matrix to recover an RGB value from a given YPbPr value:

YPbPr to RGB color conversion for SDTV

In case of HDTV, for converting RGB to YPbPr, the following matrix is used:

RGB to YPbPr color conversion for HDTV

Finally, this is the inverse matrix:

YPbPr to RGB color conversion for HDTV

Terms of Use

The section Technical Information on this website has been prepared very carefully - however, equasys GmbH does not warrant the accuracy or the completeness of the given information.
You are encouraged to use the technical service information by setting a link to the equasys web site. You are free to reproduce or to disseminate the technical service information, as long as you do not change the content and you give a proper reference to the source by setting a link to www.equasys.de.

Please use the Contact sheet to submit any comments, proposals or feedback.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
/* 全局样式 */ body { font-family: Arial, sans-serif; font-size: 16px; color: #333; margin: 0; } a { color: #333; text-decoration: none; } a:hover { color: #555; } ul, ol { margin-top: 0; margin-bottom: 10px; } ul li, ol li { margin-left: 20px; } /* 头部样式 */ header { color: #fff; padding:0 0 0 0; } .container { max-width: 1660px; margin: 0 auto; padding: 0 20px; } #hero { background-image: url(QMZYWY/images/wy.jpg); background-size: cover; background-position: center; color: #fff; text-align: center; padding: 100px 0; } h1 { margin: 0; font-size: 32px; } nav { display: flex; justify-content: flex-end; } nav ul { list-style: none; margin: 0; padding: 0; display: flex; } nav li { margin-right: 20px; } nav a { color: #fff; text-decoration: none; padding: 5px; border-radius: 5px; transition: background-color 0.2s ease; } nav a:hover { background-color: #555; } /* 英雄介绍样式 */ .hero-intro { background-color: #fff; padding: 40px 0; } .hero-intro-text { margin-bottom: 20px; } .hero-intro-image { text-align: center; } .hero-intro-image img { max-width: 100%; height: auto; } /* 游戏攻略样式 */ .game-strategy { background-color: #f5f5f5; padding: 40px 0; } .game-strategy p { margin-bottom: 20px; } /* 页脚样式 */ footer { background-color: #222; color: #fff; padding: 10px 0; } footer p { margin: 0; text-align: center; } /* 响应式样式 */ @media screen and (max-width: 768px) { .container { padding: 0 10px; } h1 { font-size: 24px; } nav { justify-content: center; } nav li { margin-right: 10px; } .hero-intro { padding: 20px 0; } .hero-intro-text { text-align: center; } .hero-intro-image { margin-top: 20px; } } @media screen and (min-width: 768px) { .hero { background-image: url('QMZYWY/images/wy.jpg'); } }在此代码中加入网页背景图片响应式
最新发布
06-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值