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