Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour...

100
© Machiraju/Möller Fundamentals of Rendering - Image Pipeline CMPT 461/761 Image Synthesis Torsten Möller

Transcript of Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour...

Page 1: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Fundamentals of Rendering - Image Pipeline

CMPT 461/761Image Synthesis Torsten Möller

Page 2: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Reading• Chapter 23 of “Fundamentals of

Computer Graphics, Third Edition”, 3rd edition by Shirley

• Chapter 5 of “Physically Based Rendering” by Pharr&Humphreys (2nd edition)

• Chapter 12 in Foley, van Dam et al.• “Illumination and Color in Computer

Generated Imagery,” by Roy Hall.2

Page 3: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD XYZ ToneReproduction

RGB

DitherDisplay γ

Page 4: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD

Page 5: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Visible Light

5

Page 6: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

SPD• Light not a single

wavelength• Combination of

wavelengths• A spectrum, or

spectral power distribution (SPD).

Fluorescent light

Lemon skin

Page 7: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD XYZ

Page 8: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

3-Component Color

• The de facto representation of color on screen display is RGB. (additive color)

• Most printers use CMY(K), (subtractive color)

• Why?– Color spectrum can be represented by 3

basis functions?

Page 9: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Human eye and vision

• Eye is an amazing device !– Vision is even more so

• Yet, can trick it rather easily• Need to understand what is important• CG has to be tuned to perception

– Already used three receptor fact – got RGB

Page 10: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

The eye and the retina

Page 11: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Retina detectors• 3 types of color sensors - S, M, L (cones)

– Works for bright light– Peak sensitivities located at approx. 430nm,

560nm, and 610nm for "average" observer.– Roughly equivalent to

blue, green, and red sensors

Page 12: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Retina detectors• 1 type of

monochrome sensor (rods)

– Important at low light• Next level: lots of

specialized cells– Detect edges, corners,

etc.

• Sensitive to contrast– Weber’s law: DL ~ L

Page 13: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

• Contrast:

• For most intensities, contrast of .02 is just noticeable

• We’re sensitive to contrasts, not intensity!

I

I+ΔI

Just Noticeable Differences

ΔII

Page 14: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Contrast

• Inner gray boxes are the same intensity

Page 15: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Contrast sensitivity• In reality, different sensitivity for different

frequencies– Max at ~8 cycles/degree– Look at the pictures in

your book or web pictures• Loose sensitivity

in darkness• More sensitive to

achromatic changes– Try the same but red on green pattern– Practical consequence: color needs fewer bits

• Used in video coding

Page 16: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Constancies

• Ability to extract the same information under different conditions– approximately the same info, in fact

• Size constancy: object at 10m vs. 100m• Lightness constancy: dusk vs. noon• Color constancy: tungsten vs. sunlight• Not completely clear how this happens

Page 17: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Adaptation

• Partially discard “average” signal– If everything is yellowish – ignore this

• Receptors “getting tired” of the same input

• Need some time to adapt when condition change– Stepping into sunlit outside from inside

• Model “adaptation” to look more realistic– Viewing conditions for monitors might be

very different

Page 18: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Tone mapping• Real world range (physical light energy units)• Monitors cover very small part of it• Sensible conversion is needed

– Tone mapping procedure– Book describes a few methods

• Often ignored in many applications– Might calibrate Light = (1,1,1), surface = (0.5, 0.5,

0.5)– No “right” basis for light– Works because of real-world adaptation process

Page 19: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD XYZ ToneReproduction

Page 20: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

~105cd/m2~10-5 cd/m2

Tone Reproduction

~100 cd/m2~1 cd/m2

Same Visual Response ?

Real world

Monitors

Page 21: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Ranges

Page 22: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

High Dynamic Range (HDR)• The range of light in

the real world spans 10 orders of magnitude!

• A single scene’s luminance values may have as much as 4 orders of magnitude difference

• A typical CRT can only display 2 orders of magnitude

• Tone-mapping is the process of producing a good image of HDR 2002 Reinhard et al

Page 23: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Approaches• Tone Reproduction or Mapping• Mapping from image Yw to display luminance

Yd

• Use a scale factor to map pixel values

• Spatially uniform vs spatially varying?– Spatially uniform – monotonic, single factor s– Non-uniform – scale (s) varies

• Histogram methods€

Yd x,y( ) = s x,y( )Yw x,y( )

Page 24: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller24The Tetons and the Snake River (1942) - Ansel Adams

Page 25: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Zone System• Used by Ansel Adams. Utilizes measured

luminance to produce a good final print• Zone: an approximate luminance level. There

are 11 print zones• Middle-grey: Subjective middle brightness

region of the scene, typically map to zone V• Key: Subjective lightness or darkness of a

scene

2002 Reinhard et al

