YCbCr, Y′CbCr, or Y Pb/Cb Pr/Cr, also written as YCBCR or Y'CBCR, is
a family of color spaces used as a part of the color image pipeline in
video and digital photography systems. Y′ is the luma component and
CB and CR are the blue-difference and red-difference chroma
components. Y′ (with prime) is distinguished from Y, which is
luminance, meaning that light intensity is nonlinearly encoded based
on gamma corrected
Contents 1 Rationale 2 YCbCr 2.1
3 CbCr Plane at Y = 0.5 4 References 5 External links Rationale[edit]
Y ′ = K R ⋅ R ′ + K G ⋅ G ′ + K B ⋅ B ′ P B = 1 2 ⋅ B ′ − Y ′ 1 − K B P R = 1 2 ⋅ R ′ − Y ′ 1 − K R displaystyle begin aligned Y'&=K_ R cdot R'+K_ G cdot G'+K_ B cdot B'\P_ B &= frac 1 2 cdot frac B'-Y' 1-K_ B \P_ R &= frac 1 2 cdot frac R'-Y' 1-K_ R end aligned where KR, KG, and KB are ordinarily derived from the definition of the
corresponding
K R + K G + K B = 1 displaystyle K_ R +K_ G +K_ B =1 . (The equivalent matrix manipulation is often referred to as the
"color matrix".)
Here, the prime ′ symbols mean gamma correction is being used; thus
R′, G′ and B′ nominally range from 0 to 1, with 0 representing
the minimum intensity (e.g., for display of the color black) and 1 the
maximum (e.g., for display of the color white). The resulting luma (Y)
value will then have a nominal range from 0 to 1, and the chroma (PB
and PR) values will have a nominal range from -0.5 to +0.5. The
reverse conversion process can be readily derived by inverting the
above equations.
When representing the signals in digital form, the results are scaled
and rounded, and offsets are typically added. For example, the scaling
and offset applied to the Y′ component per specification (e.g.
MPEG-2[1]) results in the value of 16 for black and the value of 235
for white when using an 8-bit representation. The standard has 8-bit
digitized versions of CB and CR scaled to a different range of 16 to
240. Consequently, rescaling by the fraction (235-16)/(240-16) =
219/224 is sometimes required when doing color matrixing or processing
in
K R = 0.299 K G = 0.587 K B = 0.114 displaystyle begin aligned K_ R &=0.299\K_ G &=0.587\K_ B &=0.114end aligned From the above constants and formulas, the following can be derived
for
Y ′ = 0.299 ⋅ R ′ + 0.587 ⋅ G ′ + 0.114 ⋅ B ′ P B = − 0.168736 ⋅ R ′ − 0.331264 ⋅ G ′ + 0.5 ⋅ B ′ P R = 0.5 ⋅ R ′ − 0.418688 ⋅ G ′ − 0.081312 ⋅ B ′ displaystyle begin aligned Y'&=&0.299cdot R'&+&0.587cdot G'&+&0.114cdot B'\P_ B &=-&0.168736cdot R'&-&0.331264cdot G'&+&0.5cdot B'\P_ R &=&0.5cdot R'&-&0.418688cdot G'&-&0.081312cdot B'end aligned Digital Y′CbCr (8 bits per sample) is derived from analog R'G'B' as follows: Y ′ = 16 + ( 65.481 ⋅ R ′ + 128.553 ⋅ G ′ + 24.966 ⋅ B ′ ) C B = 128 + ( − 37.797 ⋅ R ′ − 74.203 ⋅ G ′ + 112.0 ⋅ B ′ ) C R = 128 + ( 112.0 ⋅ R ′ − 93.786 ⋅ G ′ − 18.214 ⋅ B ′ ) displaystyle begin aligned Y'&=&16&+&(65.481cdot R'&+&128.553cdot G'&+&24.966cdot B')\C_ B &=&128&+&(-37.797cdot R'&-&74.203cdot G'&+&112.0cdot B')\C_ R &=&128&+&(112.0cdot R'&-&93.786cdot G'&-&18.214cdot B')end aligned or simply componentwise ( Y ′ , C B , C R ) = ( 16 , 128 , 128 ) + ( 219 ⋅ Y , 224 ⋅ P B , 224 ⋅ P R ) displaystyle begin aligned (Y',C_ B ,C_ R )&=&(16,128,128)+(219cdot Y,224cdot P_ B ,224cdot P_ R )\end aligned The resultant signals range from 16 to 235 for Y′ (Cb and Cr range from 16 to 240); the values from 0 to 15 are called footroom, while the values from 236 to 255 are called headroom. Alternatively, digital Y′CbCr can derived from digital R'dG'dB'd (8 bits per sample, each using the full range with zero representing black and 255 representing white) according to the following equations: Y ′ = 16 + 65.738 ⋅ R D ′ 256 + 129.057 ⋅ G D ′ 256 + 25.064 ⋅ B D ′ 256 C B = 128 − 37.945 ⋅ R D ′ 256 − 74.494 ⋅ G D ′ 256 + 112.439 ⋅ B D ′ 256 C R = 128 + 112.439 ⋅ R D ′ 256 − 94.154 ⋅ G D ′ 256 − 18.285 ⋅ B D ′ 256 displaystyle begin aligned Y'&=&16&+& frac 65.738cdot R'_ D 256 &+& frac 129.057cdot G'_ D 256 &+& frac 25.064cdot B'_ D 256 \C_ B &=&128&-& frac 37.945cdot R'_ D 256 &-& frac 74.494cdot G'_ D 256 &+& frac 112.439cdot B'_ D 256 \C_ R &=&128&+& frac 112.439cdot R'_ D 256 &-& frac 94.154cdot G'_ D 256 &-& frac 18.285cdot B'_ D 256 end aligned In the above formula, the scaling factors are multiplied by 256 255 displaystyle frac 256 255 . This allows for the value 256 in the denominator, which can be calculated by a single bitshift. If the R'd G'd B'd digital source includes footroom and headroom, the footroom offset 16 needs to be subtracted first from each signal, and a scale factor of 255 219 displaystyle frac 255 219 needs to be included in the equations. The inverse transform is: R D ′ = 298.082 ⋅ Y ′ 256 + 408.583 ⋅ C R 256 − 222.921 G D ′ = 298.082 ⋅ Y ′ 256 − 100.291 ⋅ C B 256 − 208.120 ⋅ C R 256 + 135.576 B D ′ = 298.082 ⋅ Y ′ 256 + 516.412 ⋅ C B 256 − 276.836 displaystyle begin aligned R'_ D &=& frac 298.082cdot Y' 256 &&&+& frac 408.583cdot C_ R 256 &-&222.921\G'_ D &=& frac 298.082cdot Y' 256 &-& frac 100.291cdot C_ B 256 &-& frac 208.120cdot C_ R 256 &+&135.576\B'_ D &=& frac 298.082cdot Y' 256 &+& frac 516.412cdot C_ B 256 &&&-&276.836end aligned The inverse transform without any roundings (using values coming
directly from
R D ′ = 255 219 ⋅ ( Y ′ − 16 ) + 255 112 ⋅ 0.701 ⋅ ( C R − 128 ) G D ′ = 255 219 ⋅ ( Y ′ − 16 ) − 255 112 ⋅ 0.886 ⋅ 0.114 0.587 ⋅ ( C B − 128 ) − 255 112 ⋅ 0.701 ⋅ 0.299 0.587 ⋅ ( C R − 128 ) B D ′ = 255 219 ⋅ ( Y ′ − 16 ) + 255 112 ⋅ 0.886 ⋅ ( C B − 128 ) displaystyle begin aligned R'_ D &=& frac 255 219 cdot (Y'-16)&&&&&&&+& frac 255 112 cdot 0.701&&&&cdot (C_ R -128)\G'_ D &=& frac 255 219 cdot (Y'-16)&-& frac 255 112 cdot 0.886&&cdot frac 0.114 0.587 &&cdot (C_ B -128)&-& frac 255 112 cdot 0.701&&cdot frac 0.299 0.587 &&cdot (C_ R -128)\B'_ D &=& frac 255 219 cdot (Y'-16)&+& frac 255 112 cdot 0.886&&&&cdot (C_ B -128)end aligned This form of Y′CbCr is used primarily for older standard-definition
television systems, as it uses an
A different form of Y′CbCr is specified in the
K B = 0.0722 K R = 0.2126 ( K G = 1 − K B − K R = 0.7152 ) displaystyle begin aligned K_ B &=0.0722\K_ R &=0.2126\(K_ G &=1-K_ B -K_ R =0.7152)end aligned This form of Y′CbCr is based on an
K B = 0.0593 K R = 0.2627 displaystyle begin aligned K_ B &=0.0593\K_ R &=0.2627end aligned
Y ′ = 0 + ( 0.299 ⋅ R D ′ ) + ( 0.587 ⋅ G D ′ ) + ( 0.114 ⋅ B D ′ ) C B = 128 − ( 0.168736 ⋅ R D ′ ) − ( 0.331264 ⋅ G D ′ ) + ( 0.5 ⋅ B D ′ ) C R = 128 + ( 0.5 ⋅ R D ′ ) − ( 0.418688 ⋅ G D ′ ) − ( 0.081312 ⋅ B D ′ ) displaystyle begin aligned Y'&=&0&+(0.299&cdot R'_ D )&+(0.587&cdot G'_ D )&+(0.114&cdot B'_ D )\C_ B &=&128&-(0.168736&cdot R'_ D )&-(0.331264&cdot G'_ D )&+(0.5&cdot B'_ D )\C_ R &=&128&+(0.5&cdot R'_ D )&-(0.418688&cdot G'_ D )&-(0.081312&cdot B'_ D )end aligned And back: R D ′ = Y ′ + 1.402 ⋅ ( C R − 128 ) G D ′ = Y ′ − 0.344136 ⋅ ( C B − 128 ) − 0.714136 ⋅ ( C R − 128 ) B D ′ = Y ′ + 1.772 ⋅ ( C B − 128 ) displaystyle begin aligned R'_ D &=&Y'&&&+1.402&cdot (C_ R -128)\G'_ D &=&Y'&-0.344136&cdot (C_ B -128)&-0.714136&cdot (C_ R -128)\B'_ D &=&Y'&+1.772&cdot (C_ B -128)&end aligned CbCr Plane at Y = 0.5[edit] Y=0.5 Note: when Y = 0, R, G and B must all be zero, thus Cb and Cr can only
be zero. Likewise, when Y = 1, R, G and B must all be 1, thus Cb and
Cr can only be zero.
Unlike R, G, and B, the Y, Cb and Cr values are not independent;
choosing
^ e.g. the
External links[edit] Charles Poynton — Color FAQ
Charles Poynton —
v t e Color space List of color spaces Color models CAM CIECAM02 iCAM CIE CIEXYZ CIELAB CIECAM02 CIELUV Yuv CIEUVW CIE RGB RGB
YUV YUV PAL YDbDr SECAM PAL-N YIQ NTSC YCbCr Rec. 601 Rec. 709 Rec. 2020 Rec. 2100 ICtCp YPbPr xvYCC YCoCg Other CcMmYK CMYK Coloroid LMS Hexachrome HSL, HSV HCL Imaginary color OSA-UCS PCCS RG RYB Color systems and standards ACES ANPA Colour Index International CI list of dyes DIC Federal Standard 595 HKS ICC profile ISCC–NBS Munsell NCS Ostwald Pantone RAL list For the vision capacities of organisms or machines, see Col |