You are on page 1of 87

COMPUTE R

GRAPHI CS AND

D I S P LAY

Introduction to Color

1/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

All You Need to Know About Color in CS123

2/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Achromatic and Colored Light


Achromatic light

Chromatic color

Color models for raster graphics

Reproducing color

Using color in computer graphics

3/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Why Study Color in Computer Graphics?


Physics and measurement for realism
what does coding an RGB triple mean?

Perception and aesthetics for selecting appropriate user interface colors


why a bright red and orange striped bedroom is a bad idea how to put on matching pants and shirt in the morning role of culture and even age
e.g., WIRED magazine

Color models for providing users with easy color selection


systems for naming and describing colors

Color models, measurement and color gamuts for converting colors between media
why colors on your screen may not be printable, and vice-versa managing color in systems with computers, monitors, scanners, and printers color awareness
a highly interdisciplinary field that is often unpredictable and downright bizarre

We study it as a useful background for rendering and because it provides a good introduction to signal processing
also used for image processing and anti-aliasing

Graphics group has worked on color tools for Adobe.

4/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Why is Color Difficult?


Color is an immensely complex subject, drawing on physics, physiology, psychology, art, and graphic design Many theories, measurement techniques, and standards for colors, yet no one theory of human color perception is universally accepted Color of object depends not only on object itself but also on light source illuminating it, on color of surrounding area, and on human visual system (the eye/brain mechanism)

Some objects reflect light (wall, desk, paper), while others also transmit light (cellophane, glass)
surface that reflects only pure blue light illuminated with pure red light appears black pure green light viewed through glass that transmits only pure red also appears black

5/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Achromatic Light
Achromatic light: intensity (quantity of light) only
called intensity or luminance if measure of lights energy or brightness
the psychophysical sense of perceived intensity

gray levels (e.g., from 0.0 to 1.0) seen on black and white TV or display monitors

Chromatic light
visual color sensations brightness/intensity chromaticity/color hue/position in spectrum (red, green, yellow . . .) saturation/vividness generally need 64 to 256 gray levels for continuous-tone images without contouring

6/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Gamma
Gamma () is a measure of the nonlinearities of a display
Nonlinearity: the response (output) is not directly proportional to the input

Term often used incorrectly to refer to nonlinearity of image data Example: PC monitors have a gamma of roughly 2.5, while Mac monitors have a gamma of 1.8, so Mac images appear dark on PCs

Mac user generates image

PC user changes image to make it bright

PC user gives image back; its now too bright

Problems in graphics
need to maintain color consistency across different platforms and hardware devices (monitor, printer, etc.) even the same type/brand of monitors change gamma value over time proper design, use of color software like ColorBlind

7/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Compensating for Nonlinearities Gamma Correction


Nonlinearities are pervasive
hardware human visual systems

How to distribute 256 different intensities?


dont want, for example, 128 in [0, 0.1] and [0.9, 1.0] would create a visible gap from 0.1 to 0.9

Yet want predictability First, we deal with nonlinearity of the human visual system, then with nonlinearity of CRT (LCD is different) Eye sensitive to ratio: perceives intensities 0.10 and 0.11 as differing just as much as the intensities 0.50 and 0.55

8/88

