Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
School of Computer Science & Information Technology G6DPMM - Lecture 4 Graphics & Still Image Representation Analogue vs Digital Analogue information Continuously variable signal Physical phenomena Waveform Sound/light/temperature/position/pressure 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 Analogue Media We see an analogue world 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 Digital Media Digital media is very much easier to manipulate by software 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 Types of Graphics Computer graphics fall into two categories: Vector Graphics Used for computer generated images, line drawings, cartoons etc. Bitmap (Raster) Graphics Used for photographs Vector Graphics Mathematical definitions of lines Scaleable Not suitable for photographs Examples Postcript CGM WMF HPGL DXF Edited using “drawing” software Bitmap Graphics Matrix of ‘pixels’ Difficult to re-size Suitable for photographs Examples BMP (DIB) GIF PCX TIFF TARGA JPEG PNG Edited using painting software (eg Photoshop) Bitmap Graphics 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Colour Depth Bits per Pixel No. Colours 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... 24 2 3 8 16 32 64 128 256 512 1,024 2,048 2,096 8,192 16,384 32,768 65,536 16,777,216 Colour Depth Colour Depth 1-bit 4-bit 8-bit 16-bit 24-bit Maximum Colours 2 16 256 65,536 16,777,216 Demonstration File 38.46 Kb 153.72 Kb 308.28 Kb 615.5 Kb 921.65 Kb 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 (32,768 colours) Reasons for colourmapping Hardware may require it Some software manipulation requires it Some compression techniques require it Optimised vs System palette Display Mode and Palette Flashing Vector / Bitmap Conversion Vectors Bitmap Easy Perfect representation - scaling issue Bitmap Vector Much harder - autotrace Poor quality Highly lossy The Need for Compression Graphics tend to be big! Consider the following: 1024x768 24-bit image 1024 x 768 = 786,432 pixels 786,432 x 24 bits = 18,874,368 (c. 18.4 Mb) Approximately 40 images per 750 Mb CD-ROM! Data compression is essential Image Compression Lossless Compression Decompressed image is a perfect copy of the original Example File Format: GIF Lossy Compression Decompressed image is an imperfect approximation of the original Example File Format: JPEG Lossless Algorithms Run Length Encoding LZ77 Lempel-Ziv substitutional compression (1977) Keeps track of a “window” of data – if repetition is seen it replaces this with a reference. Many applications – including Huffman (LZH) and Zip LZW (Lempel-Ziv-Welch) Sequences of “runs” of repeated data is replaced by a single data item, and the length of the run. Used by TIFF, DIB/BMP Derived from LZ77 Developed (and patented) by Unisys – licensed for Compuserve Used by GIF Deflate Derived from LZ77 Used by PNG Lossy Algorithms Common algorithms all operate on the waveform Fourier Transform DCT (Discrete Cosine Transform) A type of Fourier transform Waveform is expressed as a weighted sum of cosines Used by JPEG Wavelets A technique for expressing a waveform as a weighted series of sines and cosines An alternative to Fourier transform Signals converted into a series of rough-edged wavelets Mostly used for specialised purposes (e.g. for fingerprints) Fractal Compression Fractal theory Not (currently) widely used JPEG Compression Original Image - 285 K JPEG Compression 50% Compression - 15 K JPEG Compression 70% Compression - 10.8 K JPEG Compression 90% Compression - 6.9 K JPEG Compression 95% Compression - 5.3 K JPEG Compression 99% Compression - 2.6 K 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 Apple Macintosh Formats PICT Very versatile May contain bitmap and vector graphics, and metadata. May be compressed or uncompressed using various algorithms. Can be ported to other platforms, but some features usually lost. Now rarely used – even on Macintosh! Windows Formats Microsoft DIB (Device Independent Bitmap) .BMP .DIB .RLE 1, 8 or 24 bit bitmap - optional RLE compression Microsoft PAL (Palette) Palette for 8 bit images Microsoft RIFF (Resource Interchange File Format) Embedded DIB Other media types Windows Metafiles (WMF) Usually used for vectors, but can contain almost anything! Adobe Formats Photoshop PDF Bitmap format (mostly) Uncompressed Supports various colour models Supports all features of Photoshop (eg layers, channels etc). Version issues Postcript Page description language for printers Encapsulated postcript (EPF) Primarily used for Vectors, but can contain embedded bitmaps. Truevision Targa Truevision - graphics hardware & software company Targa (TGA) Bitmap (1 to 32 bits), with optional RLE Multiple images (eg different resolutions) Metadata Advanced features (eg alpha channels and gamma values) Developer definable data Very widely used for storage of high quality (24 or 32 bit) images. Aldus/Adobe TIFF TIFF (.TIF) Tag Image File Format Formerly Aldus - now maintained by Adobe 24 bit bitmap format Supports a wide range of compression algorithms (including RLE, LZW, JPEG and many others) Extensive metadata capability CompuServe GIF 8 bit LZW compressed bitmap Supports transparency Supports multiple images & animation Widely used on WWW Licence problems CompuServe patent Unisys policy PNG Portable Network 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 No multiple image support No patent problems! JPEG Joint Picture Expert Group Both an algorithm and a file format! Lossy Truecolour compression (DCT)