color ece 847: digital image processing stan birchfield clemson university

76
Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Upload: estella-small

Post on 25-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color

ECE 847:Digital Image Processing

Stan BirchfieldClemson University

Page 2: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Acknowledgment

Many slides

are courtesy of Bill Freeman at MIT

and

David Forsyth

at UC Berkeley

from http://www-static.cc.gatech.edu/classes/AY2007/cs4495_fall/html/materials.html

Page 3: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

How it all began

Page 4: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

An aside

Tyrannosaurus

Allosaurus

Titanosaurus

65 feet (L)

50 feet (L)

40 feet (L)

American football field: 300 feet x 160 feet

Ark: 450 feet x 75 feet

Height: 45 feet

http://dinodictionary.comhttp://www.kickoffzone.com/articles/images/ClemsonMemorialStadium02.jpg

Page 5: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Visible Spectrum

Physically, the colors are linear:

electromagnetic (EM) spectrum380 nm720 nm

Page 6: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Question

• Why then does violet look like red mixed with blue?

• Red and blue are at extreme ends of the spectrum

• Should have the least in common

380 nm720 nm

Page 7: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Answer

Psychologically, the colors are circular:

Newton chose 7 colors (ROYGBIV)because 7 is a perfect number

6 colors fits the data better(what is indigo anyway?)

This is the famous color wheel

Page 8: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color in music

De Clario’s color music code

http://home.vicnet.net.au/~colmusic/clario1.htm

Page 9: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color and moodsintense

peaceful,depressing

calm,natural

happy,optimistic

royal,wealthy

attention

http://www.infoplease.com/spot/colors1.html

http://www.cs.brown.edu/courses/cs092/VA10/HTML/GoethesTriangleExplanation.htmlGoethe’s color triangle

Page 10: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Physics of color

Forsyth, 2002Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

Illumination spectra Reflectance spectra

blue skylight

tungsten bulb

Page 11: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color names for cartoon spectra

400 500 600 700 nm

400 500 600 700 nm

400 500 600 700 nm

red

gree

nbl

ue

400 500 600 700 nm

cyan

mag

enta

yell

ow

400 500 600 700 nm

400 500 600 700 nm

http://groups.csail.mit.edu/graphics/classes/CompPhoto06/html/lecturenotes/Color.ppt

Page 12: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

MetamerTwo colors are metamers if they have• different spectral distributions• same visual appearance

http://escience.anu.edu.au/lecture/cg/Color/Image/metamer.gif

Page 13: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Trichromacy

Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

In the human visual system, every color can be obtained as the linear combination of three independent primary colors

Page 14: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 1

http://groups.csail.mit.edu/graphics/classes/CompPhoto06/html/lecturenotes/Color.ppt

Page 15: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 1

p1 p2 p3

The primary color amounts needed for a match

Page 16: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 1

p1 p2 p3

The primary color amounts needed for a match

Page 17: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 1

p1 p2 p3

The primary color amounts needed for a match

Page 18: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 2

Page 19: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 2

p1 p2 p3

Page 20: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 2

p1 p2 p3

Page 21: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching experiment 2

p1 p2 p3 p1 p2 p3

We say a “negative” amount of p2 was needed to make the match, because we added it to the test color’s side.

The primary color amounts needed for a match:

p1 p2 p3

Page 22: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Superposition principle

Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

Page 23: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Grassman’s Laws• For color matches:

– symmetry: U=V <=>V=U– transitivity: U=V and V=W => U=W– proportionality: U=V <=> tU=tV– additivity: if any two (or more) of the statements

U=V, W=X, (U+W)=(V+X) are true, then so is the third

• I.e., additive color matching is linear

• Not true at extreme ends of measurementsForsyth & Ponce

where

Page 24: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Do two people see the same color?

• Yes!

• In the following sense:They will choose the same weights for the three primaries to match the color

• Not true for color-blind people, of course

Page 25: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Rods and cones

http://en.wikipedia.org/wiki/Trichromatic_color_vision

• Young-Helmholtz theory (early 1800s): Color vision is the result of three different photoreceptors• Experimentally confirmed (1980s) by measuring the cone response functions from the photoreceptors

