<<

University of British Columbia Reading for RGB Color CPSC 314 Computer Graphics Jan-Apr 2013 • RB Chap Color • triple (r, g, b) represents with amount of , , and Tamara Munzner • FCG Sections 3.2-3.3 • hardware-centric • FCG Chap 20 Color • used by OpenGL Vision/Color • FCG Chap 21.2.2 (Color) Vision/Color

http://www.ugrad.cs.ubc.ca/~cs314/Vjan2013 2 3 4

Alpha Additive vs. Subtractive Colors Component Color Basics Of Color

• fourth component for transparency • additive: • component-wise multiplication of colors • elements of color: & C # &1# &R# • (r,g,b,α) • monitors, LCDs • (a0,a1,a2) * (b0,b1,b2) = (a0*b0, a1*b1, a2*b2) $M ! $1! $G! • fraction we can see through • RGB model $ ! = $ ! ' $ ! • c = αcf + (1-α)cb • subtractive: pigment %$ Y "! %$1"! %$B"! • more on compositing later • printers • CMY model • dyes absorb light • why does this work? • must dive into light, human vision, color spaces 5 additive subtractive 6 7 8

Basics of Color Light Sources Blackbody Radiation

• physics • common light sources differ in kind of spectrum they • body • illumination emit: • dark material, so that reflection can be neglected • electromagnetic spectra • continuous spectrum • spectrum of emitted light changes with temperature • reflection • energy is emitted at all wavelengths • this is the origin of the term “” • material properties • blackbody radiation • e.g. when setting a point for your monitor • surface geometry and microgeometry • tungsten light bulbs • cold: mostly infrared • polished versus matte versus brushed • certain fluorescent • hot: reddish • perception • sunlight • very hot: bluish • physiology and neurophysiology • electrical arcs • demo: • perceptual psychology • line spectrum • energy is emitted at certain discrete frequencies

9 10 http://www.mhhe.com/physsci/astronomy/applets/Blackbody/frame.html11 12

Continuous Electromagnetic Spectrum White Light Sunlight Spectrum Spectrum • sun or light bulbs emit all frequencies within • spectral distribution: power vs. wavelength visible range to produce what we perceive as • sunlight "white light" • various “daylight” lamps

13 14 15 16 Line Spectrum White Light and Color Saturation or Purity of Light • how washed out or how pure the color of the light • when white light is incident upon an object, • hue (or simply, "color") is dominant wavelength/ appears frequency • ionized some frequencies are reflected and some are • contribution of dominant light vs. other frequencies absorbed by the object producing white light gases • saturation: how far is color from • lasers • combination of frequencies present in the • is less saturated than red • sky blue is less saturated than royal blue • some reflected light that determines what we fluorescent perceive as the color of the object lamps

• integration of energy for all visible wavelengths is proportional to intensity of color

17 18 19 20

Intensity vs. Brightness Perceptual vs. Colorimetric Terms Physiology of Vision Physiology of Vision

• Perceptual • Colorimetric • the retina • Center of retina is densely packed region • intensity : physical term • rods called the fovea. • Hue • measured radiant energy emitted per unit of • Dominant wavelength • b/w, edges • Cones much denser here than the periphery time, per unit solid angle, and per unit • cones • Saturation projected area of the source (related to the • Excitation purity • 3 types luminance of the source) • • color sensors • reflecting objects • Luminance • uneven • lightness/brightness: perceived intensity of distribution light • Brightness • dense fovea • nonlinear • light sources • Luminance

21 22 23 24

Foveal Vision Tristimulus Theory of Trichromacy Metamers

• hold out your thumb at arm’s length • Although light sources can have extremely • three types of cones • a given perceptual sensation of color derives from the complex spectra, it was empirically • L or R, most sensitive to red light (610 nm) stimulus of all three cone types • M or G, most sensitive to green light (560 nm) determined that colors could be described by • S or B, most sensitive to blue light (430 nm) W only 3 primaries X H J A V C E N O • Colors that look the same but have different S R G D P Q F M B spectra are called metamers Y K L U • identical perceptions of color can thus be caused by very different spectra T • results from missing cone type(s) • demo 25 26 27 http://www.cs.brown.edu/exploratories/freeSoftware/catalogs/color_theory.html 28

Color Spaces Negative Lobes CIE Measured vs. CIE Color Spaces

• three types of cones suggests • CIE defined 3 “imaginary” lights X, Y, Z color is a 3D quantity. how to • any wavelength λ can be matched define 3D color space? perceptually by positive combinations

