Anda di halaman 1dari 43

Color

Rawesak Tanawongsuwan
ccrtw@mahidol.ac.th
6 157–158

Color Science
• Light is an electromagnetic wave. Its color is
characterized by the wavelength content of the light.

• (a) Laser light consists of a single wavelength:


e.g., a ruby laser produces a bright, scarlet-red
beam

• (b) Most light sources produce contributions over


many wavelengths

• (c) However, humans cannot detect all light, just


contributions that fall in the “visible wavelengths”

• (d) Short wavelengths produce a blue sensation,


long wavelengths produce a red one
6

Color Science

• The wavelength of visible light lies roughly between 400 nm


and 700 nm

• Spectrophotometer: device used to measure visible light,


by reflecting light from a diffraction grating (a ruled surface)
that spreads out the different wavelengths
6

Spectral power distribution (SPD)


• The physical wavelength composition of light is expressed in a
SPD curve (show how intensity varies with wavelength)

• The visible range of wavelengths from 400-700 nm could be


divided into 31 bands, each 10 nm wide  (e.g. can represent
light/color using 31 numbers for each pixel in an image)

• Good model, but too cumbersome to work with in computer


graphics (it’s better if we can use only 3 numbers like R,G,B
instead)

E(λ)
6

SPDs of Various Light Sources

http://www.lamptech.co.uk/Documents/SO2%20Spectral.htm
6

Human Vision
• We might learn from biology that our retina consists of an
array of rods and three kinds of cones.

• The rods come into play when light levels are low and
produce an image in shades of gray

• For higher light levels, the cones each produce a signal.


Because of their differing pigments, the three kinds of
cones are most sensitive to red (R), green (G), and blue
(B) light.

• It seems likely that the brain makes use of differences R-G,


G-B, and B-R, as well as combining all of R, G, and B into a
high-light-level achromatic channel.

• Tristimulus Theory: any color can be produced by mixing


different amounts of 3 additive primaries
6 163–167

Color-Matching Functions
• A technique evolved in psychology
for matching a combination of basic
R, G, and B lights to a given shade

• The particular set of three basic


lights used in an experiment are
called the set of color primaries
(they used color primaries with
peaks at 440, 545, 580 nm)

• To match a given color, a subject is


asked to separately adjust the
brightness of the three primaries
using a set of controls until the
resulting spot of light most closely
matches the desired color
6 163–167

Color-Matching Curves

• The amounts of R,G,B the subject selects to match each


single-wavelength light forms the color-matching curves

• The international standards body for color, the


Commission Internationale de L’Eclairage (CIE) in
1931 performed such experiment to gather data
6

Color-Matching Curves

• Negative values?

• Indicates that some color cannot be reproduced by


a linear combination of primaries

• For such colors, one or more of the primary lights


has to be shifted from one side of the black
partition to the other so they illuminate the
sample to be matched instead of the white screen
6

CIE Chromaticity Diagram


• Since the r(λ) color-matching curve has a negative lobe,
a set of fictitious primaries were devised that lead to
color-matching functions with only positives values.

• The curves are referred to as the color-matching


functions.

• A 3x3 matrix used to transform r, g,b to


x (λ ), y (λ ), z (λ )
6

CIE Chromaticity Diagram


• CIE defined three standard primaries, called
X, Y, and Z, to replace red, green, and blue in
the color matching process

X = ∫ E ( λ ) x ( λ ) dλ

Y = ∫ E (λ ) y (λ )dλ

Z = ∫ E ( λ ) z ( λ ) dλ
6

CIE Chromaticity Diagram


• 3D data is difficult to visualize, so
the CIE devised a 2D diagram
based on the values of (X,Y,Z)
triples

• We can define chromaticity which


project each tristimulus vector
(X,Y,Z) onto the plane connecting
points (1,0,0), (0,1,0), and
(0,0,1)

x=X
(X +Y + Z)
y=Y
(X +Y + Z)
http://hyperphysics.phy-astr.gsu.edu/hbase/vision/cie.html

z = 1− x − y
6

CIE Chromaticity Diagram

http://hyperphysics.phy-astr.gsu.edu/hbase/vision/cie.html
6

Color models in images


6

RGB color model


• Basis of color reproduction in
monitors

• Use standard red, green and


blue as primaries  Actually no
single agreed standard

• Cannot mix all visible colors