Page 26: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Tetrachromacy

• At low light levels, rod cells may contribute to color vision

• Studies suggest that some people may have four cones

• Some animals (e.g., shrimp) have more than four cones

Page 27: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Measure color by color-matching paradigm

• Pick a set of 3 primary color lights.• Find the amounts of each primary, e1, e2, e3,

needed to match some spectral signal, t.• Those amounts, e1, e2, e3, describe the color

of t. If you have some other spectral signal, s, and s matches t perceptually, then e1, e2, e3 will also match s, by Grassman’s laws.

• Why this is useful—it lets us:– Predict the color of a new spectral signal– Translate to representations using other primary

lights.

http://groups.csail.mit.edu/graphics/classes/CompPhoto06/html/lecturenotes/Color.ppt

Page 28: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Goal: compute the color match for any color signal for any set of

primary colors

• Examples of why you’d want to do that:– Want to paint a carton of Kodak film with the

Kodak yellow color.– Want to match skin color of a person in a

photograph printed on an ink jet printer to their true skin color.

– Want the colors in the world, on a monitor, and in a print format to all look the same.

Page 29: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

How to compute the color match for any color signal for any set of

primary colors

• Pick a set of primaries, • Measure the amount of each primary, needed

to match a monochromatic light, at each spectral wavelength (pick some spectral step size). These are called the color matching functions.

)(),(),( 321 ppp)(),(),( 321 ccc

)(t

Page 30: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching functions for a particular set of monochromatic

primariesp1 = 645.2 nmp2 = 525.3 nmp3 = 444.4 nm

Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

Page 31: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Using the color matching functions to predict the primary match to a new

spectral signalWe know that a monochromatic light of wavelength will be matched by the amounts

of each primary.

i)(),(),( 321 iii ccc

)(

)( 1

Nt

t

t

And any spectral signal can be thought of as a linear combination of very many monochromatic lights, with the linear coefficient given by the spectral power at each wavelength.

Page 32: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Using the color matching functions to predict the primary match to a new

spectral signal

)()(

)()(

)()(

313

212

111

N

N

N

cc

cc

cc

C

Store the color matching functions in the rows of the matrix, C

)(

)( 1

Nt

t

t

Let the new spectral signal be described by the vector t.

Then the amounts of each primary needed to match t are:

tC

Page 33: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Internal review

• So, for any set of primary colors, if we are given the spectral color matching functions for a set of primary lights

• We can calculate the amounts of each primary needed to give a perceptual match to any spectral signal.

Page 34: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Suppose you use one set of primaries and I use another?

• We address this in 2 ways:– Learn how to translate between

primaries– Standardize on a few sets of favored

primaries.

Page 35: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

How do you translate colors between different systems of primaries?

p1 = (0 0 0 0 0… 0 1 0)T

p2 = (0 0 … 0 1 0 ...0 0)T

p3 = (0 1 0 0 … 0 0 0 0)T

Primary spectra, P Color matching functions, C

p’1 = (0 0.2 0.3 4.5 7 …. 2.1)T

p’2 = (0.1 0.44 2.1 … 0.3 0)T

p’3 = (1.2 1.7 1.6 …. 0 0)T

Primary spectra, P’Color matching functions, C’

tC

Any input spectrum, tThe amount of each primary in P needed to match the color with spectrum t.

tCCP

''

The spectrum of a perceptual match to t, made using the primaries P’

The color of that match to t, described by the primaries, P.

The amount of each P’ primary needed to match t

Page 36: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

So, how to translate from the color in one set of

primaries to that in another:

''eCPe

P’ are the old primariesC are the new primaries’ color matching functions

C

P’

a 3x3 matrix

The values of the 3 primaries, in the primed system

The values of the 3 primaries, in the

unprimed system

Page 37: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

And, by the way, color matching functions translate like this:

''CCPC

But this holds for any input spectrum, t, so…

a 3x3 matrix that transforms from the color representation in one set of primaries to that of another.P’ are the old primaries

C are the new primaries’ color matching functions

C

P’

tC

tCCP

''From earlier slide

Page 38: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

How to use this?

• Given two sets of primaries, P and P’

• Measure color matching functions C and C’

• Solve C=FC’ for the 3x3 matrix F

• F now converts between tristimulus values: e = Fe’

Page 39: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Human eye photoreceptor spectral sensitivities

Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

What colors would these look like?

Page 40: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Are the color matching functions we observe obtainable from some 3x3 matrix transformation of the human photopigment response curves? (Because that’s how color matching functions translate).

Page 41: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color matching functions (for a particular set of spectral

primaries

Page 42: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Comparison of color matching functions with best 3x3 transformation

of cone responses

Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

Page 43: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Internal summary

• What are colors? – Arise from power spectrum of light.

• How represent colors: – Pick primaries– Measure color matching functions (CMF’s)– Matrix mult power spectrum by CMF’s to find

color as the 3 primary color values.• How share color descriptions between

people?– Translate colors between systems of primaries– Standardize on a few sets of primaries.

Page 44: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

CIE 1931 standard colorimetric observer (2o)

• Commission internationale de l'éclairage (CIE)• Used primaries:

– Red: 700 nm– Green: 546.1 nm– Blue: 435.8 nm

• 2o standard observer• Now considered out of date, but still widely used –

1964 supplementary standard colorimetric observer (10o)• Procedure:

– Show pure color to observer– Match using primaries weights for RGB– Transform from RGB to XYZ

(XYZ are imaginary primaries; in XYZ, all weights are positive)

(using NTSC primaries)

Page 45: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

CIE Chromaticity diagramNormalize: x = X / (X+Y+Z) y = Y / (X+Y+Z) z = 1 – x – y

spectral locus

line of purples

gamut of device is

convex hull of primaries

Note: It is misleading to draw colors on the chromaticity diagram (not recommended), but it makes the slide pretty

Page 46: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

CIE Chromaticity diagram

With 3 fixed primaries,

any color can be matched

(allowing negative weights)

Page 47: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

CIE Chromaticity diagram

But with just 2 primaries,

any color can also be matched

(if the primaries can be moved)

Page 48: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

CIE Chromaticity diagram

Complementary colors are on

opposite sides

Page 49: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

CIE Chromaticity diagram

Natural encoding of color for perception:• hue (dominant wavelength)

• saturation (distance from edge)

• value (height out of plane)

Notice similarity to color wheel

R

C

Y

G

M

B

Page 50: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces• RGB

– orthogonal axes– usually 8 bits each

(0 – 255)– natural for capture

and display H/W (cameras, monitors)

R

G

B

CCIR Rec. 601 was used for television(0.299 0.587 0.114)

CCIR Rec. 709 defines RGB for HDTV and is used by all modern devices(0.2125 0.7154 0.0721)

Page 51: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces• Turn the RGB cube

on its side• Hexagon border is

color wheel• white / black are out

of page

R

C

Y

G

M

B

R

C

Y

G

M

B

http://viz.aset.psu.edu/gho/sem_notes/color_2d/html/primary_systems.html

Page 52: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces

http://viz.aset.psu.edu/gho/sem_notes/color_2d/html/primary_systems.html

R

C

Y

G

M

B

• This is HLS (hue lightness saturation)

Page 53: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces

http://viz.aset.psu.edu/gho/sem_notes/color_2d/html/primary_systems.html

• Rescale HLS to get HSV (hue saturation value)

• Also called HIS• How would you describe a

color?– dominant wavelength (hue)– purity (saturation)– brightness (value)

• Transformation RGB HSV is nonlinear

Page 54: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces• Y’CbCr color differences

– Y’ is luma component– Cb is blue chroma component– Cr is red chroma component

• YUV is not well defined• Usually YUV means scaled version of Y’CbCr

For CCIR Rec. 601, (LumaRed, LumaGreen, LumaBlue) = (0.299 0.587 0.114)

Page 55: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces• American analog television transmission (NTSC)

uses YIQ color space:– originally black-and-white television (only Y)– IQ added later, modulated on top of Y for backward

compatibility

• European joke: “Never twice the same color”

Page 56: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces

• We have already seen CIE xyz

• Based on a direct graph of the original X, Y and Z tristimulus functions

• Problem: Too muchspace is allocated to greens

http://www.cambridgeincolour.com/tutorials/color-spaces.htm

Page 57: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces

• Ask subject to match test color• All matches fall within ellipse on

chromaticity diagram• These are MacAdam ellipses• They capture “just noticeable

difference”• Note: Color differences don’t

make sense for largedistances – Is red more likegreen or blue?

http://en.wikipedia.org/wiki/MacAdam_ellipse

Page 58: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces

• Solution: CIE Lu’v’

• Perceptually uniform space

• Colors are distributed proportional to their perceived color difference

http://www.cambridgeincolour.com/tutorials/color-spaces.htm

Page 59: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces• CIE La*b* (1976) transforms the colors so

that they extend equally on two axes• Color space is now a square• Each axis represents

an easily recognizable property of color:– red-green blend – blue-red blend– blue-green blend

http://www.cambridgeincolour.com/tutorials/color-spaces.htm

Page 60: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Int’l Color Consortium (ICC)• ICC established in 1993 to create an open,

standardized color management system• Now used in most computers• Systems involves three key concepts:

– color profiles– color spaces– translation between color spaces

http://www.cambridgeincolour.com/tutorials/color-management1.htm

Page 61: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

One final color space

• So far, we have been assuming additive colors (light)

• Now let us consider subtractive colors (pigments)

• Pigments work similarly but are highly nonlinear

Page 62: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Color spaces• CMYK is used for printers• Subtractive color• Black (K) is separate because it is very

difficult to get good black by mixing other colors

• In theory,

• But in practice much more complicated

Page 63: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Gamut• Recall: gamut is the range of colors

that a device can display

• Monitor’s gamut is triangle, because additive colors (light) follow Grassman’s laws

• More complicated for printers, film

http://www.imaging-resource.com/PRINT/PPM200/PPM200vsP400.gif

http://www.cse.fau.edu/~maria/COURSES/COP4930-GS/ColorFigs/Mvc-061s.jpg

Page 64: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Paint mixing

• This is why paint stores use many more than three paints for mixing (~12)

http://whites-autorepair.com/images/paintmixroom.jpghttp://www.albert-tague.com/inc/colour-mixer2.jpg

Page 65: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Additive and Subtractive Colors

additive

subtractive(but pigments are nonlinear)

RGB

CMYNote: Order of colors is the same in both cases

Page 66: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

This leads us to an important question

Page 67: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

What are the primary colors?

• As children, we learn RYB

• Then we’re told RGB

• When asked about the discrepancy, we’re told CMY is the same as RYB

Page 68: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Something about this is unsettling

• Yellow still appears to be pure– Even when you know that green and red make

yellow,– It is impossible to believe

• In fact, red, yellow, blue, and green all appear pure

• So do black and white• Could there be six

primary colors?

Page 69: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Limitations of component theories

• So far we have discussed component theories of color

• Component theories are unsatisfying because they do not describe our subjective experience well

• Psychologically,– violet looks like a combination of red and blue– yellow does not look like a combination of red

and green– black and white do not look like combinations

of other colors

Page 70: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Opponent colors• Opponent-process color theory (Hering 1872)• Six primary psychological colors:

• Each color looks pure• No such thing as

– reddish green (inevitably becomes yellowish green), or– yellowish blue (inevitably becomes yellowish-green)

• Every other color is a combination of these six

http://en.wikipedia.org/wiki/Opponent_process

Page 71: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Both are true

• Controversy raged for 100 years between – component theories– opponent color theory

• Both are true (experimentally verified):– three photoreceptors provide components– later cells transform to opponent color space

(Ballard and Brown)

Page 72: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Final thought

Piet Mondrian, Composition with Yellow, Blue, and Red, 1921http://en.wikipedia.org/wiki/Piet_Mondrian

Page 73: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Poynton definitions

• intensity, brightness, lightness, luma, luminance, white

Page 74: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Gamma correction

Page 75: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Blackbody radiators

Page 76: Color ECE 847: Digital Image Processing Stan Birchfield Clemson University

Fluorescence

http://en.wikipedia.org/wiki/Image:AgarosegelUV.jpg