cs 376 introduction to computer graphics 01 / 26 / 2007 instructor: michael eckmann

22
CS 376 Introduction to Computer Graphics 01 / 26 / 2007 Instructor: Michael Eckmann

Upload: belinda-waters

Post on 25-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

CS 376Introduction to Computer Graphics

01 / 26 / 2007

Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Today’s Topics• chromaticity diagram

– color gamut, complementary colors, dominant wavelength

• RGB, YIQ

• CMY, CMYK, HSV

• Introduction to Open GL

Homework• READING:

– For openGL:• 2.8, 2.9• first four sections of chapter 3

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Color• source:

Wikipedia

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Color• Last time we saw how the Chromaticity diagram could be

used to find color gamuts of 2 or more colors and how to find complementary colors.

• Also, recall that

– All perceivable colors with the same chromaticity but

different brightness map to the same point.

– The spectrally pure colors are on the outer curve.

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Color

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Color• The chromaticity diagram is also useful for determining purity

and hue for a color – purity (saturation): ratio of distance of line from color (eg. C

1) to C to

the distance of line from C to spectral color Cs on the outer curve.

– hue (dominant wavelength): draw a line from C through the color C1

to the spectral color curve (the intersection of this line with the outer curve is the hue)

• why? because the color C1 can be represented by some

combination of white ( C ) and the spectral color Cs on the outer

curve.– if the dominant wavelength lands on the “purple line” then ...

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Color• For the colors (called non-spectral colors) in the chromaticity

diagram that lie such that when drawing a line starting at C through the color will intersect the “purple” line

– the dominant wavelength is the complement of some wavelength

• draw a line from the color C2 through C (white) to the outer

spectral curve Csp

• the intersection is the wavelength that is subtracted from the

spectral distribution of the color

– purity (saturation): is still

• the closer to white, the less pure

• the further from white, the more pure

400 440 480 520 560 600 640 680 720

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Color

• Is the Chromaticity diagram useful for determining the brightness of a color?

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Color

• Is the Chromaticity diagram useful for determining the brightness of a color?– No, the brightness (light energy) was normalized to 1– recall, Color = xX + yY + zZ – x' = x / (x+y+z)– y' = y / (x+y+z)– z' = z / (x+y+z)– Since x' + y' + z' = 1, any color can be represented by just

two of the x', y' and z'. – By normalizing based on the total light energy (brightness)

we are only now dealing with hue and purity (collectively known as Chromaticity)

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

RGB Color Model• The color gamut for RGB colors appears on the next slide.

• Color = rR + gG + bB

• r, g and b range from 0.0 to 1.0

• notice:

white's (r,g,b) = (1,1,1)

black's (r,g,b) = (0,0,0)

complementary colors are

those that add up to (1,1,1)

can anyone tell me 2?

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

RGB Color Model

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

YIQ Color Model• Graphics monitors use RGB (separate signals for R, G and B)

• NTSC television monitors use a composite signal called the YIQ model.

• Y is luminance (brightness)

• I & Q together incorporate the hue and purity (collectively chromaticity) and some luminance

• RGB can be transformed into YIQ and vice versa which means, given RGB values, you can compute the equivalent color in YIQ and vice versa.

• See section 12.5 of textbook for transforms.

• One nice feature of YIQ is that since Y is the luminance, if that's all that is captured by the television then you end up with “black & white” television (grey-scale)

• Also since the human eye responds more to luminance than color (recall the number of rods vs. cones) more bandwidth is set aside for the Y value than I & Q.

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Additive vs. Subtractive• Both RGB and YIQ color models discussed thus far are

additive models. That is, colors are produced by adding light sources. When we view a monitor or television we are looking at the light sources themselves.

• How about CIE --- is it additive?

• Since hard copy devices print colors, the colors we see are reflected from the paper (when white light hits the paper). A subtractive process is required to print something that will reflect a certain color of light on paper.

• We are not viewing the light source this time, but instead what color light is reflected off the paper when white light is shown on it.

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Additive (left), Subtractive (right)

source: wikipedia

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

CMY & CMYK Color Models• C = Cyan, M = Magenta, Y = Yellow

• white's (c,m,y) = (0,0,0)

• black's (c,m,y) = (1,1,1)

• cyan absorbs red (and reflects green and blue)

• magenta absorbs green

• yellow absorbs blue

• cyan & magenta ink combined

will reflect blue light (b/c red and green are absorbed)

• cyan & yellow ink combined

will reflect green light

• magenta & yellow ink combined

will reflect red light

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

CMY & CMYK Color Models• Transformation from RGB to CMY is simple.

[C, M, Y] T = [1, 1, 1] T - [R, G, B] T

• Transformation from CMY to RGB is:

[R, G, B] T = [1, 1, 1] T - [C, M, Y] T

• CMYK

• C = Cyan, M = Magenta, Y = Yellow, K = Black

• instead of using cyan, magenta and yellow ink all combined to make black, typically a fourth ink, black is used to produce black and grey levels

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Recap on Color Models• RGB color model is an additive model. Amounts of red,

green and blue are combined by adding light sources of these colors to produce new colors.

• CMY and CMYK are subtractive models. Amounts of cyan, magenta and yellow are combined by adding pigments of these colors to produce new colors that reflect certain wavelengths of light.

– it is subtractive because adding pigments reduce what light

is reflected, when all 3 primaries (C M and Y) are put

together then the result is no light is reflected (black).

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

HSV Color Model

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

HSV Color Model

• Hue is an angle between 0 and 360 degrees

• Saturation (purity) is one axis and Value (luminance) is another axis

• You can picture this as a circular cone if you prefer

• or even as a cylinder

• because S is considered a ratio from the V axis (0) to max 1.

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

HSV Color Model

• HSV color model is more intuitive/useful to people/artists

• Starting with the pure hue:

• Vary the saturation (add white) to get different tints

• Vary the value (add black) to get different shades

What's most important of Color theory for us in this course?

• Know the terminology – dominant wavelength, hue, brightness, luminance, purity, saturation, chromaticity, color gamut, idea of primary colors, etc.

• Know the relationship between wavelength and frequency

• Know what the CIE chromaticity digram is useful for and how

– determining:

• color gamuts, complementary colors, purity

– comparison of:

• color gamuts, purity

• Know how additive (e.g. RGB, YIQ) and subtractive color models (e.g. CMY) work to

produce new colors

• Know about more intuitive models like HSV and why they're useful

• Know that different color models can be transformed into each other by a transform matrix.

Michael Eckmann - Skidmore College - CS 376 - Spring 2007