810 likes | 1.07k Views
Coloring. Hank Childs , University of Oregon. Kristi Potter. October 9 th , 2013. Project 2 . Assigned today, prompt online Due October 9 th , midnight ( October 10 th , 6am) Worth 7% of your grade Provide: Code skeleton online Correct answers provided You send me: source code
E N D
Coloring Hank Childs, University of Oregon Kristi Potter October 9th,2013
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
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
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”
Color • Kristi Potter • kpotter@cas.uoregon.edu • cs 410/510 • October 9, 2013
The Visible Spectrum Wavelength, λ (nm) human visual system sensitive to ~380-780 nm
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
Color Perception “While light is a physical entity, color is a perception...” -Margaret Livingstone
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
Retinal Cells Light
Pigment Epithelium Light • light sink • absorbs scattering light • other biological functions (e.g. chemistry of the eye)
Photoreceptors Light • rods & cones • cones for day vision (small, medium, long) • rods for night vision • binary signal on/off
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
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
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
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)
Bipolar Cells Light • accumulate rods OR cones • also receives signals from horizontal cells • emits ON-center or OFF-center • defines the center response
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
- - - - - - - - - + - + + - - - + + + + + - 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
Color Perception Change in Light
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
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
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
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
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/)
Cornsweet Illusion • luminance the same at both ends • many perceptions more sensitive to abrupt change • (luminance, color, motion, depth) • attributed to center/surround organization
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
Successive Contrast look at a dot then look at a dot
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
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)
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
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
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
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;
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; • }