Page 26: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Zone System

• Measure the luminance on a surface perceived as middle-gray - map to zone V

• If dynamic range < 9 zones then full range can be captured in print

• All light outside these zones is mapped to either white (zone X) or black (zone 0)

• Otherwise withhold or add light in development to lighten or darken the final print

Page 27: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Examples - Zone Mapping

2002 Reinhard et al

Page 28: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Examples - Zone Mapping

2002 Reinhard et al

Page 29: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Running Example

12 Zones 2002 Reinhard et al

Page 30: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Scaling Factor

• Which scaling factor to use?– Photographic– Maximum-to-white– Contrast based– High-contrast operator

• What neighborhood to base it on?– Global– Local - uniform– Local - adaptive

Page 31: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Yd (x,y) = s ⋅Yw (x,y) =aYwa ⋅Yw (x,y)

Photographic Scaling• In a normal-key image middle-gray maps

to a key value a = .18 suggesting the function:

• Ya is the adaptation luminance (some kind of average)

Page 32: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Photographic Maps

2002 Reinhard et al

Page 33: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Maximum-to-White Scaling• Map brightest pixel to max luminance of

display

• Problems for very well lit scenes• Nothing about the

visual system€

s x,y( ) = sm =max Yd( )max Yw( )

2004 Pharr & Humphrey

Page 34: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Maximum-to-White Maps

s=10sm

2004 Pharr & Humphrey

2004Pharr & Humphrey 2004 Pharr & Humphrey

s=100sm

Page 35: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Contrast Based• Our eye is sensitive to contrast, NOT to total

luminance• Idea: scale contrast in image to contrast on the

screen (or print etc).• What is the smallest noticeable difference of

luminance in the image? Map this to the smallest noticeable difference on the display.

• JND – Just noticable difference• ΔY(Ya) is the JND for adaptation luminance

Ya

Page 36: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Contrast Based• Mapping:• How to measure ΔY(Ya)?

• Hence:

ΔY Y a( ) = 0.0594 1.219 + Y a( )0.4( )

2.5

sc =1.219 + Yd

a( )0.4

1.219 + Ywa( )0.4

⎜ ⎜

⎟ ⎟

2.5€

ΔY Yda( ) = s ⋅ ΔY Yw

a( )

s=100sm s=sc

2004 Pharr & Humphrey 2004 Pharr & Humphrey

Page 37: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

High Contrast Operator• TVI – threshold vs. intensity• JND(Ya) very similar to TVI(Ya)• Perceptual capacity = given a particular Ya,

how many JND’s are covered by a particular luminance range:

• Using

• We can• Hence, we can use this mapping

Y1 −Y2TVI Y a( )

C Y( ) =dY

TVI Y( )0

Y∫

Y1 −Y2TVI Y a( )

= C Y1( ) −C Y2( )

Yd x,y( ) =Ydmax C Yw( ) −C Ymin( )

C Ymax( ) −C Ymin( )

Page 38: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Adaptation Luminance

• Use log-average luminance to approximate adaptation luminance

• Use log since small bright areas do not influence unduly

Ywa = exp 1

Nlog δ +Yw (x,y)( )

x,y∑

⎝ ⎜ ⎜

⎠ ⎟ ⎟

Page 39: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Global vs. Local• Global - Contrast Operator• Local - Uniform radius for adaptation

luminance– Radius with roughly 10 pixels in the

example– Halo artifacts

global sc

2004 Pharr & Humphrey 2004 Pharr & Humphrey

local sc

Page 40: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Spatially Non-Uniform Maps

• Idea - enlarge neighborhood until the contrast in this local neighborhood becomes to large

• B(x,y) = blurred version of image• Local contrast lc(x,y):

• With blur radius r

lcr x,y( ) =Br x,y( ) − B2r x,y( )

Br x,y( )

Page 41: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Size of Local Neighborhood

2002 Reinhard et al

Page 42: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Size of Local Neighborhood

2002 Reinhard et al

Page 43: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Spatially Non-Uniform Maps• Find largest r, such that • Now we pick• This in combination with the high-

contrast operator:€

lcr x,y( ) < ε

Y a x,y( ) = Br x,y( )

2004 Pharr & Humphrey

Page 44: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Neighborhood Sizes

• Small radius - black

• lc for r=1.5 pixel

Page 45: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Ad-hoc approach

• Scale factor s independent on (x,y), but dependent on Y– Bring everything within range– Leave dark areas alone

• In other words– Should be a curve from 0..1– Asymptote at 1– Derivative of 1 at 0

Page 46: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Ad-hoc approach

• Simple example

Yd x,y( ) = s x,y( ) ⋅Yw x,y( ) =1

1+Yw x,y( )Yw x,y( )

Page 47: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Global Operator Results

