g6dpmm - lecture 4
DESCRIPTION
G6DPMM - Lecture 4. 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) - PowerPoint PPT PresentationTRANSCRIPT
School of Computer Science & Information Technology
School of Computer Science & Information Technology
G6DPMM - Lecture 4G6DPMM - Lecture 4
Graphics & Still Image RepresentationGraphics & Still Image Representation
Analogue vs DigitalAnalogue vs Digital Analogue informationAnalogue information
Continuously variable signalContinuously variable signal Physical phenomenaPhysical phenomena
Sound/light/temperature/position/pressureSound/light/temperature/position/pressure WaveformWaveform
Electromagnetic (e.g. light)Electromagnetic (e.g. light) Pressure (e.g. sound)Pressure (e.g. sound) Information conveyed by amplitude and frequencyInformation conveyed by amplitude and frequency
Digital informationDigital information Discrete valuesDiscrete values
Smoke signals / Morse code / Binary electronicSmoke signals / Morse code / Binary electronic Sampling of analogue informationSampling of analogue information Analogue to Digital Conversion (A2D) is samplingAnalogue to Digital Conversion (A2D) is sampling
Analogue MediaAnalogue Media
We see an analogue worldWe see an analogue worldAnalogue image storage technologies:Analogue image storage technologies:
Paint / Chemical film / Photocopier / VideoPaint / Chemical film / Photocopier / Video
Analogue systems all have “noise”Analogue systems all have “noise”Random variations Random variations Hence sequential copies deteriorateHence sequential copies deteriorate
Analogue media is hard to manipulate by Analogue media is hard to manipulate by computercomputerGenerally involves computer-controlled devicesGenerally involves computer-controlled devices
Digital MediaDigital Media
Digital media is very much easier to Digital media is very much easier to manipulate by softwaremanipulate by software
Digitisation is never perfectDigitisation is never perfectA2D Sampling is an approximationA2D Sampling is an approximationQuality is dependent upon the amount of sampling Quality is dependent upon the amount of sampling
donedone
High quality digital media tends to be largeHigh quality digital media tends to be largeLots of bits needed to store samples!Lots of bits needed to store samples!
Compression is a major issueCompression is a major issue
Types of Graphics
Computer graphics fall into two categories:Computer graphics fall into two categories: Vector GraphicsVector Graphics
Used for computer generated images, line Used for computer generated images, line drawings, cartoons etc.drawings, cartoons etc.
Bitmap (Raster) Graphics Bitmap (Raster) Graphics Used for photographsUsed for photographs
Vector Graphics
Mathematical definitions of linesMathematical definitions of lines ScaleableScaleable Not suitable for photographsNot suitable for photographs ExamplesExamples
PostcriptPostcript CGMCGM WMFWMF HPGLHPGL DXFDXF
Edited using “drawing” softwareEdited using “drawing” software
Bitmap Graphics
Matrix of ‘pixels’Matrix of ‘pixels’ Difficult to re-sizeDifficult to re-size Suitable for photographsSuitable for photographs
ExamplesExamples BMP (DIB)BMP (DIB) GIFGIF PCXPCX TIFFTIFF TARGATARGA JPEGJPEG PNGPNG
Edited using painting software (eg Photoshop)Edited using painting software (eg Photoshop)
Bitmap Graphics
1 1 1 0 0 00 0 01 1 1 0 0 00 0 00 1 0 0 0 00 0 01 1 1 0 0 00 0 00 1 0 1 0 00 0 10 1 0 1 0 00 0 10 1 0 1 0 00 0 10 1 0 0 0 00 0 01 0 1 0 0 00 0 0
1 1 1 0 0 00 0 0
1 0 1 0 0 00 0 01 0 1 0 0 00 0 01 0 1 0 0 00 0 0
0 0 0 0 0 00 0 0
0 0 0 0 0 00 0 0
Colour DepthBits per Pixel No. Colours
1 22 33 84 165 326 647 1288 2569 512
10 1,02411 2,04812 2,09613 8,19214 16,38415 32,76816 65,536...24 16,777,216
Colour Depth
ColourDepth
MaximumColours
DemonstrationFile
1-bit 2 38.46 Kb4-bit 16 153.72 Kb8-bit 256 308.28 Kb
16-bit 65,536 615.5 Kb24-bit 16,777,216 921.65 Kb
Colourmapping
8-bit colour depth - pixels contain a reference to a 8-bit colour depth - pixels contain a reference to a “palette” (ie 24-bit values)“palette” (ie 24-bit values)
High quality 8-bit (256 colour) imagesHigh quality 8-bit (256 colour) images 16-bit colourmapping (32,768 colours)16-bit colourmapping (32,768 colours) Reasons for colourmappingReasons for colourmapping
Hardware may require itHardware may require it Some software manipulation requires itSome software manipulation requires it Some compression techniques require itSome compression techniques require it
Optimised vs System paletteOptimised vs System palette Display Mode and Palette FlashingDisplay Mode and Palette Flashing
Vector / Bitmap Conversion
Vectors Vectors BitmapBitmap EasyEasy Perfect representation - scaling issuePerfect representation - scaling issue
Bitmap Bitmap VectorVector Much harder - Much harder - autotraceautotrace Poor qualityPoor quality Highly lossyHighly lossy
The Need for CompressionThe Need for Compression Graphics tend to be big!Graphics tend to be big! Consider the following:Consider the following:
1024x768 24-bit image1024x768 24-bit image 1024 x 768 = 786,432 pixels1024 x 768 = 786,432 pixels 786,432 x 24 bits = 18,874,368 (c. 18.4 Mb)786,432 x 24 bits = 18,874,368 (c. 18.4 Mb)
Approximately 40 images per 750 Mb CD-ROM!Approximately 40 images per 750 Mb CD-ROM!
Data compression is essentialData compression is essential
Image CompressionImage Compression
Lossless CompressionLossless Compression Decompressed image is a perfect copy of the originalDecompressed image is a perfect copy of the original Example File Format: GIFExample File Format: GIF
Lossy CompressionLossy Compression Decompressed image is an imperfect approximation Decompressed image is an imperfect approximation
of the originalof the original Example File Format: JPEGExample File Format: JPEG
Lossless AlgorithmsLossless Algorithms Run Length EncodingRun Length Encoding
Sequences of “runs” of repeated data is replaced by a single data item, and Sequences of “runs” of repeated data is replaced by a single data item, and the length of the run.the length of the run.
Used by TIFF, DIB/BMPUsed by TIFF, DIB/BMP
LZ77LZ77 Lempel-Ziv substitutional compression (1977)Lempel-Ziv substitutional compression (1977) Keeps track of a “window” of data – if repetition is seen it replaces this with Keeps track of a “window” of data – if repetition is seen it replaces this with
a reference.a reference. Many applications – including Huffman (LZH) and ZipMany applications – including Huffman (LZH) and Zip
LZW (Lempel-Ziv-Welch)LZW (Lempel-Ziv-Welch) Derived from LZ77Derived from LZ77 Developed (and patented) by Unisys – licensed for CompuserveDeveloped (and patented) by Unisys – licensed for Compuserve Used by GIFUsed by GIF
DeflateDeflate Derived from LZ77Derived from LZ77 Used by PNGUsed by PNG
Lossy AlgorithmsLossy Algorithms Common algorithms all operate on the waveformCommon algorithms all operate on the waveform Fourier TransformFourier Transform
A technique for expressing a waveform as a weighted series of A technique for expressing a waveform as a weighted series of sines and cosinessines and cosines
DCT (Discrete Cosine Transform)DCT (Discrete Cosine Transform) A type of Fourier transformA type of Fourier transform Waveform is expressed as a weighted sum of cosinesWaveform is expressed as a weighted sum of cosines Used by JPEGUsed by JPEG
WaveletsWavelets An alternative to Fourier transformAn alternative to Fourier transform Signals converted into a series of rough-edged waveletsSignals converted into a series of rough-edged wavelets Mostly used for specialised purposes (e.g. for fingerprints)Mostly used for specialised purposes (e.g. for fingerprints)
Fractal CompressionFractal Compression Fractal theoryFractal theory Not (currently) widely usedNot (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 FormatsVendor Defined FormatsOS Vendors (eg Microsoft / Apple)OS Vendors (eg Microsoft / Apple)Application Vendors (eg Adobe)Application Vendors (eg Adobe)May be open, (ie published specifications) or closed May be open, (ie published specifications) or closed
(protected by IPR)(protected by IPR)
Vendor Neutral FormatsVendor Neutral FormatsUsually defined by standards organisationsUsually defined by standards organisations
Apple Macintosh Formats
PICTPICT Very versatileVery versatile May contain bitmap and vector graphics, and May contain bitmap and vector graphics, and
metadata.metadata. May be compressed or uncompressed using May be compressed or uncompressed using
various algorithms.various algorithms. Can be ported to other platforms, but some Can be ported to other platforms, but some
features usually lost.features usually lost. Now rarely used – even on Macintosh!Now rarely used – even on Macintosh!
Windows Formats
Microsoft DIB (Device Independent Bitmap)Microsoft DIB (Device Independent Bitmap) .BMP .DIB .RLE.BMP .DIB .RLE 1, 8 or 24 bit bitmap - optional RLE compression1, 8 or 24 bit bitmap - optional RLE compression
Microsoft PAL (Palette)Microsoft PAL (Palette) Palette for 8 bit imagesPalette for 8 bit images
Microsoft RIFF Microsoft RIFF (Resource Interchange File Format)(Resource Interchange File Format) Embedded DIBEmbedded DIB Other media typesOther media types
Windows Metafiles (WMF)Windows Metafiles (WMF) Usually used for vectors, but can contain almost anything!Usually used for vectors, but can contain almost anything!
Adobe Formats
Photoshop PDFPhotoshop PDF Bitmap format (mostly)Bitmap format (mostly) UncompressedUncompressed Supports various colour modelsSupports various colour models Supports all features of Photoshop (eg layers, channels etc).Supports all features of Photoshop (eg layers, channels etc). Version issuesVersion issues
PostcriptPostcript Page description language for printersPage description language for printers Encapsulated postcript (EPF)Encapsulated postcript (EPF) Primarily used for Vectors, but can contain embedded bitmaps.Primarily used for Vectors, but can contain embedded bitmaps.
Truevision Targa
Truevision - graphics hardware & software companyTruevision - graphics hardware & software company Targa (TGA)Targa (TGA)
Bitmap (1 to 32 bits), with optional RLEBitmap (1 to 32 bits), with optional RLE Multiple images (eg different resolutions)Multiple images (eg different resolutions) MetadataMetadata Advanced features (eg alpha channels and gamma values)Advanced features (eg alpha channels and gamma values) Developer definable dataDeveloper definable data
Very widely used for storage of high quality Very widely used for storage of high quality (24 or 32 bit) images. (24 or 32 bit) images.
Aldus/Adobe TIFF
TIFF (.TIF) Tag Image File FormatTIFF (.TIF) Tag Image File Format Formerly Aldus - now maintained by Formerly Aldus - now maintained by
AdobeAdobe 24 bit bitmap format24 bit bitmap format Supports a wide range of compression Supports a wide range of compression
algorithms (including RLE, LZW, JPEG algorithms (including RLE, LZW, JPEG and many others)and many others)
Extensive metadata capability Extensive metadata capability
CompuServe GIF
8 bit LZW compressed bitmapSupports transparencySupports multiple images & animationWidely used on WWW
Licence problemsCompuServe patentUnisys policy
PNGPortable Network GraphicsDesigned to replace GIFSupports greyscale, colourmapped or
truecolour images (up to 48 bit!)Supports alpha channels and gamma
correctionLossless CRC-32 compressionNo multiple image supportNo patent problems!
JPEG
Joint Picture Expert GroupJoint Picture Expert Group Both an algorithm and a file format!Both an algorithm and a file format! Lossy Truecolour compression (DCT)Lossy Truecolour compression (DCT)