色彩空间用数学方式来描述颜色集合,常见的2个基本色彩模型是RGB,YUB.
? RGB - Used in computer graphics
? YCbCr - Used in video compression
1.1 YCbCr
YCbCr 则是在世界数字组织视频标准研制过程中作为ITU - R BT.601 建议的一部分,其实是YUV经过缩放和偏移的翻版。其中Y与YUV 中的Y含义一致,Cb,Cr 同样都指色彩,只是在表示方法上不同而已。YCbCr或Y‘CbCr色彩空间通常会用于影片中的影像连续处理,或是数字摄影系统中,其中Y是指亮度(luma)分量(灰阶值),Cb指蓝色色度分量,而Cr指红色色度分量。
医学研究证明,人的肉眼对视频的Y分量更敏感,因此在通过对色度分量进行子采样来减少色度分量后,肉眼将察觉不到的图像质量的变化。如果只有Y信号分量而没有U、V分量,那么这样表示的图像就是黑白灰度图像。彩色电视采用YUV空间正是为了用亮度信号Y解决彩色电视机与黑白电视机的兼容问题,使黑白电视机也能接收彩色电视信号。
RGB is not very efficient (有效)in terms of(就......而言) bandwidth(带宽) as (因为)all the three components have to be present in equal bandwidth to produce(produce) any color. So an RGB based frame buffer(帧缓冲器) must have same pixel depth(像素深度) and display resolution for each RGB component.
YCbCr easy to get rid of(摆脱) some redundant color information(冗余的颜色信息), it is used in image and video compression standards like JPEG, MPEG1, MPEG2 and MPEG4.
YCbCr主要的子采样格式有 YCbCr 4:2:0、YCbCr 4:2:2 和 YCbCr 4:4:4。
- 4:4:4 – In this, there is no sub-sampling of the chroma components(色度分量的子采样), and can be as well referred and used(被引用和使用) directly as a RGB image. High-end cameras devices use this format to not lose any data.
- 4:2:2 – The chroma components(色度分量) are horizontally sub-sampled (被水平次采样) and their resolution (解析度,分辨率)is halved (减半)as compared to(与x相比) the luminance counterpart (亮度对应)in this scheme(该方案). High-end digital video formats and still images(静态图像)generally employ(采用,employment 雇佣)this scheme.
- 4:2:0 – In this variant(变种), the chroma components are sub-sampled by a factor of 2, both horizontally as well as vertically(水平方向和垂直方向), thus (因此)reducing to a factor (因子)of a quarter(1/4). The standard video compression MPEG uses this scheme。
1.2 YCbCr - RGB Color Format Conversion
For standard definition TV applications (SDTV) the following equation describes the color conversion from RGB to YCbCr (according to ITU-R BT.601):
To recover an RGB color from a YCbCr color, the following inverse matrix is used:
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. In many cases the complete possible range (完整可能范围)of 8 bit is used, 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(8-bit RGB to 8-bit YCbCr):
These equations can be implemented in fixed-point arithmetic as follows:
y = (77 × r + 150 × g + 29 × b)/256
cb = (-43 × r - 85 × g + 128 × b + 32768)/256
cr = (128 × r - 107 × g - 21 × b + 32768)/256
The other way round(另一方面), to convert a full-range YCbCr color into RGB is described by the following equation:
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):
This is the corresponding inverse matrix to get the RGB color components out of a YCbCr color: