1 / 78

Coloring

Coloring

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

1. Coloring Hank Childs, University of Oregon Kristi Potter October 9th,2013

2. Project 2 • Assigned today, prompt online • Due October 9th, midnight ( October 10th, 6am) • Worth 7% of your grade • Provide: • Code skeleton online • Correct answers provided • You send me: • source code • output from running your program

3. Project 2: Field evaluation • Goal: for point P, find F(P) • Strategy in a nut shell: • Find cell C that contains P • Find C’s 4 vertices, V0, V1, V2, and V3 • Find F(V0), F(V1), F(V2), and F(V3) • Find locations of V0, V1, V2, and V3 • Perform bilinear interpolation to location P

4. Today’s Lecturer: Kristi Potter • Research expertise: • Scientific visualization, esp. visualization of ensembles and uncertainty visualization • Previous: • B.S., Univ. of OR: CIS & Fine Arts • Ph.D., Univ. of Utah • Professional Researcher, Univ. of Utah • Current: • Scientific Programmer, CASSPR, Univ. of OR • Courtesy position, CIS • Co-founder, CDUX • Campus “visualization evangelist”

5. Color • Kristi Potter • kpotter@cas.uoregon.edu • cs 410/510 • October 9, 2013

6. Physics of Light

7. The Electromagnetic Spectrum

8. The Visible Spectrum Wavelength, λ (nm) human visual system sensitive to ~380-780 nm

9. Isaac Newton • white light is a combination of all colors of the spectrum • black is the absence of visible spectrum wavelengths • separation of visible light into colors is called dispersion • objects appear colored by the character of the light they reflect

10. Color Perception “While light is a physical entity, color is a perception...” -Margaret Livingstone

11. The Eye

12. Retina • Optimized for acuity (rather than light sensitivity) • Specialized neural circuitry does much of the image processing • Complexity not fully understood • image processing NOT image transmission Light

13. Retinal Cells Light

14. Pigment Epithelium Light • light sink • absorbs scattering light • other biological functions (e.g. chemistry of the eye)

15. Photoreceptors Light • rods & cones • cones for day vision (small, medium, long) • rods for night vision • binary signal on/off

16. Rod & Cone Response

17. a b Cones • response relies on both wavelength and intensity of light • response magnitude alone doesn’t say anything • (e.g. L cone: same intensity, different wavelength) • color is derived by comparing signals between cones • (red is signaled by a larger L response compared to M) • unambiguous code for color through ratio between cones

18. Why 3 cones? • cover the visible spectrum • correspond to/explain “primary colors” • theoretically possible with only 2 cones • most birds, some fish, reptiles & insects have 4

19. Rods • night vision / luminance • Purkinje effect • tendency of peak sensitivity to shift toward blue at low illumination levels • red light doesn’t effect night vision day dusk night

20. Horizontal Cells Light • accumulate across cones • modulate photoreceptor signals under different light • respond to light over a large area • react to the absence of light • defines the surround signal (more on this later)

21. Bipolar Cells Light • accumulate rods OR cones • also receives signals from horizontal cells • emits ON-center or OFF-center • defines the center response

22. Ganglion Cells Light • connection to the brain • axon bundle creates the optic nerve • at least 5 types based on function & where they connect • some even photosensitive! • selectively sensitive to discontinuities in light

23. - - - - - - - - - + - + + - - - + + + + + - Center/Surround - - - - - - - - - • organization of the receptive field • cells optimally excited by tiny spots of light • light in the center excites, inhibits in the surround • (or vice-versa) • sensitive to discontinuities in light patterns • encode only changes in receptive field

24. Color Perception Change in Light

25. Color Blindness

26. Color Blindness • deficiency in color vision • typically caused by faulty cone development • found more in men than women • photopigment genes carried in X-chromosome • 5-8% of men and 0.5% of women

27. Types : monochromacy • 1 dimensional color vision • 2 or 3 cone pigments are missing • total color blindness • very rare • rod monochromacy : non-functioning or missing cones • achromatopsia • cone monochromacy : multiple deficient cones • multiple types of dichromacy

28. Types: dichromacy • 2 dimensional color vision • 1 cone pigment is missing • protanopia : absence of red receptors • deuteranopia : absence of green receptors • tritanopia : absence of blue receptors

29. Types: Trichomacy • 3 dimensional color vision • 1 cone is altered in spectral sensitivity • impairment rather than loss • protanomaly : shift in red, poor red-green discrimination • deuteranomaly : shift in green, poor red-green discrimination • most common form of color deficiency • tritanomaly : poor blue-yellow discrimination

30. Designing for Colorblindness • vary in hue or saturation or brightness • monochrome color schemes • use queues besides/in addition to color • software solutions • vischeck : (http://www.vischeck.com/)

31. Color Illusions

32. Cornsweet Illusion • luminance the same at both ends • many perceptions more sensitive to abrupt change • (luminance, color, motion, depth) • attributed to center/surround organization

33. Contrast Effects • juxtaposition of colors effects our perception of them • complimentary colors often most effected • simultaneous : how colors can affect each other • successive : how color can affect future perception

34. Simultaneous Contrast

35. Simultaneous Contrast

36. Successive Contrast look at a dot then look at a dot

37. Equiluminant Colors • strong contrast • shapes to be seen by color sensitive cells • equiluminance • hides positions from light sensitive cells • flickering/movement caused by this disconnect

38. Color Models

39. Subtractive Color (Print)

40. Subtractive Color (Paint)

42. Color Spaces

43. R RGB • additive • Red, Green, Blue channels • electron guns of crt monitors • device-dependent • float: (0.0-1.0) • int: (0 -255) • hex: (00-FF)

44. CMYK • subtractive • Cyan, Magenta, Yellow, Key (black) • inks used in printing • assumes white paper (non-existence of ink) • often required for paper publications • device dependent

45. HSV [B, L, I] • additive • Hue, Saturation, [Value, Brightness, Lightness, Intensity] • polar coordinate representations of RGB space • conical or cylindrical shaped space • more intuitive than RGB for color tuning

46. CIE LAB/LUV • mathematically defined, perceptually based • Commission Internationale de l'éclairage) • Lightness, (a,b)/(u,v) color opponent dimensions • a: blue/yellow, b: green/red • lightness (0% black, 100% white) • space includes all perceivable colors • (gamut greater than RGB, CMYK) • device independent

47. C++ (ish) RGB to HSV // in: rgb(0.0,1.0) out: h(0,360), v(0.0,1.0), s(0.0,1.0) rgb2hsv(float r, float g, float b) // find the min and max of rgb maxColor= max(r, g, b); minColor = min(r, g, b); float delta = maxColor - minColor; float Value = maxColor; float Saturation = 0; float Hue = 0; if (delta == 0) Hue = 0; Saturation = 0; else Saturation = delta / maxColor; float dR = 60.f*(maxColor - r)/delta + 180.0; float dG = 60.f*(maxColor - g)/delta + 180.0; float dB = 60.f*(maxColor - b)/delta + 180.0; if (r == maxColor) Hue = dB - dG; else if (g == maxColor) Hue = 120 + dR - dB; else Hue = 240 + dG - dR; if (Hue < 0) Hue+=360; if (Hue > =360) Hue-=360;

48. C++ (ish) HSV to RGB • // in: h(0,360), v(0.0,1.0), s(0.0,1.0) out: rgb(0.0,1.0) • hsvToRGB(float hue, float saturation, float value) • if( saturation == 0 ) // achromatic (grey) • r = g = b = v; • else{ • hue /= 60.f; • // sector 0 to 5 • i= floor( hue ); • f = hue - i; • // factorial part of h • p = value * ( 1 - saturation); • q = value * ( 1 - saturation * f ); • t = value * ( 1 - saturation * ( 1 - f ) ); • switch( i ): • case 0: r = v; g = t; b = p; • case 1: r = q; g = v; b p; • case 2: r = p; g = v; b = t; • case 3: r = p; g = q; b = v; • case 4: r = t; g = p; b = v; • case 5: r = v; g = p; b = q; • }