raster graphics and color aaron bloomfield cs 445: introduction to graphics fall 2006

51
Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

Upload: silvester-banks

Post on 23-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

Raster Graphics and Color

Aaron Bloomfield

CS 445: Introduction to Graphics

Fall 2006

Page 2: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

2

Overview

Display hardware How are images displayed?

Raster graphics systems How are imaging systems organized?

Color models How can we describe and represent colors?

All non-credited images in this slide set are from Wikipedia

Page 3: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

3

Overview

Display hardware How are images displayed?

Raster graphics systems How are imaging systems organized?

Color models How can we describe and represent colors?

Page 4: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

4

Display Hardware

Video display devices Cathode Ray Tube (CRT) Liquid Crystal Display (LCD) Plasma panels Thin-film electroluminescent displays Light-emitting diodes (LED)

Hard-copy devices Ink-jet printer Laser printer Film recorder Electrostatic printer Pen plotter

Page 5: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

5

Cathode Ray Tube (CRT)

5. Anode connection

6. Mask for separating beams for RGB part of displayed image

7. Phosphor layer with RGB zones

8. Close-up of the phos-phor-coated inner side of the screen

1. Electron guns

2. Electron beams

3. Focusing coils

4. Deflection coils

Image via Wikipedia: http://en.wikipedia.org/wiki/Cathode_ray_tube

Page 6: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

6

Liquid Crystal Display (LCD)

Figure 2.16 from H&B

Page 7: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

7

Display Hardware

Video display devices» Cathode Ray Tube (CRT)» Liquid Crystal Display (LCD) Plasma panels Thin-film electroluminescent displays Light-emitting diodes (LED)

Hard-copy devices Ink-jet printer Laser printer Film recorder Electrostatic printer Pen plotter

Page 8: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

8

Overview

Display hardware How are images displayed?

Raster graphics systems How are imaging systems organized?

Color models How can we describe and represent colors?

Page 9: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

9

Raster Graphics Systems

DisplayProcessorDisplay

ProcessorSystem

MemorySystem

MemoryCPUCPU

FrameBufferFrameBuffer

MonitorVideoController

VideoController

System Bus

I/O Devices

Figure 2.29 from H&B

Page 10: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

10

Frame Buffer

Frame Buffer Figure 1.2 from FvDFH

Page 11: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

11

Frame Buffer Refresh

Figure 1.3 from FvDFH

Refresh rate is usually 60-120 Hz for CRTs

Page 12: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

12

DAC

Direct Color Framebuffer

Store the actual intensities of R, G, and B individually in the framebuffer

24 bits per pixel = 8 bits red, 8 bits green, 8 bits blue

Page 13: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

13

Red component vs. monochromatic

The red component only has the red components of each pixel (duh!)

Monochromatic is a gray-scale image that uses another color instead of white

Page 14: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

14

Color Lookup Framebuffer

Store indices (usually 8 bits) in framebuffer Display controller looks up the R,G,B values

before triggering the electron guns

Color indices

DAC

Page 15: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

15

Color CRT

Figure 2.8 from H&B

Page 16: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

16

Overview

Display hardware How are images displayed?

Raster graphics systems How are imaging systems organized?

» Color models How can we describe and represent colors?

Page 17: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

17

Specifying Color

Color perception usually involves three quantities: Hue: Distinguishes between colors like red, green, blue,

etc Saturation: How far the color is from a gray of equal

intensity Lightness: The perceived intensity of a reflecting object

Sometimes lightness is called brightness if the object is emitting light instead of reflecting it.

In order to use color precisely in computer graphics, we need to be able to specify and measure colors.

Page 18: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

18

How Do Artists Do It?

Artists often specify color as tints, shades, and tones of saturated (pure) pigments

Tint: Adding white to a pure pigment, decreasing saturation Shade: Adding black to a pure pigment, decreasing

lightness Tone: Adding white and black to a pure pigment

White Pure Color

Black

Grays

Tints

Shades

Tones

Page 19: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

19

Additive color vs. Subtractive color

Additive colors models are used in light Start with black, and add colored light to make your desired shade

Subtractive color models are used with paint Start with white, and add colors A given color – red – subtracts away (from the reflected light) any

wavelength that is not red Additive color mixing: Subtractive color mixing:

Page 20: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

20

HSV Color Model

Figure 15.16&15.17 from H&B

