G64PMM - Lecture 3.2 Graphics & Still Image Representation Analogue vs Digital Analogue information Continuously variable signal Physical phenomena Sound/light/temperature/position/pressure Waveform Electromagnetic (e.g. light) Pressure (e.g. sound) Information conveyed by amplitude and frequency Digital information Discrete values Smoke signals / Morse code / Binary electronic Sampling of analogue information Analogue to Digital Conversion (A2D) is sampling 2 Analogue Media We see an analogue orld Analogue image storage technologies: Paint / Chemical film / Photocopier / Video Analogue systems all have noise Random variations Hence sequential copies deteriorate Analogue media is hard to manipulate by computer Generally involves computer-controlled devices 3
Digital Media Digital media is very much easier to manipulate by softare Digitisation is never perfect A2D Sampling is an approximation Quality is dependent upon the amount of sampling done High quality digital media tends to be large Lots of bits needed to store samples! Compression is a major issue 4 Types of Graphics Computer graphics fall into to categories: Vector Graphics Used for computer generated images, line draings, cartoons etc. Bitmap (Raster) Graphics Used for photographs 5 Vector Graphics Mathematical definitions of lines Scaleable Not suitable for photographs Examples AI, CDR, FH, FLA, IGS CGM, ODG WMF, EMF PS, EPS, PDF SVG Edited using draing softare 6
Bitmap Graphics Matrix of pixels Difficult to re-size Suitable for photographs Examples > BMP/DIB > TIFF, TGA, XPM > PSD, PCX, PICT > GIF, PNG, JPEG, JP2 Edited using painting softare (eg Photoshop) 7 Bitmap Graphics 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 0 1 8 Colour Depth Bits per Pixel No. Colours 1 2 2 3 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1,024 11 2,048 12 2,096 13 8,192 14 16,384 15 32,768 16 65,536... 24 16,777,216 9
Colour Depth Colour Depth Maximum Colours Demonstration File 1-bit 2 38.46 Kb 4-bit 16 153.72 Kb 8-bit 256 308.28 Kb 16-bit 65,536 615.5 Kb 24-bit 16,777,216 921.65 Kb 10 Colourmapping 8-bit colour depth - pixels contain a reference to a palette (ie 24-bit values) High quality 8-bit (256 colour) images 16-bit colourmapping (65,536 colours) Optimised vs System palette Reasons for colourmapping Hardare may require it Some softare manipulation requires it Some compression techniques require it 11 Vector / Bitmap Conversion Vectors Bitmap Easy Perfect representation - scaling issue Bitmap Vector Much harder - autotrace Poor quality Highly lossy 12
The Need for Compression Graphics tend to be big! Consider the folloing: 1280 x 854 24-bit image 1280 x 854 = 1,093,120 pixels 1,093,120 x 3 bytes = 3,279,360 bytes (3.13 Mb) Approximately 240 images per 750 Mb CD-ROM! Data compression is essential 13 Image Compression Lossless Compression There is no quality loss during compression Decompressed image is a perfect copy of the original Example File Format: GIF Lossy Compression There is quality loss during compression Decompressed image is an imperfect approximation of the original Example File Format: JPEG 14 Run Length Encoding RLE (Run Length Encoding Simple lossless compression algorithm Not idely used on its on (very common used in conjunction ith other algorithms) Runs (repeated data) are replaced by the single data item and the length of the run Uncompressed bbb bbb bbb b b b b b b b b b b b RLE 11 43b4 43b4 43b4 51b5 15
Lossless Algorithms Run Length Encoding Sequences of runs of repeated data is replaced by a single data item, and the length of the run. Used by TIFF, DIB/BMP and many others LZ77 Lempel-Ziv substitutional compression (b977) Keeps track of a indo of data if repetition is seen it replaces this ith a reference. Many applications including Huffman (LZH) and Zip LZW (Lempel-Ziv-Welch) Derived from LZ77 Developed (and patented) by Unisys licensed for Compuserve Used by GIF Deflate Derived from LZ77 Used by PNG 16 Lossy Algorithms Common algorithms all operate on the aveform Fourier Transform A technique for expressing a aveform as a eighted series of sines and cosines DCT (Discrete Cosine Transform) A type of Fourier transform Waveform is expressed as a eighted sum of cosines Used by JPEG Wavelets An alternative to Fourier transform Signals converted into a series of rough-edged avelets Mostly used for specialised purposes (e.g. for fingerprints) 17 Alpha Compositing Common technique to provide partial transparency Image is combined ith background Matte needs to be stored Describes shapes of the image Distinguishes beteen parts of the image that are dran and parts that are empty Matte usually stored as alpha channel 18
Gamma Gamma correction / Gamma encoding / Gamma nonlinearity Non-linear mathematical technique for encoding information about colour (luminance and tristimulus) May be used for any electronic colour - not just digital (originally developed for CRT) Degree of shadoiness (NB that is a gross simplification!) Supported by many graphics formats 19 Image File Formats Vendor Defined Formats OS Vendors (eg Microsoft / Apple) Application Vendors (eg Adobe) May be open, (ie published specifications) or closed (protected by IPR) Vendor Neutral Formats Usually defined by standards organisations 20 Microsoft DIB Microsoft DIB (Device Independent Bitmap).BMP.DIB.RLE 1, 4, 8, 16 or 24 bit bitmap - optional RLE compression Palette information stored in file or externally (PAL file) Alpha channel (transparency) - stored externally 32-bit version integrates alpha channel, and is used internally by Windos XP - rarely used elsehere 21
GIF 8 bit LZW compressed bitmap Supports transparency (one colour in the palette may optionally be set to transparent) Supports multiple images & animation (GIF 89a) Widely used on WWW Suitable for sharp-edged images ith limited colours (e.g. line art) Patent issues (no expired) 22 PNG Portable Netork Graphics Designed to replace GIF Supports greyscale, colourmapped or truecolour images (up to 48 bit!) Supports alpha channels and gamma correction Lossless CRC-32 compression (deflation) No multiple image support No patent problems! 23 JPEG Joint Picture Expert Group (1986) JPEG standard (1992) ISO 10918-1 (1994) Both an algorithm and a file format! Lossy Truecolour compression (DCT) The most idely used format for transmitting digital photographs 24
JPEG (2) Many optional components (some of hich are rarely implemented) Encoding consists of: Colour space transformation Block splitting Donsampling DCT Quantization Entropy Coding Compression artefacts Blocky appearance caused by quantization 25 JPEG 2000 ISO 15444-1 (2000) Completely different compression algorithm (avelets) May be either lossy or lossless Aims over JPEG: Improve compression ratio Feer and subtler artefacts Improve scaleability and editability Provide better high quality images (e.g. satelite, medical, HD etc) Not idely used in multimedia (yet) Might become important for photographs in the future 26