from R, G and B (Restricted to
RGB gamut)

• Represent any color with three


numbers (r,g,b)  Use as
pixel's stored value in
bitmapped image
http://hyperphysics.phy-astr.gsu.edu/hbase/vision/cie.html
6

More Color Coordinate Schemes


• Schemes include:

• CMY – Cyan ©, Magenta (M) and Yellow (Y) color model

• HSL – Hue, Saturation and Lightness

• HSV – Hue, Saturation and Value

• HIS – Hue, Saturation and Intensity

• HCI – C=Chroma

• HVC – V=Value

• HSD – D=Darkness
6

Subtractive Color: CMY color model


• So far, we have effectively been dealing only with additive
color. Namely, when two light beams impinge on a target,
their colors add; when two phosphors on a CRT screen are
turned on, their colors add

• But for ink deposited on paper, the opposite situation


holds: yellow ink subtracts blue from white illumination,
but reflects red and green; it appears yellow

White light
White light Blue light

Cyan light
Layer of magenta ink  absorption of red light

Layer of cyan ink on surface  absorption of red light Layer of cyan ink on surface  absorption of red light
6 170–171

Subtractive Color: CMY color model

• Subtract additive primary from white


gives its complement
• Equivalently, add other two additive
primaries
• C = G+B = W-R
• M = R+B = W-G
• Y = R+G = W-B
• Cyan, magenta and yellow are
subtractive primary colours (mixing
ink/paint)
6

RGB and CMY color cubes


6

Transformation from RGB to CMY

 C  1  R 
 M  = 1 − G 
    
 Y  1  B 

 R  1  C 
G  = 1 −  M 
    
 B  1  Y 
6 172–173

CMYK Colour
• Real inks do not correspond to ideal
subtractive primaries

• Combining three inks for black is undesirable

• Printers use four process colours, cyan,


magenta, yellow and black

• CMYK gamut is not the same as RGB

• Implications for using images prepared for


print (CMYK) on the Web (RGB)
6

Undercolor Removal: CMYK


System
• Undercolor removal:. Sharper and cheaper
printer colors: calculate that part of the CMY
mix that would be black, remove it from the
color proportions, and add it back as real black

• The new specification of inks is thus:

K ≡ min{C , M , Y }
C  C − K 
M  ⇒ M − K 
   
 Y   Y − K 
http://www.cdman.com/graphics/color/gamut.html
6

Think of one color…


• Breaking a color down into components reflects the
way monitors, scanners, and color printer work

• As a way of describing color, it does not


correspond to the way in which we experience
colors in the world

+
6

Hue
• The particular wavelength at which most of
the energy of the light is concentrated
• Dominant wavelength
• Identified by names (less scientific) such as
red orange, yellow, green blue, …
6

Saturation
• Color’s purity
• Pure hue can be diluted by mixing it with white
• dominant hue remains the same, but other
hues in white makes the color paler
6

Brightness
• Measure of how light or dark the color is
• Color’s appearance is modified by the
intensity of the light
• less light makes it appear darker
6

A color wheel

http://www.colorguardfloors.com/guardzone/download/ColorWheel.jpg
6 173–176

HSV
• Alternative way of specifying colour

• Hue (roughly, dominant wavelength)

• Saturation (purity)

• Value (brightness)

• Model HSV as a cylinder: H angle, S distance


from axis, V distance along axis

• Basis of popular style of colour picker


6

HSV

http://en.wikipedia.org/wiki/Image:HSV_cylinder.jpg
6

Color models in video


• Video Color Transforms

• Largely derive from older analog methods of coding color for


TV. Luminance is separated from color information

• For example, a matrix transform method called YIQ is used


to transmit TV signals in North America and Japan

• This coding also makes its way into VHS video tape coding
in these countries since video tape technologies also use YIQ

• In Europe, video tape uses the PAL or SECAM codings, which


are based on TV that uses a matrix transform called YUV

• Finally, digital video mostly uses a matrix transform called


YCbCr that is closely related to YUV
6 176–177

YUV
• Can be useful to separate brightness and colour
information, especially for video

• Luminance Y not simply related to R, G and B because


eye is more sensitive to some colours

• Y = 0.2125R + 0.7145G + 0.0721B

• Can store Y plus two colour difference values B-Y and


R-Y

• Chrominance refers to the difference between a color