• sometimes need to point red light to shine on target • idea: perceptually based measurement in order to match colors • shine given wavelength (λ) on a screen • equivalent mathematically to "removing red" Note that: • user must control three pure lights producing • but physically impossible to remove red from CRT phosphors X ~ R three other wavelengths • measured basis • can’t generate all other wavelenths with any set of Y ~ G • transformed basis • used R=700nm, G=546nm, and B=436nm Z ~ B • monochromatic lights • “imaginary” lights three positive monochromatic lights! • physical observations • all positive, unit area • adjust intensity of RGB until colors are identical • negative lobes • solution: convert to new synthetic coordinate • Y is luminance, no hue • this works because of metamers! system to make the job easy • X,Z no luminance • experiments performed in 1930s 29 30 31 32 Blackbody CIE and Diagram CIE “Horseshoe” Diagram Facts CIE “Horseshoe” Diagram Facts Curve • X, Y, Z form 3D shape • all visible colors lie inside the horseshoe • can choose a point C for a • illumination: • project X, Y, Z on X+Y+Z=1 • result from color matching experiments • corresponds to an illuminant • candle plane for 2D color space • usually on curve swept out by black body radiation 2000K • spectral (monochromatic) colors lie around • A: Light bulb • chromaticity diagram spectra for different temperatures the border 3000K • separate color from • sunset/ brightness • straight line between blue and red contains sunrise • x = X / (X+Y+Z) tones 3200K • D: daylight • y = Y / (X+Y+Z) • colors combine linearly (i.e. along lines), since 6500K the xy-plane is a plane from a linear space • overcast day 7000K • lightning >20,000K

33 34 35 36

Color Interpolation, CIE “Horseshoe” Diagram Facts Device Color Gamuts Display Gamuts Dominant & Opponent Wavelength • can choose a point C for a white point • gamut is polygon, device primaries at corners • corresponds to an illuminant • defines reproducible color range • usually on curve swept out by black body radiation spectra for • X, Y, and Z are hypothetical light sources, no different temperatures Complementary wavelength device can produce entire gamut • two colors are complementary relative to C when are • located on opposite sides of line segment through C • so C is an affine combination of the two colors • find dominant wavelength of a color: • extend line from C through color to edge of diagram • some colors (i.e. ) do not have a dominant wavelength, but their complementary color does

37 38 39 From A Field Guide to Digital Color, © A.K. Peters, 2003 40

Projector Gamuts Gamut Mapping RGB Color Space (Color Cube) HSV Color Space • more intuitive color space for people • how to handle colors outside gamut? • define colors with (r, g, b) • H = Hue amounts of red, green, and blue • dominant wavelength, “color” • one way: construct ray to white point, find • used by OpenGL • S = Saturation closest displayable point within gamut • hardware-centric • how far from grey/white • V = Value • how far from black/white • also: brightness B, intensity I, lightness L Saturation Value • RGB color cube sits within CIE color space • subset of perceivable colors Hue • scale, rotate, shear cube

From A Field Guide to Digital Color, © A.K. Peters, 2003 41 42 43 44

HSI/HSV and RGB YIQ Color Space Luminance vs. Intensity Opponent Color I • HSV/HSI conversion from RGB not expressible in matrix • definition • used for color TV Q • luminance • H=hue same in both • achromatic axis • V=value is max, I=intensity is average • Y is luminance (same as CIE) • Y of YIQ • R-G and Y-B axis • I & Q are color (not same I as HSI!) 1 • 0.299R + 0.587G + 0.114B • separate lightness from chroma channels & # • using Y backwards compatible for B/W TVs [(R ' G) + (R ' B)] if (B > G), • captures important factor • first level encoding '1 $ 2 ! H = cos $ ! • conversion from RGB is linear • linear combination of LMS (R G)2 (R B)(G B) H = 360 " H • intensity/brightness $ ' + ' ' ! • expressible with matrix multiply • before optic nerve Y 0.30 0.59 0.11 R • I/V/B of HSI/HSV/HSB % " & # & #& # • basis for perception $ I ! = $0.60 ' 0.28 ' 0.32!$G! min(R,G,B) R + G + B $ ! $ !$ ! • 0.333R + 0.333G + 0.333B • “color blind” = color deficient HSI: S =1" I %$Q"! %$0.21 ' 0.52 0.31 "!%$B"! ! = • not perceptually based • degraded/no acuity on one axis I 3 • 8%-10% men are red/green deficient min(R,G,B) • green is much lighter than red, and red lighter HSV: S =1" V = max(R,G,B) than blue 45 46 47 48 V www.csse.uwa.edu.au/~robyn/Visioncourse/colour/lecture/node5.html ! ! ! vischeck.com Color/Lightness Constancy Color/Lightness Constancy Color/Lightness Constancy

• simulates color vision deficiencies • color perception depends on surrounding • colors in close proximity • simultaneous contrast effect

Normal vision Deuteranope Protanope Tritanope

• illumination under which the scene is viewed

Image courtesy of John McCann Image courtesy of John McCann 49 50 51 52

Color Constancy Stroop Effect Stroop Effect • red • blue • automatic “white • blue • green balance” from change • • purple in illumination • purple • red • vast amount of • green • orange processing behind the scenes! • interplay between cognition and perception • vs. perception

53 54 55