8 Zones 7 Zones2002 Reinhard et al2002 Reinhard et al

Page 48: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Global Operator Results

12 Zones 2002 Reinhard et al

Page 49: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Global Operator Results

15 Zones

2002 Reinhard et al

Page 50: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Ad-hoc approach• Control burn out of high luminance –

global operator (Ywhite is the smallest luminance mapped to pure white)

Yd x,y( ) = s x,y( ) ⋅Yw x,y( ) =1+

Yw x,y( )Ywhite2

1+Yw x,y( )Yw x,y( )

Page 51: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Controlled Burn-out is OK

No detail expected when looking into the sun (sunspots)

2002 Reinhard et al

Page 52: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Local Adaptation

• Need a properly chosen neighborhood• Dodging-and-burning is applied to

regions bounded by large contrasts€

Yd x,y( ) = s x,y( ) ⋅Yw x,y( ) =1

1+ Br x,y( )Yw x,y( )

Page 53: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Local Operator Results

15 Zones

Light bulb visible Small halo

around lamp shade

Text on book visible2002 Reinhard et al

Page 54: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Automatic Dodging-and-Burning

• Details recovered by using dodging-and-burning

2002 Reinhard et al

Page 55: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Durand et al. Reinhard et al.

Comparison

Page 56: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Durand et al. Reinhard et al.

Comparison

Page 57: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD XYZ ToneReproduction

RGB

Page 58: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Colour Systems• Response:• Detector response is linear

– Scaled input -> scaled response– response(L1+L2) = response(L1)+response(L2)

• Choose three basis lights L1, L2, L3– Record responses to them– Can compute response to any linear combination– Tristimulus theory of light

• Most color systems are just a different choice of basis lights

– Could have “RGB” lights as a basis

Page 59: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Colour Systems

• Our perception registers:– Hue– Saturation– Lightness or brightness

• Artists often specify colours in terms of– Tint– Shade– Tone

Page 60: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Tristimulus Response• Given spectral power distribution S(λ)

• Given S1, S2: if the X, Y, and Z responses are the same then they are metamers wrt to the sensor

Page 61: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CIE Standard

• CIE: International Commission on Illumination (Comission Internationale de l’Eclairage).

• Human perception based standard (1931), established with color matching experiment

• Standard observer: a composite of a group of 15 to 20 people

Page 62: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CIE Color Matching Experiment

• Basis for industrial color standards and “pointwise” color models

Page 63: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CIE Experiment

© Bill Freeman

Page 64: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CIE Experiment Result

• Three pure light sources: R = 700 nm, G = 546 nm, B = 438 nm.

• r, g, b can be negative

Page 65: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CIE Experiment

© Bill Freeman

Page 66: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CIE Color Space• 3 hypothetical light sources,

X, Y, and Z, which yield positive matching curves

• Use linear combinations of real lights (e.g. –R, G-2R,B+R)

– One of the lights is grey and has no hue

– Two of the lights have zero luminance and provide hue

• Y: roughly corresponds to luminous efficiency characteristic of human eye

Page 67: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CIE tristimulus values

• Particular way of choosing basis lights– Gives rise to a standard !!!

• Gives X, Y, Z colour values– Y corresponds to achromatic (no colour)

channel• Chromaticity values:

– x=X/(X+Y+Z); y=Y/(X+Y+Z)– Typically use x,y,Y

Page 68: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller x, y: hue or chromatic part

Chromaticity• Normalize XYZ by

dividing by luminance

• Project onto X+Y+Z=1

• Doesn’t represent all visible colors, since luminous energy is not represented

Page 69: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Chromaticity

Page 70: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Color Gamut

• area of colors that a physical device can represent

• hence - some colors can't be represented on an RGB screen

Page 71: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Color Gamut

Page 72: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Color Gamut

• no triangle can lie within the horseshoe and cover the whole area

Page 73: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

RGB <-> XYZ

• Just a change of basis• Need detailed monitor information to do

this right– Used in high quality settings (movie

industry, lighting design, publishing)• Normalized (lazy) way:

– (1,1,1) in RGB <-> (1,1,1) in XYZ– matrices exist

XYZ

⎢ ⎢ ⎢

⎥ ⎥ ⎥

=

0.5149 .3244 .16070.2654 .6704 .06420.0248 .1248 .8504

⎢ ⎢ ⎢

⎥ ⎥ ⎥

RGB

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 74: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

The RGB Cube

• RGB color space is perceptually non-linear

• Dealing with > 1.0 and < 0 !• RGB space is a subset of the

colors human can perceive• Con: what is ‘bloody red’

in RGB?

Page 75: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Other colour spaces• CMY(K) – used in printing• LMS – sensor response• HSV – popular for artists• Lab, UVW, YUV, YCrCb, Luv, • Opponent color space – relates to brain input:

