1 / 44

Advanced Computer Graphics: Colour

Advanced Computer Graphics: Colour James Gain Department of Computer Science University of Cape Town jgain@cs.uct.ac.za Objectives To describe the human visual system and our perception of colour To introduce the physics of colour To cover a range of colour models and their relative merits

Download Presentation

Advanced Computer Graphics: Colour

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.


Presentation Transcript

  1. Advanced Computer Graphics:Colour James Gain Department of Computer ScienceUniversity of Cape Town jgain@cs.uct.ac.za Advanced Computer GraphicsCollaborative Visual Computing Laboratory

  2. Objectives • To describe the human visual system and our perception of colour • To introduce the physics of colour • To cover a range of colour models and their relative merits Advanced Computer Graphics

  3. What is Colour? • physical description: • a spectra of wavelengths. • psychological perception: • a stimulus sent from the optic system to the brain. • computer description: • different sets of bases and coordinates, depending on the type of display and application. • Problem: • How do we ensure that the different representations create the same visual effect? Advanced Computer Graphics

  4. Sight • Arguably our principle modality. • An area of considerable research and development. • Components: • Wetware: The human visual system. • Hardware: Visual display systems (e.g. computer monitor). • Software: Rendering of 3D scenes (e.g. PSC). • Perceptual Terms: • Hue: Distinguishes among colours such as red, green, purple and yellow. • Saturation: Refers to how far a colour is from a grey of equal intensity. (How intense is the hue) • Brightness: the perceived intensity of a self-luminating object. (How much light is emitted). Alternatively, lightness refers to intensity from a reflecting object. Advanced Computer Graphics

  5. Human Visual System • The lens of the eye forms an inverted image of the world on the back surface (retina) of the eye. • Cones: • 150000 per square millimeter in the fovea. • High resolution, colour. • Rods: • Lower resolution • monochromatic. • Peripheral vision: so we keep the high-res region in context and avoid being hit by passing branches. • Information is passed to the visual cortex (which performs extremely complex processing). Advanced Computer Graphics

  6. Visual Cortex: Tristimulus Reality? • Types of Cones: • Low: 560 nm red ? • Medium: 530 nm green ? • High: 420 nm blue ? • Signal to brain: • L - M ®red-green • H - (L+M) ®blue-yellow • L + M ®red+green» overall luminance • Red/Green colour blindness means no signal L – M signal. Advanced Computer Graphics

  7. Hardware: The Ultimate Display • Ivan Sutherland’s “Ultimate Display” [1965] postulated a display which produced images indistinguishable from reality. • Requirements of ultimate Head Mounted Display (HMD): • Viewing distance: 10cm • Human visual acuity: 1’ ( ) of visual arc on average 5” ( ) in the best-case • Field of View (FOV): Horizontal = 200 deg Vertical = 100 deg • Update Rate: 60Hz • Must also match other aspects of Human Visual System. • Required Flat Screen Resolution: • 1’ visual acuity requires 12000x6000 pixels • 5” visual acuity requires 144000x72000 pixels Advanced Computer Graphics

  8. Saturation Tints Tones Brightness Greys Shades Artists’ Perception of Colour • Artists mix white and black with pure colours • Tint = Pure colour + white • Shade = Pure colour + black • Tone = Pure colour + black + white White Pure Colour Black Advanced Computer Graphics

  9. Physics of Colour: Colorimetry • Light is electromagnetic energy in the 400-760nm wavelength • Perceived as a spectrum of colours: violet, indigo, blue, green, yellow, orange, red. • Light energy, present simultaneously at each wavelength, is represented as a spectral energy distribution, P(l). • Physics vs. Perception: • Hue = dominant wavelength • Saturation = excitation purity • Brightness (self-luminous objects), lightness (reflecting objects) = luminance (amount of light) • Pure colour: a single highly dominant wavelength Advanced Computer Graphics

  10. Spectral Distribution • One colour = one spectral energy distribution Energy P(l) Wavelength l 400 nm Violet 760 nm Red Advanced Computer Graphics

  11. Hue, Saturation and Brightness Energy P(l) Dominant wavelength e2 Brightness = area under the curve Saturation e1 l 400 nm Violet 760 nm Red Hue Advanced Computer Graphics

  12. Retina Response • Fraction of light absorbed by the three types of cones (R, G, B): 0.2 G R Light Absorbed B l 0.0 760 nm Red 400 nm Violet Advanced Computer Graphics

  13. Retina Luminous Efficiency • The eye’s response to light of constant luminence with varying dominant wavelength. • Peak sensitivity (ability to resolve detail) is to yellow-green light. 100 Relative Sensitivity l 0 760 nm Red 400 nm Violet Yellow-Green 550 nm Advanced Computer Graphics

  14. Colour Definition • Define a colour by its spectral distribution: • Large memory requirements to create an adequate sampling of the distribution. • Dominant wavelength (hue) is not always immediately obvious. • Metamers: Different spectra with the same colour response. No uniqueness. • Need for simpler bases: • describing all colours • with a unique set of coordinates Advanced Computer Graphics

  15. Metamers Same orange-like colour Energy P(l) l 400 nm Violet 760 nm Red Advanced Computer Graphics

  16. Primary Colours • Since our cones are sensitive to red, green and blue why not describe all colours as a linear combination of these primaries? • Below: value of three primaries required to match all wavelengths. Values V(l) l 400 nm Violet 760 nm Red Advanced Computer Graphics

  17. CIÉ Model • Commission Internationale de l’Éclairage defined a colour model in 1931. • Three standard primary functions: • X, Y, Z • Defines all visible colours • Only positive coefficients • Y = retina luminance perception function • X and Y = chromaticity Advanced Computer Graphics

  18. CIÉ Basis Functions Values V(l) Z Y X l 400 nm Violet 760 nm Red Advanced Computer Graphics

  19. CIÉ Chromaticity Diagram • Project the CIÉ plane of constant luminosity (X+Y+Z=1) onto the X-Y plane. Advanced Computer Graphics

  20. CIÉ Chromaticity Diagram • Colours on the horseshoe perimeter are fully saturated. • Complementary colours are those that can be mixed to produce white light. • Diagram factors out luminence so brown (orange-red at very low level luminance relative to its surrounding area) does not appear. • Dominant wavelength can be calculated by drawing a line from white through the colour and intersecting the perimeter. • Nonspectral colours (purple and magenta) intersecting the base of the horseshoe do not have a dominant wavelength. Advanced Computer Graphics

  21. CIÉ Chromaticity Perimeter y Green 520 540 560 Yellow 500 580 White 600 Cyan Red 480 700 Purple x 400 Advanced Computer Graphics

  22. CIÉ Chromaticity Attributes y Green B Yellow A D Cyan Red C E F G Purple x Advanced Computer Graphics

  23. Mixing Colours y Green • All colours on a straight line segment can be created by mixing the endpoints. • Similarly, colours within a triangle are a combination of the endpoints. Yellow I Cyan Red J K Purple x Advanced Computer Graphics

  24. CIÉ Colour Gamuts Monitor RGB Gamut Film Gamut x Advanced Computer Graphics

  25. Beyond CIÉ 1931 • Equal steps across the Chromaticity Diagram do not equate to equal perceptual distances. • CIÉ 1976: perceptually uniform • LUV: • L for lightness • U and V for chromaticity Advanced Computer Graphics

  26. Computer description • Display device based colour-spaces: • RGB (monitor) • CMYK (printer) • YIQ (television) • Perception based colour-spaces: • HSV (user interaction) • Need to: • Correct for different display characteristics • Convert between colour models Advanced Computer Graphics

  27. RGB Colour Model • Red, Green and Blue primaries. • Most well known colour space. • Used (internally) in every monitor. • Additive (colours added to a black background) • Black = (0,0,0), White = (1,1,1) Advanced Computer Graphics

  28. CMY Colour Model • Cyan, Magenta and Yellow Primaries • Used (internally) in colour printers • Substractive (colours subtracted from a white background) • Black = (1,1,1), White = (0,0,0) • Complementary to RGB: Advanced Computer Graphics

  29. The RGB/CMY cube Blue Cyan Magenta White Black Green Red Yellow Advanced Computer Graphics

  30. CMYK Colour Model • CMYK (Cyan, Magenta, Yellow, blacK) • Mostly for printer use • Saves on coloured inks by using black ink as far as possible • As a result dark colours dry more quickly • Converting from CMY to CMYK • Black is used instead of equal amounts of C, M, Y. • K = min(C,M,Y) • C = C – K • M = M – K • Y = Y – K Advanced Computer Graphics

  31. YIQ, YUV Colour Model • U.S. commercial television broadcasting • Recoding of RGB for: • Transmission efficiency • Backward compatibility with Black and White TV (drop I and Q) • YIQ = NTSC • Y is luminance • I and Q are chromaticity • YUV=PAL • Exploits visual system: • More sensitive to changes in luminance (Y) than chromaticity (I and Q) -> more bandwidth for Y • Objects covering a small field of view produce limited colour sensation -> either I or Q can have lower bandwidth. • Ratio Y:I:Q = 4:1.5:0.6 Advanced Computer Graphics

  32. HSV Colour Model • Hue, Saturation and Value Primaries • Cylindrical co-ordinate system: • Hue (H = 0 – 360 deg) rotation • Saturation (S = 0.0 – 1.0) radius • Value (V = 0.0 – 1.0) height • User oriented and based on the intuitive appeal of artist’s colours (hue, tint, shade). • Represented by a hexcone. Advanced Computer Graphics

  33. The HSV cone Green Yellow Cyan Red White Blue Magenta Black Advanced Computer Graphics

  34. HSV conversion • Flatten RGB cube along the diagonal to create HSV hexagon • There is an algorithm for converting in both directions • RGB to HSV: max = max(r,g,b); min = min(r,g,b)[ V = max S = (max-min)/max H = more complicated Green Yellow Red Cyan Blue Magenta Advanced Computer Graphics

  35. HSV properties • Interpolating Colour: • Linear interpolation of the same two colours in RGB, CMY, YIQ and CIE all produce the same result. Appropriate for Gouraud shading • Not true for HSV. But interpolating between colours while keeping Hue, Saturation or Value constant is obviously easier. • Effective for visualization: • change saturation, at constant hue • change hue, at constant saturation (maps) Advanced Computer Graphics

  36. Colour Fidelity • Problem: ensure that colours look the same when changing display devices • Sample the RGB phosphors with colorimeters • Sometimes device description are available from manufacturers • Convert to XYZ space: • From XYZ to device dependent RGB uses the inverse. Advanced Computer Graphics

  37. Intensity Perception • Human perception of intensity is logarithmic: • Sensitive to ratios of intensity levels not absolute steps • I = 0.1 to 0.11 has same as I = 0.5 to 0.55 • Cause of Mach-Banding • Need more steps at lower intensity levels • CRT intensity related to voltage: • Constants depend on the particular CRT • Gamma Correction: lookup table which correct for both hardware and perceptual issues with intensity. • Can lead to strange effects if forgotten. Transferring a picture between monitors with different gamma values causes problems. Advanced Computer Graphics

  38. Displaying colours • Colour ability of the display • measured in bits: • 1 bit=2 levels, 8 bits=256 levels • bits per colour primitive: • 24 bits=256 levels for each of R,G,B • Depends on the medium: • TV Screen: 30 dpi, 8bits colour • Computer Screen: 70-100 dpi, 24 bits colour • Laser Printer: 300-2400 dpi, 3 bits colour (8 colours) • Photo: 800 dpi, 36 bits colour Advanced Computer Graphics

  39. Gaining colour resolution • Sometimes, this colour resolution is not enough. How do we display more colours? • Basic idea: • Sacrifice some of the spatial resolution for intensity resolution • Halftoning and dithering • Halftoning: • For top quality printers • Discs of size varying inversely with Intensity • Pattern angle (called screen angle) • Halftone resolution (different from spatial resolution) • 60-80 dpi for newspapers, 120-200 dpi for books Advanced Computer Graphics

  40. Dithering • Used if halftoning is not possible (because of the wrong type of printer or use of a monitor) • Dither patterns • Group of n*n pixels = n*n+1 intensity levels • 2x2 example: • Matrix notation: 0 1 2 3 4 Advanced Computer Graphics

  41. Dithering Properties • For level i, display pixels with v < i • Requirement of matrix: • Don’t produce visual artefacts (e.g. straight lines) • Growth sequence (minimizes differences in nearby areas) • dispersed dots for CRT, clustered dots for printers Advanced Computer Graphics

  42. Dithering: the next step • One image pixel = 4 or 9 printer pixels • What if I want one image pixel = one printer pixel? • Use modulo: • i = x modulo n • j = y modulo n • Light the pixel if value (i, j) in dithering matrix is smaller than I(x, y) • Error diffusion: • There is an error at each pixel • Dithering pattern is sometimes visible • Floyd-Steinberg error diffusion spreads the error to neighbouring pixels Advanced Computer Graphics

  43. Using Colours in CG • Meaningless colours reduce performance by up to one third. • Design colour schemes first in monochrome. This does not prejudice the colour blind. • Aesthetics: Use even perceptual steps between colours, complementary colours, even intensities. • Using colours for codes can have unintended meanings. • Perception: • Colour of area is affected by surroundings. • Colours seem to advance (red) or recede (blue). • Blocks of the same size in different colours appear to have different sizes (red > green) Advanced Computer Graphics

  44. Conclusion • Several ways to represent colours. Each one suited to a specific task: • Conversion between colour models is often required: • for colour fidelity (convert to CIE and back to device-space) • for displaying the image in a different medium • But remember colour is heavily influenced by our perceptions! Advanced Computer Graphics

More Related