H S V Color 0 1.0 1.0 Red120 1.0 1.0 Green240 1.0 1.0 Blue * 0.0 1.0 White * 0.0 0.5 Gray * * 0.0 Black 60 1.0 1.0 ?270 0.5 1.0 ?270 0.0 0.7 ?

Page 21: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

21

Intuitive Color Spaces

HSV is an intuitive color space

Corresponds to our perceptual notions of tint, shade,and tone

Hue (H) is the angle around the vertical axis

Saturation (S) is a value from 0 to 1 indicating how far fromthe vertical axis the color lies

Value (V) is the height of the “hexcone”

Page 22: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

22

Precise Color Specifications

Pigment-mixing is subjective --- depends on human observer, surrounding colors, lighting of the environment, etc

We need an objective color specification Light is electromagnetic energy in the 400 to 700 nm

wavelength range Dominant wavelength is the wavelength of the color we

“see” Excitation purity is the proportion of pure colored light to

white light Luminance is the amount (or intensity) of the light

Page 23: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

23

Electromagnetic Spectrum

Visible light frequencies range between ... Red = 4.3 x 1014 hertz (700nm) Violet = 7.5 x 1014 hertz (400nm)

Figures 15.1 from H&B

Page 24: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

24

Visible Light

Hue = dominant frequency (highest peak) Saturation = excitation purity (ratio of highest to rest) Lightness = luminance (area under curve)

White Light Orange Light

Figures 15.3-4 from H&B

Page 25: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

25

Color Matching

In order to match a color, we can adjust the brightness of 3 overlapping primaries until the two colors look the same. C = color to be matched RGB = laser sources (R=700nm, G=546nm, B=435nm)

Humans have trichromatic color vision

C = R + G + B C + R = G + B

BRG

C BGRC

Page 26: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

26

Linear Color Matching

Grassman’s Laws:

1. Scaling the color and the primaries by the same factor preserves the match:

2C = 2R + 2G + 2B

2. To match a color formed by adding two colors, add the primaries for each color

C1 + C2 = (R1 + R2) + (G1 + G2) + (B1 + B2)

Page 27: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

27

?

RGB Spectral Colors

Match each pure color in the visible spectrum (rainbow)

Record the color coordinates as a function of wavelength

Page 28: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

28

Perception of color intensities

Which shade of gray is half-way between white and black?

It’s the second one Humans perceive color intensity (and sound, etc.) on a

logarithmic scale The first one is (about) 3/4 lit

We perceive it as 1/2 lit The second one is 1/2 lit

We perceive it as 1/4 lit

That exponent is called gamma () 2.0 is a sample value for a CRT or LCD monitor

Page 29: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

29

Humans have 3 light sensitive pigments in their cones, called L, M, and S

The cones respond to different lights: L to red M to green S to blue

This leads to metamerism

“Tristimulus” color theory

Human Color Vision

Page 30: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

30

Just Noticeable Differences

The human eye can distinguish hundreds of thousands of different colors

When two colors differ only in hue, the wavelength between just noticeably different colors varies with the wavelength! More than 10 nm at the extremes of the spectrum Less than 2 nm around blue and yellow Most JND hues are within 4 nm.

Altogether, the eye can distinguish about 128 fully saturated hues

Human eyes are less sensitive to hue changes in less saturated light (not a surprise)

Page 31: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

31

Luminance

Compare color source to a gray source

Luminance Y = .30R + .59G

+ .11B Color signal on a

black and white TV

Page 32: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

32

Chromaticity and the CIE

Negative spectral matching functions?

Some colors cannot be represented by RGB

Enter the CIE Three new standard

primaries called X, Y, and Z Y has a spectral matching function exactly equal to

the human response to luminance

Page 33: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

33

XYZ Matching Functions Match all visible

colors with only positive weights

Y matches luminance

These functions are defined tabularly at 1-nm intervals

Linear combinations of the R,G,B matching functions

Page 34: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

34

CIE Color Space

Page 35: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

35

Spectral Locus

From http://pages.infinit.net/graxx/Theorie4.html

Human perceptual gamut The cone keeps going

towards the right Brightness (not whiteness!)

keeps increasing

Page 36: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

36

Chromaticity Diagram

X

Y

Z

2.77 1.75 1.13

1.00 4.59 0.06

0.00 0.57 5.59

R

G

B

ZYX

Yy

ZYX

Xx

