cs559-computer graphics copyright stephen chenney color recap the physical description of color is...

22
CS559-Computer Graphics Copyright Stephen Chenney Color Recap The physical description of color is as a spectrum: the intensity of light at each wavelength Humans have three types of cone – each responds differently to an incoming spectrum Experiments show that humans can match all colors by combining three primary colors The most common computer graphics primaries are Red (645.16nm), Green (526.32nm) and Blue (444.44nm)

Upload: malcolm-king

Post on 23-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

CS559-Computer GraphicsCopyright Stephen Chenney

Color Recap

• The physical description of color is as a spectrum: the intensity of light at each wavelength

• Humans have three types of cone – each responds differently to an incoming spectrum

• Experiments show that humans can match all colors by combining three primary colors

• The most common computer graphics primaries are Red (645.16nm), Green (526.32nm) and Blue (444.44nm)

CS559-Computer GraphicsCopyright Stephen Chenney

Color Matching

• Given a spectrum, how do we determine how much each of R, G and B to use to match it?

• First step:– For a light of unit intensity at each wavelength, ask

people to match it with R, G and B primaries

– Result is three functions, r(), g() and b(), the RGB color matching functions

CS559-Computer GraphicsCopyright Stephen Chenney

The RGB Color Matching Functions

CS559-Computer GraphicsCopyright Stephen Chenney

Computing the Matching• The spectrum function that we are trying to match,

E(), gives the amount of energy at each wavelength• The RGB color matching functions tell us how much of

each primary is needed to match at each wavelength • Hence, if the “color” due to E() is E, the match is:

B )()(G )()(R )()(E dEbdEgdEr

CS559-Computer GraphicsCopyright Stephen Chenney

Color Spaces

• Taking linear combinations of R, G and B defines the RGB color space– the range of perceptible colors generated by adding some

part each of R, G and B

• If R, G and B correspond to a monitor’s phosphors (monitor RGB), then the space is the range of colors displayable on the monitor

CS559-Computer GraphicsCopyright Stephen Chenney

RGB Color Space

CS559-Computer GraphicsCopyright Stephen Chenney

Problems with RGB

• Only a small range of potential perceivable colors (particularly for monitor RGB)

• It isn’t easy for humans to say how much of RGB to use to make a given color– How much R, G and B is there in “brown”? (Answer: .64,.16, .16)– If you ever need to answer such questions, file rgb.txt under X11

• Perceptually non-linear– two points a certain distance apart in one part of the space may be

perceptually different– Two other point, the same distance apart in another part of the

space, may be perceptually the same

CS559-Computer GraphicsCopyright Stephen Chenney

CIE XYZ Color Space

• Defined in 1931 to describe the full space of perceptible colors– Revisions now used by color professionals

• Color matching functions are everywhere positive– Cannot produce the primaries – need negative light!

– But, can still describe a color by its matching weights

– Y component intended to correspond to intensity

• Most frequently set x=X/(X+Y+Z) and y=Y(X+Y+Z)– x,y are coordinates on a constant brightness slice

CS559-Computer GraphicsCopyright Stephen Chenney

CIE x, y

Note: This is a representation on a projector with limited range, so the right colors are not being displayed

CS559-Computer GraphicsCopyright Stephen Chenney

CIE Matching Functions

CS559-Computer GraphicsCopyright Stephen Chenney

Qualitative features of CIE x, y

• Linearity implies that colors obtainable by mixing lights with colors A, B lie on line segment with endpoints at A and B

• Monochromatic colors (spectral colors) run along the “Spectral Locus”

• Dominant wavelength = Spectral color that can be mixed with white to match

• Purity = (distance from C to spectral locus)/(distance from white to spectral locus)

• Wavelength and purity can be used to specify color.• Complementary colors=colors that can be mixed with C to get

white

CS559-Computer GraphicsCopyright Stephen Chenney

Going from RGB to XYZ

• These are linear color spaces, related by a linear transformation

• Match each primary, for example:

• Substitute and equate terms:

bBgGrRzZyYxX

ZzYyXxR rrr

b

g

r

zzz

yyy

xxx

z

y

x

bgr

bgr

bgr

CS559-Computer GraphicsCopyright Stephen Chenney

Determining Gamuts

• Gamut: The range of colors that can be produced

• Plot the matching coordinates for each primary

• Region contained in triangle (3 primaries) is gamut

• Two primaries produce a line

CS559-Computer GraphicsCopyright Stephen Chenney

More linear color spaces

• Monitor RGB: primaries are monitor phosphor colors, primaries and color matching functions vary from monitor to monitor:– Almost all applications assume that RGB is the same as monitor

RGB

• YIQ: mainly used in television– Y is (approximately) intensity, I, Q are chromatic properties

– Linear color space; hence there is a matrix that transforms XYZ coords to YIQ coords, and another to take RGB to YIQ

– I and Q can be transmitted with low bandwidth.

CS559-Computer GraphicsCopyright Stephen Chenney

Munsell Color Space

• Problems with linear spaces remain:– Hard to specify colors without resorting to matching

functions

– Perceptually non-uniform

• Munsell: describes surfaces, rather than lights - less relevant for graphics– Surfaces must be viewed under fixed comparison light

CS559-Computer GraphicsCopyright Stephen Chenney

Munsell color space

CS559-Computer GraphicsCopyright Stephen Chenney

HSV Color Space (Alvy Ray Smith, 1978)

• Hue: the color family: red, yellow, blue…• Saturation: The purity of a color: white is totally

unsaturated• Value: The intensity of a color: white is intense,

black isn’t• Space looks like a cone

– Parts of the cone can be mapped to RGB space

• Not a linear space, so no linear transform– But there is an algorithmic transform

CS559-Computer GraphicsCopyright Stephen Chenney

HSV Color Space

CS559-Computer GraphicsCopyright Stephen Chenney

Uniform Color Spaces

• Color spaces in which distance in the space corresponds to perceptual “distance”

• Only works for local distances– How far is red from green? Is it further than red from

blue?

• Use MacAdams ellipses to define perceptual distance

CS559-Computer GraphicsCopyright Stephen Chenney

MacAdam Ellipses(scaled by a factorof 10) on CIE x, y

CS559-Computer GraphicsCopyright Stephen Chenney

CIE u’v’is a non-linearcolor spacewhere colordifferences aremore uniform

Y

X

ZYXv

u

9

4

315

1

CS559-Computer GraphicsCopyright Stephen Chenney

Subtractive mixing• Inks subtract light from white, whereas phosphors glow

• Inks: Cyan=White-Red, Magenta=White-Green, Yellow=White-Blue

• For a good choice of inks, matching is linear:– C+M+Y=White-White=Black

– C+M=White-Yellow=Blue

• Usually require CMY and Black, because colored inks are more expensive, and registration is hard

• For good choice of inks, there is a linear transform between XYZ and CMY