![]() |
| Home > Photo, Video, Graphics > graphics > |
colorspace-faq -- FAQ about Color and Gamma |
Section 2 of 3 - Prev - Next
All sections - 1 - 2 - 3
per meter squared, but in practice it is often normalized to 1 or 100 units
with respect to the luminance of a specified or implied white reference.
For example, a studio broadcast monitor has a white reference whose
luminance is about 80 cd*m -2, and Y = 1 refers to this value.
C-4 WHAT IS LIGHTNESS?
Human vision has a nonlinear perceptual response to brightness: a source
having a luminance only 18% of a reference luminance appears about half as
bright. The perceptual response to luminance is called Lightness. It is
denoted L* and is defined by the CIE as a modified cube root of luminance:
Lstar = -16 + 116 * (pow(Y / Yn), 1. / 3.)
Yn is the luminance of the white reference. If you normalize luminance to
reference white then you need not compute the fraction. The CIE definition
applies a linear segment with a slope of 903.3 near black, for (Y/Yn) <=
0.008856. The linear segment is unimportant for practical purposes but if
you don't use it, make sure that you limit L* at zero. L* has a range of 0
to 100, and a "delta L-star" of unity is taken to be roughly the threshold
of visibility.
Stated differently, lightness perception is roughly logarithmic. An
observer can detect an intensity difference between two patches when their
intensities differ by more than one about percent.
Video systems approximate the lightness response of vision using R'G'B'
signals that are each subject to a 0.45 power function. This is comparable
to the 1/3 power function defined by L*.
C-5 WHAT IS HUE?
According to the CIE [1], hue is the attribute of a visual sensation
according to which an area appears to be similar to one of the perceived
colors, red, yellow, green and bue, or a combination of two of them.
Roughly speaking, if the dominant wavelength of an SPD shifts, the hue of
the associated color will shift.
C-6 WHAT IS SATURATION?
Again from the CIE, saturation is the colorfulness of an area judged in
proportion to its brightness. Saturation runs from neutral gray through
pastel to saturated colors. Roughly speaking, the more an SPD is
concentrated at one wavelength, the more saturated will be the associated
color. You can desaturate a color by adding light that contains power at
all wavelengths.
C-7 HOW IS COLOR SPECIFIED?
The CIE system defines how to map an SPD to a triple of numerical
components that are the mathematical coordinates of color space. Their
function is analagous to coordinates on a map. Cartographers have different
map projections for different functions: some map projections preserve
areas, others show latitudes and longitudes as straight lines. No single
map projection fills all the needs of map users. Similarly, no single
color system fills all of the needs of color users.
The systems useful today for color specification include CIE XYZ, CIE xyY,
CIE L*u*v* and CIE L*a*b*. Numerical values of hue and saturation are not
very useful for color specification, for reasons to be discussed in
section 36.
A color specification system needs to be able to represent any color with
high precision. Since few colors are handled at a time, a specification
system can be computationally complex. Any system for color specification
must be intimately related to the CIE specifications.
You can specify a single "spot" color using a color order system such as
Munsell. Systems like Munsell come with swatch books to enable visual
color matches, and have documented methods of transforming between
coordinates in the system and CIE values. Systems like Munsell are not
useful for image data. You can specify an ink color by specifying the
proportions of standard (or secret) inks that can be mixed to make the
color. That's how pantone(tm) works. Although widespread, it's
proprietary. No translation to CIE is publicly available.
C-8 SHOULD I USE A COLOR SPECIFICATION SYSTEM FOR IMAGE DATA?
A digitized color image is represented as an array of pixels, where each
pixel contains numerical components that define a color. Three components
are necessary and sufficient for this purpose, although in printing it is
convenient to use a fourth (black) component.
In theory, the three numerical values for image coding could be provided by
a color specification system. But a practical image coding system needs to
be computationally efficient, cannot afford unlimited precision, need not
be intimately related to the CIE system and generally needs to cover only a
reasonably wide range of colors and not all of the colors. So image
coding uses different systems than color specification.
The systems useful for image coding are linear RGB, nonlinear R'G'B',
nonlinear CMY, nonlinear CMYK, and derivatives of nonlinear R'G'B' such
as Y'CBCR. Numerical values of hue and saturation are not useful in color
image coding.
If you manufacture cars, you have to match the color of paint on the door
with the color of paint on the fender. A color specification system will
be necessary. But to convey a picture of the car, you need image coding.
You can afford to do quite a bit of computation in the first case because
you have only two colored elements, the door and the fender. In the second
case, the color coding must be quite efficient because you may have a
million colored elements or more.
For a highly readable short introduction to color image coding, see
DeMarsh and Giorgianni [2]. For a terse, complete technical treatment, read
Schreiber [3].
C-9 WHAT WEIGHTING OF RED, GREEN AND BLUE CORRESPONDS TO BRIGHTNESS?
Direct acquisition of luminance requires use of a very specific spectral
weighting. However, luminance can also be computed as a weighted sum of
red, green and blue components.
If three sources appear red, green and blue, and have the same radiance in
the visible spectrum, then the green will appear the brightest of the three
because the luminous efficiency function peaks in the green region of the
spectrum. The red will appear less bright, and the blue will be the darkest
of the three. As a consequence of the luminous efficiency function, all
saturated blue colors are quite dark and all saturated yellows are quite
light. If luminance is computed from red, green and blue, the coefficients
will be a function of the particular red, green and blue spectral weighting
functions employed, but the green coefficient will be quite large, the red
will have an intermediate value, and the blue coefficient will be the
smallest of the three.
Contemporary CRT phosphors are standardized in Rec. 709 [8], to be
described in section 17. The weights to compute true CIE luminance from
linear red, green and blue (indicated without prime symbols), for the Rec.
709, are these:
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B;
This computation assumes that the luminance spectral weighting can be
formed as a linear combination of the scanner curves, and assumes that the
component signals represent linear-light. Either or both of these
conditions can be relaxed to some extent depending on the application.
Some computer systems have computed brightness using (R+G+B)/3. This is at
odds with the properties of human vision, as will be discussed under What
are HSB and HLS? in section 36.
The coefficients 0.299, 0.587 and 0.114 properly computed luminance for
monitors having phosphors that were contemporary at the introduction of
NTSC television in 1953. They are still appropriate for computing video
luma to be discussed below in section 11. However, these coefficients do
not accurately compute luminance for contemporary monitors.
C-10 CAN BLUE BE ASSIGNED FEWER BITS THAN RED OR GREEN?
Blue has a small contribution to the brightness sensation. However, human
vision has extraordinarily good color discrimination capability in blue
colors. So if you give blue fewer bits than red or green, you will
introduce noticeable contouring in blue areas of your pictures.
C-11 WHAT IS "LUMA"?
It is useful in a video system to convey a component representative of
luminance and two other components representative of color. It is
important to convey the component representative of luminance in such a way
that noise (or quantization) introduced in transmission, processing and
storage has a perceptually similar effect across the entire tone scale from
black to white. The ideal way to accomplish these goals would be to form a
luminance signal by matrixing RGB, then subjecting luminance to a nonlinear
transfer function similar to the L* function.
There are practical reasons in video to perform these operations in the
opposite order. First a nonlinear transfer function - gamma correction - is
applied to each of the linear R, G and B. Then a weighted sum of the
nonlinear components is computed to form a signal representative of
luminance. The resulting component is related to brightness but is not CIE
luminance. Many video engineers call it luma and give it the symbol Y'. It
is often carelessly called luminance and given the symbol Y. You must be
careful to determine whether a particular author assigns a linear or
nonlinear interpretation to the term luminance and the symbol Y.
The coefficients that correspond to the "NTSC" red, green and blue CRT
phosphors of 1953 are standardized in ITU-R Recommendation BT. 601-2
(formerly CCIR Rec. 601-2). I call it Rec. 601. To compute nonlinear video
luma from nonlinear red, green and blue:
Yprime = 0.299 * Rprime + 0.587 * Gprime + 0.114 * Bprime;
The prime symbols in this equation, and in those to follow, denote
nonlinear components.
C-12 WHAT ARE CIE XYZ COMPONENTS?
The CIE system is based on the description of color as a luminance
component Y, as described above, and two additional components X and Z. The
spectral weighting curves of X and Z have been standardized by the CIE
based on statistics from experiments involving human observers. XYZ
tristimulus values can describe any color. (RGB tristimulus values will be
described later.)
The magnitudes of the XYZ components are proportional to physical energy,
but their spectral composition corresponds to the color matching
characteristics of human vision.
The CIE system is defined in Publication CIE No 15.2, Colorimetry, Second
Edition (1986) [4].
C-13 DOES MY SCANNER USE THE CIE SPECTRAL CURVES?
Probably not. Scanners are most often used to scan images such as color
photographs and color offset prints that are already "records" of three
components of color information. The usual task of a scanner is not
spectral analysis but extraction of the values of the three components that
have already been recorded. Narrowband filters are more suited to this task
than filters that adhere to the principles of colorimetry.
If you place on your scanner an original colored object that has
"original" SPDs that are not already a record of three components, chances
are your scanner will not very report accurate RGB values. This is because
most scanners do not conform very closely to CIE standards.
C-14 WHAT ARE CIE x AND y CHROMATICITY COORDINATES?
It is often convenient to discuss "pure" color in the absence of
brightness. The CIE defines a normalization process to compute "little" x
and y chromaticity coordinates:
x = X / (X + Y + Z);
y = Y / (X + Y + Z);
A color plots as a point in an (x, y) chromaticity diagram. When a
narrowband SPD comprising power at just one wavelength is swept across the
range 400 nm to 700 nm, it traces a shark-fin shaped spectral locus in (x,
y) coordinates. The sensation of purple cannot be produced by a single
wavelength: to produce purple requires a mixture of shortwave and longwave
light. The line of purples on a chromaticity diagram joins extreme blue to
extreme red. All colors are contained in the area in (x, y) bounded by the
line of purples and the spectral locus.
A color can be specified by its chromaticity and luminance, in the form of
an xyY triple. To recover X and Z from chromaticities and luminance, use
these relations:
X = (x / y) * Y;
Z = (1 - x - y) / y * Y;
The bible of color science is Wyszecki and Styles, Color Science [5]. But
it's daunting. For Wyszecki's own condensed version, see Color in Business,
Science and Industry, Third Edition [6]. It is directed to the color
industry: ink, paint and the like. For an approachable introduction to the
same theory, accompanied by descriptions of image reproduction, try to find
a copy of R.W.G. Hunt, The Reproduction of Colour [7]. But sorry to report,
as I write this, it's out of print.
C-15 WHAT IS WHITE?
In additive image reproduction, the white point is the chromaticity of the
color reproduced by equal red, green and blue components. White point is a
function of the ratio (or balance) of power among the primaries. In
subtractive reproduction, white is the SPD of the illumination, multiplied
by the SPD of the media. There is no unique physical or perceptual
definition of white, so to achieve accurate color interchange you must
specify the characteristics of your white.
It is often convenient for purposes of calculation to define white as a
uniform SPD. This white reference is known as the equal-energy illuminant,
or CIE Illuminant E.
A more realistic reference that approximates daylight has been specified
numerically by the CIE as Illuminant D65. You should use this unless you
have a good reason to use something else. The print industry commonly uses
D50 and photography commonly uses D55. These represent compromises between
the conditions of indoor (tungsten) and daylight viewing.
C-16 WHAT IS COLOR TEMPERATURE?
Planck determined that the SPD radiated from a hot object - a black body
radiator - is a function of the temperature to which the object is heated.
Many sources of illumination have, at their core, a heated object, so it is
often useful to characterize an illuminant by specifying the temperature
(in units of kelvin, K) of a black body radiator that appears to have the
same hue.
Although an illuminant can be specified informally by its color
temperature, a more complete specification is provided by the chromaticity
coordinates of the SPD of the source.
Modern blue CRT phosphors are more efficient with respect to human vision
than red or green. In a quest for brightness at the expense of color
accuracy, it is common for a computer display to have excessive blue
content, about twice as blue as daylight, with white at about 9300 K.
Human vision adapts to white in the viewing environment. An image viewed in
isolation - such as a slide projected in a dark room - creates its own
white reference, and a viewer will be quite tolerant of errors in the white
point. But if the same image is viewed in the presence of an external white
reference or a second image, then differences in white point can be
objectionable.
Complete adaptation seems to be confined to the range 5000 K to 5500 K. For
most people, D65 has a little hint of blue. Tungsten illumination, at about
3200 K, always appears somewhat yellow.
C-17 HOW CAN I CHARACTERIZE RED, GREEN AND BLUE?
Additive reproduction is based on physical devices that produce
all-positive SPDs for each primary. Physically and mathematically, the
spectra add. The largest range of colors will be produced with primaries
that appear red, green and blue. Human color vision obeys the principle of
superposition, so the color produced by any additive mixture of three
primary spectra can be predicted by adding the corresponding fractions of
the XYZ components of the primaries: the colors that can be mixed from a
particular set of RGB primaries are completely determined by the colors of
the primaries by themselves. Subtractive reproduction is much more
complicated: the colors of mixtures are determined by the primaries and by
the colors of their combinations.
An additive RGB system is specified by the chromaticities of its primaries
and its white point. The extent (gamut) of the colors that can be mixed
from a given set of RGB primaries is given in the (x, y) chromaticity
diagram by a triangle whose vertices are the chromaticities of the
primaries.
In computing there are no standard primaries or white point. If you have an
RGB image but have no information about its chromaticities, you cannot
accurately reproduce the image.
The NTSC in 1953 specified a set of primaries that were representative of
phosphors used in color CRTs of that era. But phosphors changed over the
years, primarily in response to market pressures for brighter receivers,
and by the time of the first the videotape recorder the primaries in use
were quite different than those "on the books". So although you may see the
NTSC primary chromaticities documented, they are of no use today.
Contemporary studio monitors have slightly different standards in North
America, Europe and Japan. But international agreement has been obtained on
primaries for high definition television (HDTV), and these primaries are
closely representative of contemporary monitors in studio video, computing
and computer graphics. The primaries and the D65 white point of Rec. 709
[8] are:
x y z
R 0.6400 0.3300 0.0300
G 0.3000 0.6000 0.1000
B 0.1500 0.0600 0.7900
white 0.3127 0.3290 0.3582
For a discussion of nonlinear RGB in computer graphics, see Lindbloom [9].
For technical details on monitor calibration, consult Cowan [10].
C-18 HOW DO I TRANSFORM BETWEEN CIE XYZ AND A PARTICULAR SET OF RGB
PRIMARIES?
RGB values in a particular set of primaries can be transformed to and from
CIE XYZ by a three-by-three matrix transform. These transforms involve
tristimulus values, that is, sets of three linear-light components that
conform to the CIE color matching functions. CIE XYZ is a special case of
tristimulus values. In XYZ, any color is represented by a positive set of
values.
Details can be found in SMPTE RP 177-1993 [11].
To transform from CIE XYZ into Rec. 709 RGB (with its D65 white point), put
an XYZ column vector to the right of this matrix, and multiply:
[ R709 ] [ 3.240479 -1.53715 -0.498535 ] [ X ]
[ G709 ]=[-0.969256 1.875991 0.041556 ]*[ Y ]
[ B709 ] [ 0.055648 -0.204043 1.057311 ] [ Z ]
As a convenience to C programmers, here are the coefficients as a C array:
{{ 3.240479,-1.53715 ,-0.498535},
{-0.969256, 1.875991, 0.041556},
{ 0.055648,-0.204043, 1.057311}}
This matrix has some negative coefficients: XYZ colors that are out of
gamut for a particular RGB transform to RGB where one or more RGB
components is negative or greater than unity.
Here's the inverse matrix. Because white is normalized to unity, the
middle row sums to unity:
[ X ] [ 0.412453 0.35758 0.180423 ] [ R709 ]
[ Y ]=[ 0.212671 0.71516 0.072169 ]*[ G709 ]
[ Z ] [ 0.019334 0.119193 0.950227 ] [ B709 ]
{{ 0.412453, 0.35758 , 0.180423},
{ 0.212671, 0.71516 , 0.072169},
{ 0.019334, 0.119193, 0.950227}}
To recover primary chromaticities from such a matrix, compute little x and
y for each RGB column vector. To recover the white point, transform RGB=[1,
1, 1] to XYZ, then compute x and y.
C-19 IS RGB ALWAYS DEVICE-DEPENDENT?
Video standards specify abstract R'G'B' systems that are closely
matched to the characteristics of real monitors. Physical devices that
produce additive color involve tolerances and uncertainties, but if you
have a monitor that conforms to Rec. 709 within some tolerance, you can
consider the monitor to be device-independent.
The importance of Rec. 709 as an interchange standard in studio video,
broadcast television and high definition television, and the perceptual
basis of the standard, assures that its parameters will be used even by
devices such as flat-panel displays that do not have the same physics as
CRTs.
C-20 HOW DO I TRANSFORM DATA FROM ONE SET OF RGB PRIMARIES TO ANOTHER?
RGB values in a system employing one set of primaries can be transformed
into another set by a three-by-three linear-light matrix transform.
Generally these matrices are normalized for a white point luminance of
unity. For details, see Television Engineering Handbook [12].
As an example, here is the transform from SMPTE 240M (or SMPTE RP 145) RGB
to Rec. 709:
[ R709 ] [ 0.939555 0.050173 0.010272 ] [ R240M ]
[ G709 ]=[ 0.017775 0.965795 0.01643 ]*[ G240M ]
[ B709 ] [-0.001622 -0.004371 1.005993 ] [ B240M ]
{{ 0.939555, 0.050173, 0.010272},
{ 0.017775, 0.965795, 0.01643 },
{-0.001622,-0.004371, 1.005993}}
All of these terms are close to either zero or one. In a case like this, if
the transform is computed in the nonlinear (gamma-corrected) R'G'B'
domain the resulting errors will be insignificant.
Here's another example. To transform EBU 3213 RGB to Rec. 709:
[ R709 ] [ 1.044036 -0.044036 0. ] [ R240M ]
[ G709 ]=[ 0. 1. 0. ]*[ G240M ]
[ B709 ] [ 0. 0.011797 0.988203 ] [ B240M ]
{{ 1.044036,-0.044036, 0. },
{ 0. , 1. , 0. },
{ 0. , 0.011797, 0.988203}}
Transforming among RGB systems may lead to an out of gamut RGB result where
one or more RGB components is negative or greater than unity.
C-21 SHOULD I USE RGB OR XYZ FOR IMAGE SYNTHESIS?
Once light is on its way to the eye, any tristimulus-based system will
work. But the interaction of light and objects involves spectra, not
tristimulus values. In synthetic computer graphics, the calculations are
actually simulating sampled SPDs, even if only three components are used.
Details concerning the resultant errors are found in Hall [13].
C-22 WHAT IS SUBTRACTIVE COLOR?
Subtractive systems involve colored dyes or filters that absorb power from
selected regions of the spectrum. The three filters are placed in tandem. A
dye that appears cyan absobs longwave (red) light. By controlling the
amount of cyan dye (or ink), you modulate the amount of red in the image.
In physical terms the spectral transmission curves of the colorants
multiply, so this method of color reproduction should really be called
"multiplicative". Photographers and printers have for decades measured
transmission in base-10 logarithmic density units, where transmission of
unity corresponds to a density of 0, transmission of 0.1 corresponds to a
density of 1, transmission of 0.01 corresponds to a density of 2 and so on.
When a printer or photographer computes the effect of filters in tandem, he
subtracts density values instead of multiplying transmission values, so he
calls the system subtractive.
To achieve a wide range of colors in a subtractive system requires filters
that appear colored cyan, yellow and magenta (CMY). Cyan in tandem with
magenta produces blue, cyan with yellow produces green, and magenta with
yellow produces red. Smadar Nehab suggests this memory aid:
----+ ----------+
R | G B R G | B
| |
Cy | Mg Yl Cy Mg | Yl
+---------- +-----
Additive primaries are at the top, subtractive at the bottom. On the left,
magenta and yellow filters combine to produce red. On the right, red and
green sources add to produce yellow.
C-23 WHY DID MY GRADE THREE TEACHER TELL ME THAT THE PRIMARIES ARE RED,
YELLOW AND BLUE?
To get a wide range of colors in an additive system, the primaries must
appear red, green and blue (RGB). In a subtractive system the primaries
must appear yellow, cyan and magenta (CMY). It is complicated to predict
the colors produced when mixing paints, but roughly speaking, paints mix
additively to the extent that they are opaque (like oil paints), and
subtractively to the extent that they are transparent (like watercolors).
This question also relates to color names: your grade three "red" was
probably a little on the magenta side, and "blue" was probably quite cyan.
For a discussion of paint mixing from a computer graphics perspective,
consult Haase [14].
C-24 IS CMY JUST ONE-MINUS-RGB?
In a theoretical subtractive system, CMY filters could have spectral
absorption curves with no overlap. The color reproduction of the system
would correspond exactly to additive color reproduction using the red,
green and blue primaries that resulted from pairs of filters in
combination.
Practical photographic dyes and offset printing inks have spectral
absorption curves that overlap significantly. Most magenta dyes absorb
mediumwave (green) light as expected, but incidentally absorb about half
that amount of shortwave (blue) light. If reproduction of a color, say
brown, requires absorption of all shortwave light then the incidental
absorption from the magenta dye is not noticed. But for other colors, the
"one minus RGB" formula produces mixtures with much less blue than
expected, and therefore produce pictures that have a yellow cast in the mid
tones. Similar but less severe interactions are evident for the other pairs
of practical inks and dyes.
Due to the spectral overlap among the colorants, converting CMY using the
"one-minus-RGB" method works for applications such as business graphics
where accurate color need not be preserved, but the method fails to
produce acceptable color images.
Multiplicative mixture in a CMY system is mathematically nonlinear, and the
effect of the unwanted absorptions cannot be easily analyzed or
compensated. The colors that can be mixed from a particular set of CMY
primaries cannot be determined from the colors of the primaries
themselves, but are also a function of the colors of the sets of
combinations of the primaries.
Print and photographic reproduction is also complicated by nonlinearities
in the response of the three (or four) channels. In offset printing, the
physical and optical processes of dot gain introduce nonlinearity that is
roughly comparable to gamma correction in video. In a typical system used
for print, a black code of 128 (on a scale of 0 to 255) produces a
reflectance of about 0.26, not the 0.5 that you would expect from a linear
system. Computations cannot be meaningfully performed on CMY components
without taking nonlinearity into account.
For a detailed discussion of transferring colorimetric image data to print
media, see Stone [15].
C-25 WHY DOES OFFSET PRINTING USE BLACK INK IN ADDITION TO CMY?
Printing black by overlaying cyan, yellow and magenta ink in offset
printing has three major problems. First, colored ink is expensive.
Replacing colored ink by black ink - which is primarily carbon - makes
economic sense. Second, printing three ink layers causes the printed paper
to become quite wet. If three inks can be replaced by one, the ink will dry
more quickly, the press can be run faster, and the job will be less
expensive. Third, if black is printed by combining three inks, and
mechanical tolerances cause the three inks to be printed slightly out of
register, then black edges will suffer colored tinges. Vision is most
demanding of spatial detail in black and white areas. Printing black with a
single ink minimizes the visibility of registration errors.
Other printing processes may or may not be subject to similar constraints.
C-26 WHAT ARE COLOR DIFFERENCES?
This term is ambiguous. In its first sense, color difference refers to
numerical differences between color specifications. The perception of
color differences in XYZ or RGB is highly nonuniform. The study of
perceptual uniformity concerns numerical differences that correspond to
color differences at the threshold of perceptibility (just noticeable
differences, or JNDs).
In its second sense, color difference refers to color components where
brightness is "removed". Vision has poor response to spatial detail in
colored areas of the same luminance, compared to its response to luminance
spatial detail. If data capacity is at a premium it is advantageous to
transmit luminance with full detail and to form two color difference
components each having no contribution from luminance. The two color
components can then have spatial detail removed by filtering, and can be
transmitted with substantially less information capacity than luminance.
Instead of using a true luminance component to represent brightness, it is
ubiquitous for practical reasons to use a luma signal that is computed
nonlinearly as outlined above ( What is luma? ).
The easiest way to "remove" brightness information to form two color
channels is to subtract it. The luma component already contains a large
fraction of the green information from the image, so it is standard to form
the other two components by subtracting luma from nonlinear blue (to form
B'-Y') and by subtracting luma from nonlinear red (to form R'-Y').
These are called chroma.
Various scale factors are applied to (B'-Y') and (R'-Y') for different
applications. The Y 'PBPR scale factors are optimized for component analog
video. The Y 'CBCR scaling is appropriate for component digital video such
as studio video, JPEG and MPEG. Kodak's PhotoYCC(tm) uses scale factors
optimized for the gamut of film colors. Y'UV scaling is appropriate as an
intermediate step in the formation of composite NTSC or PAL video signals,
but is not appropriate when the components are kept separate. The Y'UV
nomenclature is now used rather loosely, and it sometimes denotes any
scaling of (B'-Y') and (R'-Y'). Y 'IQ coding is obsolete.
The subscripts in CBCR and PBPR are often written in lower case. I find
this to compromise readability, so without introducing any ambiguity I
write them in uppercase. Authors with great attention to detail sometimes
"prime" these quantities to indicate their nonlinear nature, but because no
practical image coding system employs linear color differences I consider
it safe to omit the primes.
C-27 HOW DO I OBTAIN COLOR DIFFERENCE COMPONENTS FROM TRISTIMULUS
VALUES?
Here is the block diagram for luma/color difference encoding and
decoding:
<< A nice diagram is included in the .PDF and .PS versions. >>
From linear XYZ - or linear R1 G1 B1 whose chromaticity coordinates are
different from the interchange standard - apply a 3x3 matrix transform
to obtain linear RGB according to the interchange primaries. Apply a a
nonlinear transfer function ("gamma correction") to each of the components
to get nonlinear R'G'B'. Apply a 3x3 matrix to obtain color
difference components such as Y'PBPR , Y'CBCR or PhotoYCC. If necessary,
apply a color subsampling filter to obtain subsampled color difference
components. To decode, invert the above procedure: run through the block
diagram right-to-left using the inverse operations. If your monitor
conforms to the interchange primaries, decoding need not explicitly use a
transfer function or the tristimulus 3x3.
The block diagram emphasizes that 3x3 matrix transforms are used for two
distinctly different tasks. When someone hands you a 3x3, you have to ask
for which task it is intended.
C-28 HOW DO I ENCODE Y'PBPR COMPONENTS?
Although the following matrices could in theory be used for tristimulus
signals, it is ubiquitous to use them with gamma-corrected signals.
To encode Y'PBPR , start with the basic Y', (B'-Y') and (R'-Y')
relationships:
Eq 1
[ Y' 601 ] [ 0.299 0.587 0.114 ] [ R' ]
[ B'-Y' 601 ]=[-0.299 -0.587 0.886 ]*[ G' ]
[ R'-Y' 601 ] [ 0.701 -0.587 -0.114 ] [ B' ]
{{ 0.299, 0.587, 0.114},
{-0.299,-0.587, 0.886},
{ 0.701,-0.587,-0.114}}
Y'PBPR components have unity excursion, where Y' ranges [0..+1] and each
of PB and PR ranges [-0.5..+0.5]. The (B'-Y') and (R'-Y') rows need to
be scaled. To encode from R'G'B' where reference black is 0
and reference white is +1:
Eq 2
[ Y' 601 ] [ 0.299 0.587 0.114 ] [ R' ]
[ PB 601 ]=[-0.168736 -0.331264 0.5 ]*[ G' ]
[ PR 601 ] [ 0.5 -0.418688 -0.081312 ] [ B' ]
{{ 0.299 , 0.587 , 0.114 },
{-0.168736,-0.331264, 0.5 },
{ 0.5 ,-0.418688,-0.081312}}
The first row comprises the luma coefficients; these sum to unity. The
second and third rows each sum to zero, a necessity for color difference
components. The +0.5 entries reflect the maximum excursion of PB and PR of
+0.5, for the blue and red primaries [0, 0, 1] and [1, 0, 0].
Section 2 of 3 - Prev - Next
All sections - 1 - 2 - 3
| Back to category graphics - Use Smart Search |
| Home - Smart Search - About the project - Feedback |
© allanswers.org | Terms of use