Converting from RGB to XYZ is a snap:

Given x, y, and Y, we can recover the X,Y,Z coordinates

Page 37: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

37

Measuring Color

Colorimeters measure the X, Y, and Z values for any color A line between the “white point” of the chromaticity diagram

and the measured color intersects the horseshoe curve at exactly the dominant wavelength of the measured color

A ratio of lengths will give the excitation purity of the color Complementary colors are two colors that mix to produce

pure white Some colors are non-spectral --- their dominant wavelength

is defined as the same as their complimentary color, with a “c” on the end

Page 38: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

38

Gamuts

Page 39: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

39

Gamut problems

Monitor gamuts are RGB

Printer gamuts are CMYK

Each can display colors the other cannot

Page 40: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

40

A Problem With XYZ Colors

If we have two colors C1 and C2, and we add C to both of them, the differences between the original and new colors will not be perceived to be equal

C1:

C2:

This is due to the variation of the just noticeable differences in saturated hues

XYZ space is not perceptually uniform LUV space was created to address this problem

add green

add green

Page 41: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

41

The RGB Color Model

This is the model used in color CRT monitors

RGB are additive primaries We can represent this space as a unit cube:

From http://ian-albert.com/graphics/rgb.php

Page 42: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

42

More on RGB

The color gamut covered by the RGB model is determined by the chromaticites of the three phosphors

To convert a color from the gamut of one monitor to the gamut of another, we first measure the chromaticities of the phosphors

Then, convert the color to XYZ space, and finally to the gamut of the second monitor

We can do this all with a single matrix multiply

Page 43: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

43

The CMY Color Model

Cyan, magenta, and yellow are the complements of red, green, and blue

We can use them as filters to subtract from white

The space is the same as RGB except the origin is white instead of black

This is useful for hardcopy devices like laser printers

If you put cyan ink on the page, no red light is reflected

B

G

R

Y

M

C

1

1

1

Page 44: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

44

CMYK

Most printers actually add a fourth color, black

Use black in place of equal amounts of C, M, and Y

Why? Black ink is darker than mixing C, M,

and Y Black ink is cheaper than colored ink

KYY

KMM

KCC

YMCK

,,min

Page 45: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

45

CMY vs CMYK

You can create (more or less) any color with each gamut

Colored printer ink is more expensive

Notice how much less CMY is needed in the CMYK version

One of the reasons printers use CMYK

And color mixing…

Page 46: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

46

The YIQ Color Model YIQ is used to encode television signals Y is the CIE Y primary, not yellow Y is luminance, so I and Q encode the

chromaticity of the color If we just throw I and Q away, we have

black and white TV

This assumes known chromaticities for your monitor

Backwards compatibility with black and white TV

More bandwidth can be assigned to Y

B

G

R

Q

I

Y

311.0528.0212.0

321.0275.0596.0

114.0587.0299.0

Page 47: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

47

HSV color space aside

Consider a HSV picture space: Blue and red are at right angles to each other Thus, with 2 coordinates,

you can define any saturation/hue combination

Let’s call the blue axis Cb It defines the blue/yellow

combination And the red axis Cr

It defines the red/cyan combination

Page 48: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

48

The YCbCr Color Model

Y is luma (similar to luminance) The brightness of a pixel

Cb and Cr define the chrominance Meaning they each define saturation

and hue Cb is the blue chroma, Cr is the red From the last slide

Notice the murkiness of the Cr and Cb components The human eye does not notice

differences in them nearly as much

Page 49: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

49

JPEG Image Compression

Take an image in the (r,g,b) color space Assume it’s 8 bits per image (24 bits total)

Convert it to YCbCr Also 8 bits per image

Downsample Cb and Cr to fewer bits

Let’s say 4 bits (24 = 16) So it can have values 0, 15, 31, 47, … 255

Each pixel now takes up 16 bits 8 for Y, 4 for Cb and 4 for Cr

Then do some other magic (including zip-like compression) And you have a (lossy) compressed image

Page 50: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

50

Future of color displays

Future color displays may have more pixels

RGB plus yellow, cyan, etc.

Will allow much more vivid color

A greater gamut of color possibilities

Note that both the pictures on the right are being displayed by an RGB output device…

Page 51: Raster Graphics and Color Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

51

Photo printers

Photo printers use many ink colors for rich, vivid color Also a scam to sell you more ink (the razor business

model)