Download presentation
Presentation is loading. Please wait.
Published byByron Randall Modified over 9 years ago
1
School of Computer Science & Information Technology G6DPMM - Lecture 6 Colour Science & Colour Models
2
Colour Representation Colour is represented as a number Colour is represented as a number Indexed Colour (<24 bit) Indexed Colour (<24 bit) Each number is an index into a lookup table (palette) For example (a 2-bit palette): Each number is an index into a lookup table (palette) For example (a 2-bit palette): 0 – black 0 – black 1 – white 1 – white 2 – red 2 – red 3 – green 3 – green Implemented in hardware (obsolete) Implemented in hardware (obsolete) True colour definition True colour definition Colourmapping Colourmapping True Colour (25 bit) True Colour (25 bit) Each number represents a colour using a mathematical model known as a “colour model” Each number represents a colour using a mathematical model known as a “colour model”
3
The Physics of Colour Light is an EM wave in the “visible” part of the spectrum (400-700nm) Light is an EM wave in the “visible” part of the spectrum (400-700nm) Frequency represents colour Frequency represents colour Amplitude represents brightness Amplitude represents brightness Cosmic Rays Gamma Rays X-Rays UV Visible Light IRMicrowaves TVRadio Electricity 0.00001nm 0.001nm1nm 10nm 0.00003m 0.03m 0.3m 30m 5,500km 400nm 700nm
4
The Biology of Colour The human eye The human eye Light is focused onto the retina Light is focused onto the retina The retina contains rods and cones The retina contains rods and cones Rods Rods Very sensitive – can detect amplitude of light Very sensitive – can detect amplitude of light No mechanism for colour detection No mechanism for colour detection Cones Cones Less sensitive Less sensitive Three types – Red, Green & Blue Three types – Red, Green & Blue Each can detect the amplitude of one “primary” colour Each can detect the amplitude of one “primary” colour Additive colours Additive colours Cognition not physics! Cognition not physics! Approximately 10-20 million additive colours can be distinguished Approximately 10-20 million additive colours can be distinguished
5
Primary / Additive Colours Red Green Blue Red & Green Red & Blue Green & Blue Red, Green & Blue None Red Green Blue Yellow Purple Cyan White Black Primary Additive
6
RGB Colour Model 3 Colour Channels 3 Colour Channels RGB - 1 byte each - 0-255 RGB - 1 byte each - 0-255 Encodes 256 x 256 x 256 = 16,777,216 Colours Encodes 256 x 256 x 256 = 16,777,216 Colours True colour (24 bit colour) True colour (24 bit colour) Notation is 3 integers (often written as hex) Notation is 3 integers (often written as hex) Examples Examples 255, 255, 255 (FF FF FF) - White 255, 255, 255 (FF FF FF) - White 255, 0, 0 (FF 00 00) - Red 255, 0, 0 (FF 00 00) - Red 255, 0, 255 (FF 00 FF) - Magena 255, 0, 255 (FF 00 FF) - Magena 100, 100, 50 (64 64 32) - Olive 100, 100, 50 (64 64 32) - Olive
7
HSB Colour Model Hue, Saturation & Brightness Hue, Saturation & Brightness Hue is an angle (0-360) specifying the position on a colour wheel. Hue is an angle (0-360) specifying the position on a colour wheel. Saturation is a percentage representing the difference from a neutral grey. Saturation is a percentage representing the difference from a neutral grey. Brightness is a percentage representing the continuum from black to white. Brightness is a percentage representing the continuum from black to white. 0%100% 0%100%
8
Other Colour Models CMYK CMYK Used mostly for printing, based on cyan, magenta, yellow and black inks used for colour separation. Used mostly for printing, based on cyan, magenta, yellow and black inks used for colour separation. YIQ & YUV YIQ & YUV Used for broadcast TV, an analogue system based upon luminance, chrominance of wave phases. Used for broadcast TV, an analogue system based upon luminance, chrominance of wave phases. YCC YCC Developed by Kodak for Photo CD Developed by Kodak for Photo CD Pantone Pantone Colour “catalogue” used by printing industry. Colour “catalogue” used by printing industry.
9
Colour Management “Perceived” colour is hard to keep exactly constant. “Perceived” colour is hard to keep exactly constant. Many factors affect this Many factors affect this Colour model Colour model Monitor Monitor Ambient lighting Ambient lighting Platform (eg Macintosh is typically “brighter” than Windows) Platform (eg Macintosh is typically “brighter” than Windows) Major problem in multimedia Major problem in multimedia
10
Image Processing Processing techniques can create an illusion of colour and detail that is not really present. Processing techniques can create an illusion of colour and detail that is not really present. Dithering Dithering When reducing colour depth each pixel must be replaced with a corresponding pixel in the target palette. When reducing colour depth each pixel must be replaced with a corresponding pixel in the target palette. Antialiasing Antialiasing When resizing each pixel may be replaced by intermediate colours to avoid “pixelation” When resizing each pixel may be replaced by intermediate colours to avoid “pixelation”
11
Dithering Each pixel must be replaced with a corresponding pixel in the target palette. Each pixel must be replaced with a corresponding pixel in the target palette. Adjacent pixels are examined and intermediate colours may be used Adjacent pixels are examined and intermediate colours may be used Dithering software is built into most bitmap editing/processing software Dithering software is built into most bitmap editing/processing software Algorithms: Algorithms: Random Random Average Average Ordered Ordered Floyd-Steinberg Floyd-Steinberg
12
Random Dither Generate a random (0-255) number for each pixel Generate a random (0-255) number for each pixel If greater than the number pixel=white otherwise black If greater than the number pixel=white otherwise black Crude and “noisy”. Crude and “noisy”. Almost never used Almost never used
13
Random Dither
14
Average Dither Calculate an average pixel value Calculate an average pixel value If each pixel is above this then white, else black. If each pixel is above this then white, else black. Crude and “contrasty”. Crude and “contrasty”. Almost never used. Almost never used.
15
Average Dither
16
Ordered Dither (pattern) Divide the image into ordered cells - ie matrices. Divide the image into ordered cells - ie matrices. Uses matrix arithmetic to compare each pixel with the average “threshold”. Uses matrix arithmetic to compare each pixel with the average “threshold”. Generate a block of pixels to represent each cell. Generate a block of pixels to represent each cell. Widely used by the printing industry - rare in multimedia. Widely used by the printing industry - rare in multimedia.
17
Ordered Dither
18
Floyd-Steinberg Dither Error diffusion, diffusion, dispersion. Error diffusion, diffusion, dispersion. For each pixel the closest colour is found For each pixel the closest colour is found The difference between this and the original is the error for that pixel. The difference between this and the original is the error for that pixel. The error is then “diffused” over adjacent pixels that have not yet been processed. The error is then “diffused” over adjacent pixels that have not yet been processed. When these pixels are processed, the error is added to the newly calculated colour. When these pixels are processed, the error is added to the newly calculated colour. Widely used in multimedia. Widely used in multimedia. Many minor variants. Many minor variants.
19
Floyd-Steinberg Dither
20
Original (24-bit) Image
21
8 Colour - No Dither
22
8 Colour - Ordered Dither
23
8 Colour - Diffusion Dither
24
Antialiasing Resampling Resampling Avoids pixellation (“jaggies”) on resizing. Avoids pixellation (“jaggies”) on resizing. Creates intermediate colour pixels around edges. Creates intermediate colour pixels around edges.
25
Original Image
26
Scaled Image
27
Scaled Image (detail)
28
Scaled Image (antialiased)
29
Antialiased image - detail
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.