Presentation is loading. Please wait.

Presentation is loading. Please wait.

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 1/82 © 2002 Andries van Dam.

Similar presentations


Presentation on theme: "I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 1/82 © 2002 Andries van Dam."— Presentation transcript:

1 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 1/82 © 2002 Andries van Dam CS123 (Introduction to Computer Graphics) Reused with permission. Lecture 17: Color Basics 1 of 2 Monday, 08 March 2004

2 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 2/82 All You Need to Know About Color in CS123

3 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 3/82 Achromatic light Chromatic color Color models for raster graphics Reproducing color Using color in computer graphics Achromatic and Colored Light

4 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 4/82 Physics and measurement for realism –what does coding an RGB triple mean? Perception and aesthetics for selecting appropriate user interface colors –why a bright red and orange striped bedroom is a bad idea –how to put on matching pants and shirt in the morning –role of culture and even age e.g., WIRED Color models for providing users with easy color selection –systems for naming and describing colors Color models, measurement and color gamuts for converting colors between media –why colors on your screen may not be printable, and vice-versa –managing color in systems with computers, monitors, scanners, and printers –color awareness a highly interdisciplinary field that is often unpredictable and downright bizarre We study it as a useful background for rendering and because it provides a good introduction to signal processing –also used for image processing and anti-aliasing Graphics group has worked on color tools for Adobe for the last two years Why Study Color in Computer Graphics?

5 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 5/82 Color is an immensely complex subject, drawing on physics, physiology, psychology, art, and graphic design Many theories, measurement techniques, and standards for colors, yet no one theory of human color perception is universally accepted Color of object depends not only on object itself but also on light source illuminating it, on color of surrounding area, and on human visual system (the eye/brain mechanism) Some objects reflect light (wall, desk, paper), while others also transmit light (cellophane, glass) –surface that reflects only pure blue light illuminated with pure red light appears black –pure green light viewed through glass that transmits only pure red also appears black Why is Color Difficult?

6 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 6/82 Achromatic light: intensity (quantity of light) only –called intensity or luminance if measure of light’s energy or brightness the psychophysical sense of perceived intensity –gray levels (e.g., from 0.0 to 1.0) –seen on black and white TV or display monitors Chromatic light –visual color sensations brightness/intensity chromaticity/color –hue/position in spectrum (red, green, yellow...) –saturation/vividness –generally need 64 to 256 gray levels for continuous-tone images without contouring Achromatic Light

7 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 7/82 Gamma (γ) is a measure of the nonlinearities of a CRT –Nonlinearity: the response (output) is not directly proportional to the input Term often used incorrectly to refer to nonlinearity of image data Example: PC monitors have a gamma of roughly 1.8, while Mac monitors have a gamma of 2.2, so Mac images appear dark on PC’s Problems in graphics –need to maintain color consistency across different platforms and hardware devices (monitor, printer, etc.) –even the same type/brand of monitors change gamma value over time –proper design and use of color software Gamma Mac user generates image PC user changes image to make it bright PC user gives image back; it’s now too bright

8 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 8/82 Nonlinearities are pervasive –hardware –human visual systems How to distribute 256 different intensities? –don’t want, for example, 128 in [0, 0.1] and [0.9, 1.0] –would create a visible gap from 0.1 to 0.9 Yet want predictability First, we deal with nonlinearity of visual systems, then with nonlinearity of CRT (LCD is different) Eye sensitive to ratio: perceives intensities 0.10 and 0.11 as differing just as much as the intensities 0.50 and 0.55 –spacing evenly over the range 0 to 1 ignores ratio sensitivity Compensating for Nonlinearities – Gamma Correction

9 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 9/82 To achieve equal steps in brightness, space logarithmically rather than linearly, so that Use the following relations: Therefore: In general for n+1 intensities: Thus for Gamma Correction – Implementation

10 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 10/82 Dynamic range of a device: ratio of maximum to minimum intensities, i.e., 1/I 0 Typical on CRT anywhere from 40:1 to 200:1 => I 0 between.005 and.025: for I 0 = 0.02, EQ (13.2) yields r = 1.0154595 … First few and last two intensities of the 256 intensities from EQ (13.1): 0.0200, 0.0203, 0.0206, 0.0209, 0.0213, 0.0216, …, 0.9848, 1.0000 Next problem: pixel values are NOT intensities: need gamma correction to compensate for nonlinearities Non-linearities in CRT Therefore, for some other constant k: Displaying Intensities (1/2)

11 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 11/82 To display intensity I, find nearest I j from a table or: j = ROUND(log r (I/I 0 )) Then I j = r j I 0 And –if no look-up table, load V j in pixel –if look-up table, load j in pixel, V j in entry j Number of intensities needed for appearance of continuous intensity depends on ratio: –need r = 1.01 for I j and I j +1 to be indistinguishable: –solve for n: Displaying Intensities (2/2)