COMPUTE R
`

GRAPHI CS AND

D I S P LAY

Gamma Correction Implementation


To achieve equal steps in brightness, space logarithmically rather than linearly, so that

j +1

I I

= r

j 1

Use the following relations:

, I0 =I0, I1 =rI , I2 =rI =r2I0, I3 =rI2 =r3I0,K 0 1

I 255 = r 255 I 0 = 1
Therefore:
( r = (1/ I0 )1/255, I j = r j I0 = (1/ I0 ) j / 255I0 = I0255 j)/ 255 (13.2)

for0 j 255
In general for n+1 intensities:
( r =(1/ I0)1/ n, I j = I0n j)/ n

for0 j n

(13.3)

Thus for
n = 3 (4 intensities) and I 0 = 1 / 8, r = 2, intensity values of 1/8, 1/4, 1/2 and 1
9/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Displaying Intensities

(1/2)

Dynamic range: ratio of maximum to minimum intensities, i.e., 1/I0 Typical on CRT anywhere from 40:1 to 200:1 => I0 between .005 and .025:
for I0 = 0.02, EQ (13.2) yields r = 1.0154595

First few, last two of 256 intensities from EQ (13.1): 0.0200, 0.0203, 0.0206, 0.0209, 0.0213, 0.0216, , 0.9848, 1.0000 Pixel values are NOT intensities: need gamma correction to compensate for nonlinearities Non-linearities in CRT

I = kN (13.4) N = number of electrons in beam, proportional to grid voltage, which is proportional to pixel value V k and are constants is typicallyin the range of 2.2 to 2.5
Therefore, for some other constant k:

I = KV

or V = ( I / K ) 1 /

(13.5)

10/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Displaying Intensities

(2/2)

To display intensity I, find nearest Ij from a table or: j = ROUND(logr(I/I0))

Then And

V j = ROUND(( I j / K )1/ )

Ij = r j I0

if no look-up table, load Vj in pixel if look-up table, load j in pixel, Vj in entry j Number of intensities needed for appearance of continuous intensity depends on ratio: need r = 1.01 for Ij and Ij+1 to be indistinguishable:
1/ n r = (1 / I 0 )

or

1/ n 1 . 01 = (1 / I 0 )

solve for n:
n = log
1 . 01

(1 / I 0 );

1 / I 0 is dynamic
11/88

range

(13.10)

COMPUTE R

GRAPHI CS AND

D I S P LAY

Display Media

Display Media CRT Photographic prints Photographic slides Coated paper printed in B/W Coated paper printed in color Newsprint printed in B/W

Typical Dynamic Range 50-200 100 1000 100 50 10

No. of Intensities, n 400-530 465 700 465 400 234

ink bleeding and random noise considerably decreases n in practice Note: a mediums dynamic range (number of intensities) not same as gamut (number of visible colors it can display)

12/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Inside the CRT

Cool pictures: http://www.pctechguide.com/06crtmon.htm Block diagram : http://www.tpub.com/neets/book18/

13/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Inside the LCD

For more information: http://www.pcworld.com (the picture above is from PCworld) Or check out http://www.howstuffworks.com 14/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Chromatic Color
Hue distinguishes among colors such as red, green, purple, and yellow Saturation refers to how pure the color is, how much white/gray is mixed with it red saturated; pink unsaturated royal blue saturated; sky blue unsaturated pastels are less vivid, less intense Lightness: perceived achromatic intensity of reflecting object Brightness: perceived intensity of a self-luminous object, such as a light bulb, the sun, or a CRT Can distinguish ~7 million colors when samples placed side-by-side (JNDs Just Noticeable Diffs.) with differences only in hue, difference of JND colors are 2nm in central part of visible spectrum, 10 nm at extremes non-uniformity! about 128 fully saturated hues are distinct eye less discriminating for less saturated light (from 16 to 23 saturation steps for fixed hue and lightness), and less sensitive for less bright light

15/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Mixture B

The effect of (A) passing light through several filters (subtractive mixture), and (B) throwing different lights upon the same spot (additive mixture)

16/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Subtractive Mixture
blue green yellow red

green

Subtractive mixture occurs with inks for print medium, paints that absorb light. In subtractive mixture, light passed by two filters (or reflected by two mixed pigments) is wavelengths passed by first minus that which is subtracted by second. First filter passes 420 - 520 nanometers (broad-band blue filter), while second passes 480 - 660 nanometers (broad-band yellow filter). Light that can pass through both is in 480 - 520 nanometers, which appears green.
17/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Additive Mixture

Additive mixture used to mix R, G, B guns of CRT. Light passed by two filters (or reflected by two pigments) impinges upon same region of retina. Pure blue and yellow filtered light upon same portion of the screen, reflected upon same retinal region. Image is grey, not green (as in subtractive mixture).
18/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Additive Mixture in Pointillist Art

The Channel at Gravelines (1890) by Georges Seurat Color daubs (left detail) mix additively at a distance. Pointillist technique Creates bright colors where mixing pigments darkens (subtractive) Sondheims Sunday in the Park with George with Mandy Patkins and Bernadette Peters: fantastic modern musical exploring Seurats color use and theories about light.
19/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Complementary Hues Additive Mixture

Complementary hues: Any hue will yield gray if additively

mixed (in correct proportion) with opposite hue on color circle. Such hue pairs are complementaries. Of particular importance are the pairs that contain four unique hues: redgreen, blue-yellow. These complementary unique hues play a role in opponent color perception discussed later Note that only for perfect red and green do you get gray CRT red and green both have yellow components and therefore sum to yellowish gray

20/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Contrast

Gray patches on blue and yellow backgrounds are physically identical, look different Difference in perceived brightness: patch on blue looks brighter than on yellow, result of brightness contrast. Also a difference in perceived hue. Patch on blue looks yellowish, while that on yellow looks bluish. This is color contrast: hues tend to induce their complementary colors in neighboring areas.

21/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Negative Afterimage

Stare at center of figure for about a minute or two, then look at a blank white screen or a white piece of paper Blink once or twice; negative afterimage will appear within a few seconds showing the rose in its correct colors (red petals and green leaves)

22/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Specifying (Naming) Color


Measurement/specification (M/S): how to refer to/name a particular color Compare unknown and sample from a collection colors must be viewed under a standard light source depends on human judgment PANTONE Matching System in printing industry

Munsell color-order system set of samples in 3D space hue, value/lightness, chroma (saturation) equal perceived distances between neighbors Artists specify color as tint, shade, tone using pure, white, and black pigments; White Ostwald system is similar
Grays

Decrease saturation

Tints Tones Shades

Pure color
Decrease lightness

Later, well look at computer-based models


23/88

Black

COMPUTE R

GRAPHI CS AND

D I S P LAY

Psychophysics
Tint, shade, and tone: subjective. Depend on observers judgment, lighting, sample size, context Colorimetry: quantitative; measurement via spectroradiometer (measures reflected/radiated light), colorimeter (measures primary colors), etc.

Perceptual term Colorimetry term Hue Dominant wavelength Saturation Excitation purity Lightness (reflecting objects) Luminance Brightness (self-luminous objects) Luminance Physiology of vision, theories of perception still active research areas Note: our auditory and visual processing are very different! both are forms of signal processing visual processing integrates/much more affected by context more than half of our cortex devoted to vision vision probably dominant sense, though it is apparently harder to be deaf than blind

24/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Response to Stimuli
f ()

(1/3)

We draw a frequency response curve like this:

to indicate how much a receptor responds to light of uniform intensity for each wavelength To compute response to incoming band (frequency distribution) of light, like this:

I ( )

We multiply the curves, wavelength by wavelength, to compute receptor response to each amount of stimulus across spectrum

25/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Response to Stimuli
Response Curve

(2/3)

f ( )
Incoming Light Distribution

I ( )

Product of functions

R( )

Gray area under product curve represents how much receptor sees, i.e., total response to incoming light Lets call this receptor red, then

red perception = R()d() = I()f()d

26/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Response to Stimuli

(3/3)

Response curve also called filter because it determines amplitude of response (i.e., perceived intensity) of each wavelength Where filters amplitude is large, lets through most of incoming signal strong response Where filters amplitude is low, filters out much/most/all of signal weak response This is much like impulse response and filtering youll see in Image Processing unit

27/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Metamers (1/4)
Different light distributions that produce the same response
Imagine a creature with one receptor type (red) with response curve like this:

f ( )

How would it respond to each of these two light sources?

f ()

Both signals will generate same amount of red perception. They are metamers one receptor type cannot give more than one color sensation (albeit with varying brightness)

28/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Metamers (2/4)
Consider a creature with two receptors (R1, R2)

I1

I2

I1

Note that in principle an infinite number of frequency distributions can simulate the effect of I2, e.g., I1 in practice, for In near base of response curves, amount of light required becomes impractically large

29/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Metamers (3/4)
For three types of receptors, potentially infinite color distributions (metamers) that will generate identical sensations
you can test this out with the metamer applet

Conversely, no two monochromatic lights can generate identical receptor responses and therefore all look unique Thomas Young in 1801 postulated that we need 3 receptor types to distinguish gamut of colors represented by triples H, S, V (hue, saturation, value)

30/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Metamers (4/4)
For two light sources to be metamers, amounts of red, green, and blue response generated by two sources must be identical This amounts to three constraints on lights But light sources are infinitely variable one can adjust amount of light at any possible wavelength So there are infinitely many metamers

Observations:
if two people have different response curves, metamers for one person will be different from those for other metamers are purely perceptual: scientific instruments can detect difference between two metameric lights

31/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Energy Distribution and Metamers


Spectral color: single wavelength (e.g., from laser); ROY G. BIV spectrum Non-spectral color: combination of spectral colors; can be shown as continuous spectral distribution or as discrete sum of n primaries (e.g., R, G, B); most colors are non-spectral mixtures

White light spectrum where height of curve is spectral energy distribution

Metamers are spectral energy distributions that are perceived as same color each color sensation can be produced by an arbitrarily large number of metamers Cannot predict average observers color sensation from a distribution
32/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Colorimetry Terms
Can characterize visual effect of any spectral distribution by triple (dominant wavelength, excitation purity, luminance):
e2 Energy Density e1
Idealized uniform distribution except for e2

Dominant Wavelength

400

wavelength, nm

700

Dominant wavelength hue we see; spike of energy e2 Excitation purity = ratio of monochromatic light of dominant wavelength, white light to produce color e1 = e2, excitation purity is 0% (unsaturated) e1 = 0, excitation purity is 100% (fully saturated) Luminance relates to total energy, proportional to integral of (distribution * eyes response curve (luminous efficiency function)) depends on both e1 and e2 Note:
dominant wavelength of real distribution may not be one with largest amplitude! some colors (purple) have no dominant wavelength
33/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Three Layers of Human Color Perception Overview


Receptors in retina (for color matching)
Rods, three types of cones (tristimulus theory) primary colors (only three used for screen images: approx. red, green, blue (RGB)) Note: receptors each respond to wide range of frequencies, not just spectral primaries

Opponent channels (for perception)


other cells in retina and neural connections in visual cortex blue-yellow, red-green, black-white 4 psychological color primaries*: red, green, blue, and yellow

Opponent cells (also for perception)


spatial (context) effects, e.g., simultaneous contrast, lateral inhibition

* These colors are called psychological primaries because each contains no perceived element of others regardless of intensity. (www.garysgallery.com/colorprimaries.html)
34/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Receptors in Retina
Receptors contain photopigments that produce electro-chemical response; our dynamic range of light is 1011 => division of labor among receptors Rods (scotopic): only see grays, work in lowlight/night conditions, mostly in periphery Cones (photopic): respond to different wavelengths to produce color sensations, work in bright light, densely packed near center of retina (fovea), fewer in periphery Young-Helmholtz tristimulus theory1: 3 cone types, sensitive to all visible wavelengths of light, maximally responsive in different ranges Three receptor types can produce a 3-space of hue, saturation and value (lightness/brightness) To avoid misinterpretations S (short), I (intermediate), L (long) often used instead
Young proposed idea of three receptors in 1801. Hermann von Helmholtz looked at theory from a quantitative basis in 1866. Although they did not work together, theory is called Young-Helmholtz theory since they arrived at same conclusions.
1 Thomas

35/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Tristimulus Theory

Spectral-response functions of f each of the three types of cones on the human retina

Luminous Efficiency Function f (peak sensitivity at yellow-green (550nm))

Tristimulus theory does not explain color perception, e.g., not many colors look like mixtures of RGB (violet looks like red and blue, but what about yellow?)

36/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Herings Chromatic Opponent Channels


Additional neural processing three receptor elements have excitatory and inhibitory connections with neurons higher up that correspond to opponent processes one pole activated by excitation, other by inhibition All colors can be described in terms of 4 psychological color primaries R, G, B, and Y However, a color is never reddish-greenish or bluishyellowish: idea of two antagonistic opponent color channels, red-green and yellow-blue S I L Light of 450 nm

-++ +-+ +++


Y-B R-G BK-W
Each channel is a weighted sum of receptor outputs linear mapping 37/88

Hue: Blue + Red = Violet

COMPUTE R

GRAPHI CS AND

D I S P LAY

Spatially Opponent Cells


Some cells in opponent channels are also spatially opponent, a type of lateral inhibition (called double-opponent cells) Responsible for effects of simultaneous contrast and after images
green stimulus in cell surround causes some red excitement in cell center, making gray square in field of green appear reddish

Plus
color perception strongly influenced by context, training, etc., abnormalities such as color blindness (affects about 8% of males, 0.4% of females)

38/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Mach Bands and Lateral Inhibition

Stimulus intensity

Position on stimulus

Nature provides for contrast enhancement at boundaries between regions: edge detection. This is caused by lateral inhibition.
39/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Lateral Inhibition and Contrast


Receptor cells, A and B, stimulated by neighboring regions of stimulus. A receives moderate light. As excitation stimulates next neuron on visual chain, cell D, which transmits message toward brain. Transmission impeded by cell B, whose intense excitation inhibits cell D. Cell D fires at reduced rate. Intensity of cell cj=I(cj) is function of cjs excitation e(cj) inhibited by its neighbors with attenuation coefficients k that decrease with distance. Thus,

excite

I (c j ) = e(c j ) -

k j

e(c )
k k

inhibit

At boundary more excited cells inhibit their less excited neighbors even more and vice versa. Thus, at boundary dark areas even darker than interior dark ones, light areas are lighter than interior light ones. Natures edge detection
40/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Matching
Tristimulus theory leads to notion of matching all visible colors with combinations of red, green, and blue monospectral primaries; it almost works
b

r g

Wavel ength (nm)

Color-matching functions, showing amounts of three primaries needed by average observer to match a color of constant luminance, for all values of dominant wavelength in visible spectrum.

Note: these are NOT response functions! Negative value of r => cannot match, must subtract, i.e., add that amount to unknown Mixing positive amounts of arbitrary R, G, B primaries provides large color gamut, e.g., display devices, but no device based on a finite number of primaries can show all colors!

41/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Space for Color Matching


Commission Internationale de lclairage (CIE) Defined X, Y, and Z primaries to replace red, green and blue primaries x, y, and z, color matching functions for these primaries

Y chosen so that y matches luminous efficiency function


x, y, and z are linear combinations of r, g, and b => RGBi n XYZi via a matrix

z
y x

The mathematical color matching functions x y, and z for the 1931 CIE X, Y, and Z primaries. They are defined tabularly at 1 nm intervals for color samples that subtend 2 field of view on retina
42/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Space Showing an RGB Gamut

Color gamut for typical color monitor with XYZ color space

Note irregular shape of visible gamut in CIE space; due to eye's response as measured by response curves Range of displayable colors clearly smaller than all colors visible in XYZ space.
43/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Space Projection to Chromaticity Diagram

Several views of X + Y + Z = 1 plane of CIE space

Left: plane embedded in CIE space. Top right: view perpendicular to plane. Bottom right: projection onto (X, Y) plane (Z = 0 plane). This is called the chromaticity diagram Chromaticity Everything that deals with color (H, S), not luminance/brightness

44/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Chromaticity Diagram (1/4)


Amounts of X, Y, and Z primaries needed to match a color with spectral energy distribution P(): X = k P ( ) x d Y = k P ( ) y d Z = k P ( ) z d in practice use s For given color C, C = XX + YY + ZZ Get chromaticity values that depend only on dominant wavelength (hue) and saturation (purity), independent of luminous energy, for a given color, by normalizing for total amount of luminous energy = (X + Y + Z)
X X +Y + Z Y y= X +Y + Z Z z= X +Y + Z x=

x + y + z = 1; (x,y,z) lies on X + Y + Z = 1 plane (x, y) determines z but cannot recover X, Y, Z from only x and y. Need one more piece of data, Y, which carries luminance data
( x, y, Y ), X = 1 x y x Y, Y = Y , Z = Y y y

45/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Chromaticity Diagram (2/4)

CIE 1976 UCS chromaticity diagram from Electronic Color: The Art of Color Applied to Graphic Computing by Richard B. Norman, 1990 Inset: CIE 1931 chromaticity diagram 46/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Chromaticity Diagram (3/4)


CIE chromaticity diagram is projection onto (X, Y) plane of (X + Y + Z ) = 1 plane
Spectral locus made up of chromaticity coordinates of monochromatic light. Outside locus bounds = not a physical color. Spectral locus closed by line spanning blue and red.

Plots x, y for all visible chromaticity values colors with same chromaticity map into same point regardless of luminance Spectrally pure, monochromatic colors on curve colors that are luminance-related are not shown, e.g., brown = orange-red chromaticity at low luminance infinite number of planes which project onto (X + Y + Z = 1) plane and all of whose colors differ; thus it is NOT a full color palette! illuminant C: near (but not at) x = y = z = 1/3; close to daylight
47/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Chromaticity Diagram (4/4)


Uses of CIE Chromaticity Diagram:

Name colors Define color mixing Define and compare color gamuts

48/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Today
Recap of CIE color spacehow did we get to it? Why is it important? Other color spaces (RGB, HSV, etc.) How color spaces influence color picking How to use color: some Dos and Donts

49/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE and Chromaticity Diagram Review


Need way to describe colors precisely for industry and science Want to describe all visible colors in terms of three variables (to get 3D coordinate space) vs. infinite number of spectral wavelengths or special reference swatches Choose three well-defined light colors to be the three variables (an R, G and B)

50/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Doing the Experiment


People sit in a dark room matching colors But any three R, G and B cant match all colors... (for reasons well be exploring soon) Sometimes need to add some R to the sample you are trying to match. Expressed mathematically as -R.

51/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Make Nice Curves


Fit curves to three functions that describe the matching f(r), f(g), and f(b)

G R

Transform f(r,g,b) functions B above to represent three new primaries (not actually visible light colors) X, Y, and Z. Why?
52/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Voila! International Technical Specification of Color


Now we have a way (specifying a colors CIE X, Y, and Z values) to precisely characterize any color using only three variables! Very convenient! Colorimeters, spectroradiometers measure X, Y, Z values. Used in many areas of industry and academiafrom paint to lighting to physics and chemistry. International Telecommunication Union uses 1931 CIE color matching functions in their recommendations for worldwide unified colorimetry
International Telecommunication Union (1998) ITU-R BT.1361 WORLDWIDE UNIFIED COLORIM ETRY AND RELATED CHARACTERIST ICS OF FUTURE TELEVISION AND IM AGING SYSTEMS International Telecommunication Union (2000) ITU-R BT.709-4 PARAM ETER VALUES FOR THE HDTV STANDARDS FOR PRODUCTION AND INTERNATIONAL PROGRAMME EXCHANGE

53/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Using the CIE Chromaticity Diagram (1/2)


Measure dominant wavelength, excitation purity of color by matching with mix of CIE primaries:
colorimeters measure tristimulus X, Y, and Z values from which chromaticity coordinates are computed spectroradiometers measure wavelengths of spectral energy distribution and tristimulus values

Suppose matched color is at point A in figure below:

when two colors added, new color lies on line connecting two colors => A = tC + (1 t)B; B is spectral color, C is illuminant ratio AC/BC = excitation purity of A
54/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Using the CIE Chromaticity Diagram (2/2)


Complementary colors can be mixed to produce white light (a non-spectral color!) white can be produced by (approx) constant spectral distribution as well as by only two complementary colors, e.g., greenish-blue, D, and reddish-orange, E.

Some nonspectral colors (colors not on spectral locus, like

G) cannot be defined by dominant wavelength; defined by complementary dominant wavelength


55/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Gamuts

(1/2)

Colors add linearly in CIE: All mixture of I and J lie on the line connecting them. Thus, all possible mixtures of I, J and any third color, K, (or additional colors) lie within their convex hull. Called the color gamut.

No finite number of primaries can include all visible colors

56/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Gamuts

(2/2)

Smallness of print gamut with respect to color monitor gamut => faithful reproduction by printing must use reduced gamut of colors on monitor

Left: gam ut of printer Right: gam ut of monitor

57/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Why the Chromaticity Diagram is Not Triangular


No gamut described by a linear combination of n physical (real) primaries (yielding a convex hull) can simulate the eyes responses to all visible colors Review of CIE
shape of CIE space determined by Matching Experiment: subject shown color and asked to create metameric match from colored monochromatic primaries, R, G and B most colors can be matched, some cant because of way response curves overlap would need negative amounts of some primary to match all visible color samples; not physically possible, but can be simulated by adding that color to sample to be matched. to simplify, CIE primaries X, Y, and Z used to get all positive color matching functions

Lets see in another way why 3 (indeed n) physical primaries arent sufficient to match an arbitrary color by looking at response function
58/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Chromatic Opponent Channels on Chromaticity Diagram

Taken from Falks Seeing the Light, Harper and Row, 1986

Why would red-green and blue-yellow be useful axes to specify color with?
59/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Models for Raster Graphics


(1/2)
Purpose: specify colors in some gamut Gamut is a subset of all visible chromaticities so model does not contain all visible colors 3D color coordinate system subset containing all colors within a gamut Means to convert to other model(s) Example color model: RGB
3D Cartesian coordinate system unit cube subset Use CIE XYZ space to convert to and from all other models
60/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Models for Raster Graphics


(2/2)
Hardware-oriented models: not intuitive do not relate to concepts of hue, saturation, brightness
RGB, used with color CRT monitors YIQ, broadcast TV color system CMY (cyan, magenta, yellow) color printing CMYK (cyan, magenta, yellow, black) color printing IRODORI, six-primary-color projection system
Cyan

Green

Yellow

Black

Red

Blue

Magenta

User-oriented models
HSV (hue, saturation, value) also called HSB (B for brightness) HLS (hue, lightness, saturation) The Munsell system CIE Lab
61/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The RGB Color Model (1/3)


RGB primaries are additive:

The RGB cube (Grays on dotted main diagonal)

Main diagonal => gray levels


black is (0, 0, 0) white is (1, 1, 1)

RGB color gamut defined by display device chromaticities


differs form one display device to another

62/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The RGB Color Model (2/3)


Conversion from one RGB gamut to another convert one to XYZ, then convert from XYZ to another check out http://www.color3d.com/examples.htm for good examples Form of each transformation:

X X r Y = Yr Z Zr

Xg Yg Zg

X b R Yb G Zb B

Where Xr, Xg, and Xb are weights applied to monitors RGB colors to find X, etc. M is 3 x 3 matrix of color-matching coefficients

X = Y M Z

R G B

Let M1 and M2 be matrices to convert from two monitors gamuts to CIE M2-1 M1 converts from RGB of monitor 1 to RGB of monitor 2
63/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The RGB Color Model (3/3)


But what if
C1 in gamut of monitor 1 but not in gamut of monitor 2, i.e., C2 = M2-1 M1C1 outside unit cube and hence not displayable?

Solution 1: clamp RGB at 0 and 1


simple, but distorts color relations

Solution 2: compress gamut on monitor 1 by scaling all colors from monitor 1 toward center of gamut 1
ensure that all displayed colors on monitor 1 map onto monitor 2

64/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The CMY(K) Color Model (1/2)


Used in electrostatic/ink-jet plotters that deposit pigment on paper Cyan, magenta, and yellow are complements of red, green, and blue Subtractive primaries: colors are specified by what is subtracted from white light, rather than by what is added to blackness Cartesian coordinate system Subset is unit cube
white is at origin, black at (1, 1, 1): C 1 R M = 1 G Y 1 B
Green Yellow

(minus blue)

(minus red)

Cyan

Black

Red

Blue

Magenta

(minus green)

subtractive primaries (cyan, magenta, yellow) and their mixtures

65/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The CMY(K) Color Model (2/2)


Color printing presses, some color printers use CMYK (K=black) K used instead of equal amounts of CMY
called undercolor removal richer black less ink deposited on paper dries more quickly

First approximation nonlinearities must be accommodated: K = min(C, M, Y) C = C K M = M K (one of C, Y, M will be 0)

66/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The YIQ Color Model


Recoded RGB for transmission efficiency, compatibility with B/W broadcast TV; used for NTSC (National Television Standards Committee (cynically, Never The Same Color)) Y = CIEs Y (luminance); I, Q encode chromaticity Only Y = 0.3R + 0.59G + 0.11B shown on B/W monitors:

Y 0.30 0.59 0.11 R = I 0.60 0.28 0.32 G Q 0.21 0.52 0.31 B


Weights: relative brightness of each primary assumes white point is illuminant C: xw = 0.31, yw = 0.316, and Yw = 100.0

Preparing color material which may be seen on B/W broadcast TV, adjacent colors should have different Y values NTSC encoding of YIQ: 4 MHz Y (eye most sensitive to r luminance) 1.5 MHz I (small images need 1 color dimension) 0.6 MHz Q
67/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The HSV Color Model (1/2)


Hue, saturation, value (brightness) Hexcone subset of cylindrical (polar) coordinate system

Single hexcone HSV color model. (The V = 1 plane contains the RGB models R = 1, G = 1, B = 1, in the regions shown)

Has intuitive appeal of the artists tint, shade, and tone model
pure red = H = 0, S = 1, V = 1; pure pigments are (I, 1, 1) tints: adding white pigment n decreasing S at constant V shades: adding black pigment n decreasing V at constant S tones: decreasing S and V

68/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The HSV Color Model (2/2)


Colors on V = 1 plane are not equally bright Complementary colors 180 opposite Saturation measured relative to color gamut represented by model which is subset of chromaticity diagram:
therefore, 100% S

100% excitation purity

Top of HSV hexcone is projection seen by looking along principal diagonal of RGB color

RGB color cube viewed along the principal diagonal

RGB subcubes are plane of constant V Code for RGB n HSV on page 592, 593 Note: linear path RGB <> linear path in HSV!

69/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The HLS color Model


Hue, lightness, saturation Double-hexcone subset

Maximally saturated hues are at S = 1, L = 0.5 Less attractive for sliders or dials Neither V nor L correspond to Y in YIQ! Conceptually easier for some people to view white as a point
70/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Problems with Standard Color Systems


They are perceptually non-uniform
move through color space from color C1 to a new color C1 through a distance C C1 = C1 + C move through the same distance C, starting from a C2 = C2 + C different color C2 the change in color in both cases is mathematically equal, but is not perceived as equal

Moving a slider almost always causes a perceptual change in the other two parameters, which is not reflected by changes in those sliders; thus, changing hue frequently will affect saturation and value, even in Photoshop! Ideally want a perceptually uniform space: two colors that are equally distant are perceived as equally distant, and changing one parameter does not perceptually alter the other two Historically, the first perceptually-uniform color space was the Munsell system

71/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The Munsell System (1/2)


Created from perceptual data, not as a transformation of or approximation to CIE Uniform perceptually-based 3D space
accounts for the fact that a bright yellow is much lighter than a bright blue, and that many more levels of saturation of blue can be distinguished than of yellow

Magnitude of change in one parameter always maps to the same effect on perception Basis for Graphics Group research during 1999-2001 into new color pickers (was led by ams and funded by Adobe)

72/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

The Munsell System (2/2)


Hues arranged on a circle
a 20 degree rotation through this circle always causes the same perceptual change, no matter where on the circle you start from does not cause changes in saturation or value

Saturation as distance from center of circle


moving away from the center a certain distance always causes the same perceptual change does not cause changes in hue or value moving vertically always causes the same perceptual change does not cause changes in hue or saturation

Value as height in space


73/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

CIE Lab
CIE Lab was introduced in 1976
popular for use in measuring reflective and transmissive objects

Three components:
L* is luminosity a* is red/green axis b* is yellow/blue axis

Mathematically described space and a perceptually uniform color space Given white = (Xn, Yn, Zn)

L* = 116 (Y / Yn )1/ 3 16, when Y / Yn > 0.008856 L* = 903 .292 (Y / Yn ) when Y / Yn 0.008856
a = 500( f ( X / X n ) f ( Z / Z n ))

b* = 200( f ( X / X n ) f ( Z / Zn )) where f (t ) = t 1/ 3 when Y / Yn > 0.008856 else f ( t ) = 7.787t + 16 / 116


These transformations cause regions of colors perceived as identical to be of the same size
74/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Model Pros and Cons


RGB

(1/2)

+ Cartesian coordinate system + linear + hardware-based (easy to transform to video) + tristimulus-based - hard to use to pick and name colors - doesnt cover gamut of perceivable colors - non-uniform: equal geometric distance => unequal perceptual distance

CIE
+ covers gamut of perceived colors + based on human perception (matching experiments) + linear + contains all other spaces - non-uniform (but variations such as CIE Lab are closer to Munsell, which is uniform) - xy-plot of chromaticity horseshoe diagram doesnt show luminance

75/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Color Model Pros and Cons

(2/2)

(CIE cont.) Example: Photoshop Lab color model is based on CIE Lab space + based on psychological colors (y-b, r-g, w-b) - terrible interface in Photoshop * no visualization of the color space * very difficult to determine what values mean if you are unfamiliar with the space * picks colors which are out of the print gamut - primarily used as an internal space to convert between RGB and CMYK HSV + easy to convert to RGB + easy to specify colors - nonlinear - doesnt cover gamut of perceivable colors - nonuniform

76/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Interactive Specification of Color


(1/2)
English- language names ambiguous and subjective Numeric coordinates in color space with slide dials:
Left: Lab color picker from Adobe Photoshop for Windows Below: RGB color picker from Adobe Photoshop for M ac OS

77/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Interactive Specification of Color


(2/2)
Interact with visual representation of the color space HSB color picker from Adobe Photoshop

Important for user to see actual display with new color

HSV color picker from Mac OS Xs Finder

Beware of surround effect!


78/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Interpolating in Color Space (1/2)


Interpolation needed for:
Gouraud shading antialiasing blending images together in a fade-in, fade-out sequence

Results depend on the color model used:


RGB, CMY, YIQ, CIE are related by affine transformations, hence straight line (i.e., interpolation paths) are maintained during mapping not so for HSV, HLS; for example, interpolation between red and green in RGB: red = (1, 0, 0), green = (0, 1, 0) midpoint = (0.5, 0.5, 0) interpolating in HSV: red = (0, 1, 1); green = (120 , 1, 1) midpoint = (60, 1, 1) RGB_to_HSV = (60, 1, 0.5) midpoint values in RGB differ by 0.5 from same interpolation in HSV: (60, 1, 0.5) (60, 1, 1)

79/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Interpolating in Color Space (2/2)


RGB, red is (1, 0, 0) and cyan is (0, 1, 1) which interpolate to (0.5, 0.5, 0.5), gray
in HSV, that is (UNDEFINED, 0, 0.5)

In HSV, red is (0, 1, 1) and cyan is (180, 1, 1) which interpolates to (90, 1, 1)


new hue at maximum value and saturation, whereas the right result of combining equal amounts of complementary colors is a gray value

Thus, (interpolating, transforming) (transforming, interpolating) For Gouraud shading (see Rendering unit), use any of the models because interpolants are generally so close together that interpolation paths are close together For blending two images, as in fade-in fade-out sequence or for antialiasing, colors may be quite distant
use additive model, such as RGB

If interpolating between two colors of fixed hue (or saturation), maintain fixed hue (saturation) for all interpolated colors by HSV or HLS
note fixed-saturation interpolation in HSV or HLS is not seen as having exactly fixed saturation by viewer!

80/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Using Color in Computer Graphics


Aesthetic uses:
establish a tone or mood (e.g. Doom) promote realism

Highlight Code numeric quantities


temperature across the U.S. vegetation and mineral concentrations on Earth, moon, and planets (LandSat, Mars missions) speed of fluids in computational fluid dynamics (streamlines)

81/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Using Color in Computer Graphics: Functionality


Careless use of color is perilous
in experiments, poor color choices reduced user performance by one-third Check out some of the colors in this Worst Website: http://www.angelfire.com/super/badwebs/main.htm

Decorative use of color subservient to functional use:


test with real users provide best judgment defaults allow user to override defaults design first for a monochrome display (color use is redundant in monochrome displays and for color-blind users)

82/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Using Color in Computer Graphics Approach


Color harmony:
select colors according to some method, typically by traversing a smooth path in a color model restrict colors to planes or hexcones in a color space space colors at equal perceptual distances light-dark contrast more important than hue contrast

Specifics:
if a chart contains just a few colors, the complement of one of the colors should be used as the background use neutral (gray) background for an image with many colors separate non-harmonious colors by thin black border

Coding:
be redundant (dual coding) show reference scale color can carry unintended meanings:
bright, saturated colors stand out (may give unintended emphasis) display elements of same color may incorrectly be associated by user

83/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Using Color in Computer Graphics: Physiological Rules (1/2)


Eye is more sensitive to spatial variation
fine detail should vary from the background not just in chromaticity, but in brightness

Blue and black, yellow and white are particularly bad combinations
dont use blue for text

For color-blind users, avoid reds and greens with low saturation and luminance Color of small objects less than 20-40 minutes of arc is not distinguishable

This is hard to read. So is this. And this, too! Yikes!

84/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Using Color in Computer Graphics: Physiological Rules (2/2)


Difficult to perceive color when used with small objects => dont use color coding for them Perceived color of object is affected by color of surrounding area Strongly saturated colors produce after images Color affects perceived size
red seen as larger than green colors refract differently through our lens: appear at different depths, e.g., red (closer) vs. blue (farther) strongest effect

Apply color conservatively, not gratuitously coloritis as bad as font-itis

85/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

Take Away Ideas


To describe the character of light (ignoring phase) requires an infinity of amplitude wavelength data light spectra lie in an infinite-dimensional space Human perception, below certain intensity levels, is not at all linear At reasonable levels light perception is log-linear; displays also not linear, influences color-table design Less is More in judicious use of color use some simple guidelines based on aesthetics and psychophysics

If you are interested in learning more about color, check out Anne Morgan Spalters book, The Computer in the Visual Arts, available on Amazon.com

86/88

COMPUTE R

GRAPHI CS AND

D I S P LAY

For More Information


For more on color, check out the following web sites: Color Matters
http://www.colormatters.com

Educational Color Applets


http://www.cs.rit.edu/~ncs/color/

Color Frequently Asked Questions


http://www.poynton.com/notes/colour_and_gamma/Col orFAQ.html

Comprehensive List of Color Models


http://www.colorsystem.com/

Online book on color


http://www.colorvoodoo.com/cvoodoo4.html

Map Coloring
http://www.personal.psu.edu/faculty/c/a/cab38/

Get your own color cube!


http://www.colorcube.com/intro.htm

87/88

You might also like