– R+G+B(achromatic); R+G-B(yellow-blue); R-G(red-green)

• All can be converted to/from each other– There are whole reference books on the subject

Page 76: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Differences in Color Spaces

• What is the use? For display, editing, computation, compression, …?

• Several key (very often conflicting) features may be sought after:– Additive (RGB) or subtractive (CMYK)– Separation of luminance and chromaticity– Equal distance between colors are equally

perceivable (Lab)

Page 77: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

CMY(K): printing• Cyan, Magenta, Yellow (Black) –

CMY(K)• A subtractive color modeldye color absorbs reflects

Cyan red blue and green

Magenta green blue and red

yellow blue red and green

Black all none

Page 78: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

RGB and CMY

• Converting between RGB and CMY

CMY

⎢ ⎢ ⎢

⎥ ⎥ ⎥

=

111

⎢ ⎢ ⎢

⎥ ⎥ ⎥

RGB

⎢ ⎢ ⎢

⎥ ⎥ ⎥

CMYK

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

=

max(R,G,B)max(R,G,B)max(R,G,B)

1

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

RGB

max(R,G,B)

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

Page 79: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

RGB and CMY

Page 80: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Primary Colors

Page 81: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Page 82: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Secondary Colors

Page 83: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Tertiary Colors

Page 84: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

HSV

Page 85: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

HSV

Page 86: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

HSV

• This colour model is based on polar coordinates, not Cartesian coordinates.

• HSV is a non-linearly transformed (skewed) version of RGB cube– Hue: quantity that distinguishes colour

family, say red from yellow, green from blue– Saturation (Chroma): colour intensity

(strong to weak). Intensity of distinctive hue, or degree of colour sensation from that of white or grey

– Value (luminance): light colour or dark colour

Page 87: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

HSV Hexcone

• Intuitive interface to color

Page 88: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Munsell Atlas

Courtesy Gretag-Macbeth 88

Page 89: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Interactive Munsell Tool

• From www.munsell.com

Courtesy of Maureen Stone

89

Page 90: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Luv and UVW

• A color model for which, a unit change in luminance and chrominance are uniformly perceptible

• Chrominance is defined as the difference between a color and a reference white at the same luminance.

• Luv is derived from UVW and Lab, with all components guaranteed to be positive

90

Page 91: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Yuv and YCrCb: digital video• Initially, for PAL analog video, it is now also

used in CCIR 601 standard for digital video • Y (luminance) is the CIE Y primary.

Y = 0.299R + 0.587G + 0.114B • It can be represented by U and V -- the color

differences. U = B – Y; V = R - Y

• YCrCb is a scaled and shifted version of YUV and used in JPEG and MPEG (all components are positive)

Cb = (B - Y) / 1.772 + 0.5; Cr = (R - Y) / 1.402 + 0.5

Page 92: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Examples (RGB, HSV, Luv)

Page 93: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD XYZ ToneReproduction

RGB

γ

Page 94: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Colour Matching on Monitors

• Use CIE XYZ space as the standard

• Use a simple linear conversion

• Color matching on printer is more difficult, approximation is needed (CMYK)

xyz

⎢ ⎢ ⎢

⎥ ⎥ ⎥

=

XR XG XB

YR YG YBZR ZG ZB

⎢ ⎢ ⎢

⎥ ⎥ ⎥

RGB

⎢ ⎢ ⎢

⎥ ⎥ ⎥

= MC

C2 = M2−1M1C1

Page 95: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Gamma Correction

• displayed intensity = aᵞ• ɣ is dependent on the monitor• clever way to compute ɣ:• 0.5 = aᵞ ⟶ ɣ = ln 0.5 / ln a

95(c) Peter Shirley

Page 96: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Gamma correction

96Wikipedia - http://en.wikipedia.org/wiki/Gamma_correction

Page 97: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD XYZ ToneReproduction

RGB

Dither γ

Page 98: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Half-toning

• If we cannot display enough intensities? reduce spatial resolution and increase intensity resolution by allowing our eyes to perform spatial integration

• example is halftoning– approximate 5 intensity levels with the

following 2x2 patterns.

Page 99: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Dithering

• maintain the same spatial resolution• diffuse the error between the ideal

intensity and the closest available intensity to neighbouring pixels below and to the right

• try different scan orders to "better" diffuse the errors

• e.g. Floyed-Steinberg:

Page 100: Fundamentals of Rendering - Image Pipelinevda.univie.ac.at/.../04_imagingPipeline.pdf · Colour Systems • Response: • Detector response is linear – Scaled input -> scaled response

© Machiraju/Möller

Image Pipeline

SPD XYZ ToneReproduction

RGB

DitherDisplay γ