12 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 12/82 Dynamic range (1/I 0 ) and theoretical number of required intensities n = log 1.01 (1/I 0 ) for several display media (ink bleeding and random noise considerably decreases n in practice) Note a medium’s dynamic range (number of intensities) is not the same as its gamut (number of visible colors it can display) Display Media CRT Photographic prints Photographic slides Coated paper printed in B/W Coated paper printed in color Newsprint printed in B/W Typical Dynamic Range 50-200 100 1000 100 50 10 No. of Intensities, n 400-530 465 700 465 400 234

13 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 13/82 Hue distinguishes among colors such as red, green, purple, and yellow Saturation refers to how pure the color is, how much white/gray is mixed with it –red is highly saturated; pink is relatively unsaturated –royal blue is highly saturated; sky blue is relatively unsaturated –pastels are less vivid, less intense Lightness embodies the achromatic notion of perceived intensity of a reflecting object Brightness is used instead of lightness to refer to the perceived intensity of a self- luminous (i.e., emitting rather than reflecting light) object, such as a light bulb, the sun, or a CRT Can distinguish ~7 million colors when samples placed side-by-side (JNDs) –with differences only in hue, λ difference of JND colors are 2nm in central part of visible spectrum, 10 nm at extremes – non-uniformity! –about 128 fully saturated hues are distinct –eye less discriminating for less saturated light (from 16 to 23 saturation steps for fixed hue and lightness), and less sensitive for less bright light Chromatic Color

14 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 14/82 The effect of (A) passing light through several filters (subtractive mixture), and (B) throwing different lights upon the same spot (additive mixture) (These and other scanned-in illustrations are taken from Gleitman’s Psychology, 3 rd Edition, 1991.) Color Mixing Applets Additive Mixing Applet: http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/ap plets/additiveColorMixing/additive_color_mixing_guide.html Combined Mixing Applet: http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/ap plets/combinedColorMixing/combined_color_mixing_guide.html You’ll get to use these in Lab! Color Mixture A B

15 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 15/82 Subtractive mixture occurs with inks for print medium, paints that absorb light. In subtractive mixture, the light passed by two filters (or reflected by two mixed pigments) is the band of wavelengths passed by the first minus that region which is subtracted by the second. In the present example, the first filter passes light between 420 and 520 nanometers (a broad-band blue filter), while the second passes light between 480 and 660 nanometers (a broad-band yellow filter). The only light that can pass through both is in the region between 480 and 520 nanometers, which appears green. Subtractive Mixture blue green yellow red green

16 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 16/82 Additive mixture used to mix R, G, B guns of CRT. In this additive mixture, the light passed by two filters (or reflected by two pigments) impinges upon the same region of the retina at the same time. The figure shows two projectors throwing pure blue and yellow filtered light upon the same portion of the screen from which it is reflected upon the same region of the retina. In contrast to what happens in a subtractive mixture, the result of adding these two colors is gray. Additive Mixture

17 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 17/82 The Channel at Gravelines (1890) by Georges Seurat A detail of the painting (on the left) shows the separate color daubs which, when viewed from a distance, mix additively. The pointillists employed this technique instead of mixing pigments to capture the bright appearance of colors outdoors. The pigment mixture itself is subtractive and darkens the resulting colors. Additive Mixture in Pointillist Art

18 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 18/82 These complementary “unique” hues play a role in opponent color perception discussed later Note that only for perfect red and green do you get gray – CRT red and green both have yellow components and therefore sum to yellowish gray Complementary Hues – Additive Mixture 5.38 Complementary hues Any hue will yield gray if additively mixed (in the correct proportion) with a hue on the opposite side of the color circle. Such hue pairs are complementaries. Some complementary hues are shown here linked by a line across the circle’s center. Of particular importance are the two complementary pairs that contain the four unique hues: red-green and blue-yellow.

19 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 19/82 The gray patches on the blue and yellow backgrounds are physically identical. But they don’t look that way. To begin with, there is a difference in perceived brightness: the patch on the blue looks brighter than the one on the yellow, a result of brightness contrast. There is also a difference in perceived hue, for the patch on the blue looks somewhat yellowish, while that on the yellow looks bluish. This is color contrast, a demonstration that hues tend to induce their complementary colors in neighboring areas. For a good applet on this, check out: http://www.cs.brown.edu/courses/cs092/VA10/HTML/start.html and click on any Albers Plate link Color Contrast

20 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 20/82 Stare at the center of the figure for about a minute or two, and then look at a blank white screen or a white piece of paper Blink once or twice; the negative afterimage will appear within a few seconds showing the rose in its “correct” colors (red petals and green leaves) Negative Afterimage

21 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 21/82 Can you see the afterimage? (look at the white space and blink)

22 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 22/82 Many measurement/specification (M/S) methods to refer to/name a particular color Compare unknown and sample from a collection –colors must be viewed under a standard light source –depends on human judgment PANTONE ® Matching System in printing industry Munsell color-order system –set of samples in 3D space –hue, value/lightness, chroma (saturation) –equal perceived distances between neighbors Artists specify color as tint, shade, tone using pure, white, and black pigments; Ostwald system is similar Later, we’ll look at computer-based models Specifying (Naming) Color Black Grays White Tints “Pure” color Tones Shades Decrease saturation Decrease lightness Munsell color space

