1 / 30

SI23 Introduction to Computer Graphics

SI23 Introduction to Computer Graphics Lecture 2 - Images Graphics Programming 3D Graphics URL VRML viewer 2D vector graphics surfaces Image Display URL SVG Viewer lines, areas URL GIMP viewing, shading graphics algorithms colour interaction Course Outline OpenGL API

emily
Télécharger la présentation

SI23 Introduction to Computer Graphics

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.

E N D

Presentation Transcript


  1. SI23Introduction to Computer Graphics Lecture 2 - Images

  2. Graphics Programming 3D Graphics URL VRML viewer 2D vector graphics surfaces Image Display URL SVG Viewer lines, areas URL GIMP viewing, shading graphics algorithms colour interaction Course Outline OpenGL API animation

  3. Image Display URL Course Outline – Images and Colour • Image creation, manipulation and display • Colour GIMP colour

  4. Graphics Display Hardware -Cathode Ray Tube Basic technology for workstation screens is the cathode ray tube phosphor coated screen heated cathode electron beam focus deflection plates Beam scans across screen in series of lines - 60 times per second

  5. blue green red metal mask Colour Raster Scan Display • Colour CRT Colour composed as combination of RED, GREEN, BLUE

  6. Today most colour displays have 24bit frame buffers or pixmaps. So each pixel has a 24bit colour value associated with it - 8 bits for R,G,B. 0 1 1 1 0 1 1 01101101 11011001 10011100 red gun green gun blue gun Colour Frame Buffers

  7. Colour Look Up Table (CLUT)Colour Palette To save on memory costs, some displays use a look-up table … 8-bit frame buffer 1 0 1 0 0 1 1 1 Pixel value (=167) . . . . . . . . 167 24-bit colour table 11001100 10110110 11011100 . . . . . . . . red green blue Pixel value acts as an index into the look up table. This allows 256 (=28) on-screen colours from a palette of 16.7 million

  8. Gamma Correction • For CRT displays, brightness is not a linear function of the drive signal • Instead it is related by: Brightness = (Signal)g • Typical value for g is 2.2 • Thus displays will provide ‘gamma correction’ of the red, green and blue signals to give the expected uniform effect Note: assumes signal in range [0,1]

  9. Homework • How does colour work for LCD displays??

  10. We can generate images in a variety of ways… … and we can subsequently process them in order to … The GIMP will help us do many of these things Fill in the answers! Images

  11. Large number of formats have emerged over the years Why? Which are in common use? Use a couple of test pictures Image Formats

  12. Silicon Graphics RGB Format • File begins with a header which has the following information: • xsize, ysize - dimensions of image • zsize : 1 for 8-bit (colour index); 3 for 24-bit colour • colour map flag: indicates image or colour map • The rest of the file contains the data • for 8-bit, each pixel represented as 1 byte, so there are ysize scan lines, each of xsize bytes • for colour, three single images (for R, G, B) are stored, one after the other.

  13. The picture of Bank’s Peninsula is 2472 by 1704 pixels as RGB image it is 12 Mbytes The diagram with the square is 256 by 256 pixels As RGB image it is 193k bytes Image Sizes

  14. Compression - RLE Consider the triangle on right. Suppose 0 represents black and 1 represents white. The image file will look like, for each scan line: 000000000000111111111111110000000000 It would be more efficient to store as ‘runs’ of pixel values: 12*0,14*1,10*0 This is known as Run Length Encoding (RLE) and is an option in the RGB image file specification.

  15. The NZ photo reduces from 12 Mbytes to 9.5 with RLE compression Is this what you’d expect? The square reduces from 193k to 13k with RLE compression Is this what you’d expect? RLE Compression

  16. Image Formats • RGB is one of a large number of image formats • MS Windows bitmap for PC applications (BMP format) • GIF, JPEG, PNG are widely used across different platforms • RLE is just one of a number of compression techniques - different formats use different compression methods

  17. Image Formats - GIF • GIF (Graphics Interchange Format) • probably the most common image format • developed by CompuServe Inc • 8 bit colour indices point to entries in a colour table of size 256 • thus in uncompressed form, we have header comprising colour table, followed by rows of data, one byte per pixel • rows stored as 0,8,16,..; 4,12,20,..; 2,6,10,..; 1,3,5,... this interlacing gives progressive image display • 24 bit colour images not supported • Animated GIFs a very useful feature (used with care)

  18. LZW Compression • GIF uses the LZW (Lempel-Ziv-Welch) compression technique which has been subject of frequent legal battles -UNISYS and CompuServe claim to have patented it (so not supported fully in Windows GIMP) • Dictionary-based • frequently occurring patterns of data are identified and given code words which are shorter than the original pattern • For normal images, typically better than RLE; not good on noisy images (neither is RLE) • For file size comparison, see PNG later

  19. PNG = Portable Network Graphics Created as a successor to GIF, free of legal restrictions Defined as a Web standard by W3C .. And better than GIFs! Key features: Transparency Gamma correction Text Interlacing Filtering Compression Image Formats - PNG

  20. Transparency Alpha channel in addition to RGB Gamma Correction Store the gamma value at creation Correct at display time Can you work out the correction formula? PNG Features

  21. Text Why would it be useful to associate text with an image? Interlacing 2d interlacing 7 passes (Adam7) Why is this useful? PNG Features

  22. Filtering Simple operator to promote good compression Eg sub filter replaces pixel values on scan line, with differences from predecessor Compression Uses LZ77 approach (recall from SI11) Plus Huffman encoding (also from SI11) Used in gzip PNG Features Encoding is: interlace, filter, compress

  23. NZ photo does not compress particularly well Uncompressed 12 MB RLE 9.5 MB PNG 4 MB Square compresses outstandingly well Uncompressed 193 kB RLE 13 kB PNG 1 kB Example

  24. Image Formats - JPEG File Interchange Format (JFIF) • Developed as an international standard interchange format using a compression method developed by Joint Photographic Experts Group (JPEG) • Supports 24 bit colour, or greyscale – but not palette • Copes with noisy data, so can handle scanned images

  25. JPEG Compression • Discrete Cosine Transform (DCT) applied to 8x8 subblocks of image • DCT transforms data values to a new set of 64 data items (in a frequency space) • ordered in importance (1st value represents average over subblock, etc, values at end represent high frequency, ie noise) • ‘safe’ to discard these noise terms and store only the early terms from the DCT

  26. JPEG Compression • Resulting values are then compressed using Huffman encoding • Free of any legal problems • Known as lossy compression, because we cannot recreate exact original image (cf RLE and LZW which are lossless)

  27. JPEG Quality Control • JPEG allows user to tune the quality of encoding by a ‘quality setting’ • corresponds to ignoring values in the DCT • Q-factor from 0 to 100 (100 = high quality) • Suggested technique: • encode using Q factor of 75%, decode and redisplay • if defects seen, increase Q and re-encode • if acceptable, decrease Q until just acceptable

  28. For the NZ photograph, we have outstanding compression Uncompressed 12MB RLE 9.5MB JPEG 339kB Example

  29. Image Transfer across WWW- Summary • GIF format still predominates  • lossless, 8-bit palette-based, LZW compression, legal status in doubt, supported by all browsers • PNG • lossless, 8-bit palette or 24 bit colour, non-patented compression, transparency, gamma correction, 2d interlacing, filtering • JPEG • lossy, 24-bit, non-patented compression • Choice: • PNG for synthetic images • JPEG for photographic images

  30. Reading More • The source of PNG information • http://www.w3.org/Graphics/PNG/ • Test your browser support for PNG transparency • http://trific.ath.cx/web/png/ • What is difference between GIF87a and GIF89a?

More Related