digital multimedia, 2nd edition nigel chapman & jenny chapman chapter 6 this presentation ©...
TRANSCRIPT
Digital Multimedia, 2nd editionNigel Chapman & Jenny Chapman
Chapter 6
This presentation © 2004, MacAvon Media Productions
Colour
© 2004, MacAvon Media Productions
6
• 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
Colour & Science
157–158
© 2004, MacAvon Media Productions
6
• Use standard red, green and blue as primaries
• Actually no single agreed standard
• Cannot mix all visible colours from R, G and B
• 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
RGB Colour
158–160
© 2004, MacAvon Media Productions
6
• 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
Colour Depth
161
© 2004, MacAvon Media Productions
6
• 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) 24-bit 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
Indexed Colour
163–167
© 2004, MacAvon Media Productions
6
• 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
Colour Palettes
167–169
© 2004, MacAvon Media Productions
6
• 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)
Complementary Colours
170–171
© 2004, MacAvon Media Productions
6
• 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)
CMYK Colour
172–173
© 2004, MacAvon Media Productions
6
• 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
HSV
173–176
© 2004, MacAvon Media Productions
6
• 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
YUV
176–177
© 2004, MacAvon Media Productions
6
• 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
Channels
179–183
© 2004, MacAvon Media Productions
6
• 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
Colour Profiles
183–184
© 2004, MacAvon Media Productions
6
• Software maps between colour spaces of different devices
• e.g. scanner and monitor, designers's monitor and customer's monitor
• Use colour 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
Colour Management
184–186
© 2004, MacAvon Media Productions
6
• '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
sRGB
187