23 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 23/82 Comparison of tint, shade, and tone are subjective, perceptually-oriented concepts: depend on observer’s judgment, lighting, sample size, surrounding color, overall lightness of environment… Colorimetry is quantitative, physics-oriented; measurement via spectroradiometer (measures reflected/radiated light), colorimeter (measures the primary colors), etc. Perceptual term Colorimetry term Hue Dominant wavelength Saturation Excitation purity Lightness (reflecting objects) Luminance Brightness (self-luminous objects) Luminance Physiology of vision, theories of perception are still active research areas Note: our auditory and visual processing are very different! –both are forms of signal processing –but visual processing integrates and is much more affected by context –more than half of our cortex is devoted to vision –vision is probably the most dominant sense, though it is apparently harder to be totally deaf than to be totally blind Psychophysics

24 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 24/82 We draw a frequency response curve like this: to indicate how much a receptor responds to light of uniform intensity for each wavelength To compute the response to a whole incoming band (frequency distribution) of light, like this: We multiply the two curves, wavelength by wavelength: to compute how much the receptor responds to each amount of stimulus across the spectrum Response to Stimuli (1/3)

25 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 25/82 The gray area under the product curve represents how much the receptor “sees,” i.e., the total response to the incoming light Let’s call this receptor red, then Response Cell Applet: http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/applets/spectrum/single_cell_response_ guide.html Response to Stimuli (2/3) Response Curve Incoming Light Distribution Product of functions

26 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 26/82 Response to Stimuli (2/3) Response curve is also called a filter because you can think of it as determining the amplitude of the response (i.e., perceived intensity) of each wavelength Where the filter’s amplitude is large, it lets through most of the incoming signal for a strong response Where the filter’s amplitude is low, it filters out much/most/all of the signal for a weak response

27 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 27/82 Imagine a creature with just one kind of receptor, say “red,” whose response curve looks like this: How would it respond to each of these two light sources? Both signals will generate the same amount of “red” perception. Hence they are metamers –one type of receptor can never give us more than one color sensation, red in this case –although, different signals may result in different perceived brightness Metamers (1/4) Different light distributions that produce the same response

28 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 28/82 Consider a creature with two receptors (R1, R2) Note that in principle an infinite number of frequency distributions can simulate the effect of I2, e.g., I1 –in practice, for In near base of response curves, amount of light required becomes impractically large Metamers (2/4) I1 I2

29 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 29/82 For three types of receptors, there are potentially infinitely many color distributions (metamers) that will generate exactly the same sensations –you can test this out with the metamer applet –we’ll do this in lab Conversely, no two spectral (monochromatic) lights can generate identical receptor responses and therefore all look unique Thomas Young in 1801 postulated that we need 3 types of receptors to distinguish the gamut of colors represented by triples H, S and V Metamer Applet http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/ap plets/spectrum/metamers_guide.html Metamers (3/4)

30 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 30/82 For two light sources to be metamers, the amounts of red, green, and blue response generated by the two sources must be identical This amounts to three constraints on the lights But the light sources are infinitely variable – one can adjust the amount of light at any possible wavelength… So there are infinitely many metamers Observations: –if two people have different response curves, the metamers for one person will be different from those for the other –metamers are purely perceptual: scientific instruments can detect the difference between two metameric lights –even a prism can help show how two metameric lights are different… Metamers (4/4)

31 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 31/82 Spectral color: single wavelength (e.g., from laser); “ROY G. BIV” spectrum Non-spectral color: combination of spectral colors; can be shown as continuous spectral distribution or as discrete sum of n primaries (e.g., R, G, B); most colors are non-spectral mixtures Metamers are spectral energy distributions that are perceived as the same “color” –each color sensation can be produced by an arbitrarily large number of metamers Energy Distribution and Metamers White light spectrum where the height of the curve is the spectral energy distribution Cannot predict average observer’s color sensation from a distribution

32 I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 32/82 Can characterize visual effect of any spectral distribution by triple (dominant wavelength, excitation purity, luminance): Dominant wavelength corresponds to hue we see; spike of energy e 2 Excitation purity is the ratio of monochromatic light of the dominant wavelength and white light to produce the color e 1 = e 2, excitation purity is 0% (unsaturated) e 1 = 0, excitation purity is 100% (fully saturated) Luminance relates to total energy, which is proportional to integral of the product of distribution and eye’s response curve (“luminous efficiency function”) – depends on both e 1 and e 2 Note: –dominant wavelength of a real distribution may not be the one with the largest amplitude! –some colors (e.g., purple) have no dominant wavelength Colorimetry Terms e1e1 e2e2 Energy Density Dominant Wavelength 400700 wavelength, nm Idealized uniform distribution except for e 2


Download ppt "I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 1, 2002 Introduction to Computer Graphics 1/82 © 2002 Andries van Dam."

Similar presentations


Ads by Google