Transcript Colour

Colour
Digital Multimedia, 2nd edition
Nigel Chapman & Jenny Chapman
Chapter 6
This presentation © 2004, MacAvon Media Productions
6
157–158
Colour & Science
•
•
•
Require a model that relates subjective
sensation of colour to measurable phenomena
Spectral Power Distribution (SPD)
•
•
How intensity varies with wavelength
Good model, but too cumbersome to work
with in computer graphics
Tristimulus Theory
•
Any colour can be produced by mixing
different amounts of three additive
primaries
© 2004, MacAvon Media Productions
6
158–160
RGB Colour
•
Use standard red, green and blue as primaries
•
•
Cannot mix all visible colours from R, G and B
•
•
•
Actually no single agreed standard
Restricted to RGB gamut
Basis of colour reproduction in monitors
Represent any colour with three numbers (r,g,b)
•
Use as pixel's stored value in bitmapped
image
© 2004, MacAvon Media Productions
6
RGB Colour Cube
Green
Green (0,1,0)
Yellow (1,1,0)
White (1,1,1)
Cyan (0,1,1)
Black (0,0,0)
Red
Red (1,0,0)
Blue (0,0,1)
Magenta (1,0,1)
Blue
© 2004, MacAvon Media Productions
6
161
Colour Depth
•
Can choose number of bits for each of r, g and b
•
•
•
More bits per component means more colours
can be distinguished, but image files will be
larger
8 bits (1 byte) per component: 24-bit colour,
millions of colours
If r = g = b, colour is a shade of grey, so
greyscale can be represented by a single value
•
8 bits permits 256 greys
© 2004, MacAvon Media Productions
6
163–167
Indexed Colour
•
•
8-bit colour only permits 256 colours
Instead of storing (r, g, b) for each pixel, store an
index into a palette or colour lookup table (CLUT)
•
•
•
Index can be small, usually a single byte
Palette stores up to 256 (for 1-byte index) 24bit values
To determine colour of a pixel, look at the stored
value, use it to look up full 24-bit (r, g, b) value in
palette
© 2004, MacAvon Media Productions
6
167–169
Colour Palettes
•
•
Ideally choose 256 most important colours in an
image to store in its palette
When 24-bit image is reduced to indexed colour,
some colours may be missing form the palette
•
•
•
Replace missing colour by nearest, may lead to
posterization
Dither – use pattern of dots and optical mixing
Web-safe palette – 216 colours guaranteed to
reproduce accurately on all platforms and browsers
© 2004, MacAvon Media Productions
6
170–171
Complementary Colours
•
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)
© 2004, MacAvon Media Productions
6
Additive Colour Matching
•
•
Mixing different
amounts and
wavelengths of
light together
produces colours
Maxwell’s
trichromatic colour
theory
© 2004, MacAvon Media Productions
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)
© 2004, MacAvon Media Productions
6
173–176
HSV
•
•
•
•
•
•
Alternative way of specifing 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
© 2004, MacAvon Media Productions
6
The HSV Hexicone
Green
Cyan
Yellow
White
Red
Blue
Magenta
Value
Hue
Saturation
Black
© 2004, MacAvon Media Productions
6
Using HSV
•
First, select the
colour (pure hue)
which most closely
matches the
desired colour
(hue)
© 2004, MacAvon Media Productions
6
Using HSV cont.
•
•
Lighten the colour by adding white
(saturation)
Saturation indicates the degree to which
the hue differs from a neutral grey. The
values run from 0%, which is no colour
saturation, to 100%, which is the fullest
saturation of a given hue at a given
percentage of illumination.
© 2004, MacAvon Media Productions
6
Using HSV cont.
• Darken or lighten the colour
appropriately by changing the
level of illumination. Values run
as percentages; 0% appears as
black (no light), whilst 100% is
full illumination, which washes
out the colour.
© 2004, MacAvon Media Productions
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
•
Strictly use non-linearly scaled Y' and weighted
colour differences U and V or CB and CR
© 2004, MacAvon Media Productions
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 colour corrections
•
Actually quite tricky, so Photoshop also
provides specialized colour correction tools
© 2004, MacAvon Media Productions
6
183–184
Colour 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 colour
temperature)
Gamma
© 2004, MacAvon Media Productions
6
184–186
Colour Management
•
Software maps between colour spaces of
different devices
•
•
Use colour profiles of devices to perform the
mapping
•
•
e.g. scanner and monitor, designers's
monitor and customer's monitor
Store input device profile in image file
Only works if profiles are accurate, which relies
on frequent calibration
© 2004, MacAvon Media Productions
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
© 2004, MacAvon Media Productions
6
Colour
Moods and Feelings
Red
Danger, passion, energy, warmth, adventure, optimism, anger
(stimulates and promotes activities).
Pink
Love
Orange
Stability, reassurance, warmth, and is thought to aid digestion
Green
Nature, energy, calmness and restful, balance, security, stability,
growth, fruitfulness, freshness, ecology, luck, seasickness, money and
greed.
Blue
Calming and soothing; promotes intellectual thought; believed to keep
hunger at bay; loyalty, serenity, authority, protection, contemplative,
cold, relating to the sky and sea, relaxes, instills calmness and
harmony.
Yellow
Sunshine and energy, stimulates the intellect, refreshing, brightens the
mood.
Lilac
Spiritual matters - suggests the misty area between the sky and heaven,
feminine.
Purple
Creativity, fertility, joy, but also magic, evil, death and sex.
Brown
Security, stability and very practical.
Black
Death, eccentricity, drama. Not considered as a colour.
© 2004, MacAvon Media Productions
6
Background
Best colours
Worst Colours
White
Black, Blue
Cyan, Yellow
Black
Yellow, White
Blue
Red
Black
Blue, Magenta, Green
Green
Black
Cyan, Red
Blue
Red, White, Yellow
Black
Cyan
Blue, Red
Green, White, yellow
Magenta
Black, Blue
Cyan, Green
Yellow
Black, Blue, Red
Cyan, White
© 2004, MacAvon Media Productions