and a reference white at the same luminance  use
color difference U,V: U = B–Y, V = R-Y
6

YUV decomposition of color image

Y '  0.299 0.587 0.144   R 


U  = − 0.299 − 0.587 0.886  G 
    
V   0.701 − 0.587 − 0.114  B 
6

YIQ Color Model

• YIQ is used in NTSC color TV broadcasting

• Gray pixels generate zero (I;Q) chrominance


signal

• I and Q are a rotated version of U and V

• The matrix transform

Y  0.299 0.587 0.144   R 


 I  = 0.596 − 0.275 − 0.321 G 
    
Q  0.212 − 0.528 0.311   B 
6

I and Q components of
color image
6

YCbCr Color Model


• The Rec. 601 standard for digital video uses another color space,
YCbCr, often written YCbCr which closely related to the YUV
transform

• YUV is changed by scaling such that Cb is U, but with a coefficient of


0.5 multiplying B’. In some software systems, Cb and Cr are also
shifted such that values are between 0 and 1

• YCbCr is used in JPEG image and MPEG video compressions

• This makes the equations as follows:

• Cb = ((B’ – Y’)/1.772) + 0.5 Cr = ((R’ – Y’)/1.402) + 0.5


 Y '   0.299 0.587 0.144   R '  0 
Cb  = − 0.169 − 0.331 0 . 5  G ' + 0.5
      
Cr   0.5 − 0.419 − 0.081  B ' 0.5
6

Device-independent color space


• RGB and CMYK are device-dependent color models

• different monitors provide different R,G,B primaries

• Different sorts of ink and paper produce different cyan,


magenta, yellow, and even black

• (255, 127, 255) values for RGB can not be predicted on a


particular monitor

• CIE has tried to produce an objective, device-independent


definition of colors

• CIE XYZ color space is device-independent, but awkward to


work with and impossible to realize with physical light sources.

• Also XYZ along with RGB, CMYK, HSV, … suffer from not being
perceptually uniform
6

Perceptually uniform model


• The same change in one of the values produced the same
change in appearance, no matter what the original value was

• Changing the R component from 1 to 11 would produce the


same increase in perceived redness as changing it from 101
to 111

• Weber’s Law: Equally-perceived dierences are proportional


to magnitude. The more there is of a quantity, the more
change there must be to perceive a dierence

• A rule of thumb for this phenomenon states that equally-


perceived changes must be relative | changes are about
equally perceived if the ratio of the change is the same,
whether for dark or bright lights, etc
6

L*a*b* and L*u*v* color spaces


• CIE tried to produce a color model that was perceptually
uniform. They proposed two models L*a*b* and L*u*v*

• L* component is a uniform luminance and the other two


components are color differences

• L*a*b* specifies color in a way that combines


subtractively, as in CMYK

• Often used in the pre-press industry as a standard


specification of color difference values for printing

• L*u*v* works additively, as in RGB

• Suitable for monitors and scanners


6

CIELAB model

• These device-independent color models are used as a


reference point for systems that try to guarantee that
the colors we specify in our images will look the same
on any output devices
6 179–183

Channels
• Instead of considering 24-bit image as array of
3-byte pixels, consider it as 3 arrays of 1-byte
pixels

• i.e. 3 greyscale images, k/a channels, one


for each of R, G and B

• Can adjust levels &c of each channel


independently to make color corrections

• Actually quite tricky, so Photoshop also


provides specialized color correction tools
6 183–184

Color Profiles
• Different monitors, scanners, &c have different
colour characteristics – different colours correspond
to same numerical value
• Vary with model, age, temperature,…
• Captured by (ICC) colour profile, which includes
values for:
• R, G and B chromaticities
• White point (may be given as color temperature)
• Gamma
6 184–186

Color Management
• Software maps between color spaces of
different devices

• e.g. scanner and monitor, designers's


monitor and customer's monitor

• Use color profiles of devices to perform the


mapping

• Store input device profile in image file

• Only works if profiles are accurate, which relies


on frequent calibration
6 187

sRGB
• 'Standard' RGB colour space

• Chromaticities, white point and gamma


supposed to be typical of monitors

• W3C standard

• Convert image colours to sRGB

• Should still display well on most monitors


without using colour management software

• Alternatively can colour manage without


storing input device profile

Anda mungkin juga menyukai