What You ll Learn Today

Similar documents
CS101 Lecture 19: Digital Images. John Magee 18 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CS 262 Lecture 01: Digital Images and Video. John Magee Some material copyright Jones and Bartlett

CS101 Lecture 12: Digital Images. What You ll Learn Today

Indexed Color. A browser may support only a certain number of specific colors, creating a palette from which to choose

INTRODUCTION TO COMPUTER GRAPHICS

The Strengths and Weaknesses of Different Image Compression Methods. Samuel Teare and Brady Jacobson

Chapter 9 Image Compression Standards

15110 Principles of Computing, Carnegie Mellon University

Huffman Coding For Digital Photography

15110 Principles of Computing, Carnegie Mellon University

Specific structure or arrangement of data code stored as a computer file.

Factors to Consider When Choosing a File Type

Compression and Image Formats

LECTURE 03 BITMAP IMAGE FORMATS

Fundamentals of Multimedia

Bitmap Image Formats

B.Digital graphics. Color Models. Image Data. RGB (the additive color model) CYMK (the subtractive color model)

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Graphics for Web. Desain Web Sistem Informasi PTIIK UB

Bitmap Vs Vector Graphics Web-safe Colours Image compression Web graphics formats Anti-aliasing Dithering & Banding Image issues for the Web

HTTP transaction with Graphics HTML file + two graphics files

4 Images and Graphics

4/9/2015. Simple Graphics and Image Processing. Simple Graphics. Overview of Turtle Graphics (continued) Overview of Turtle Graphics

Digital Images. Digital Images. Digital Images fall into two main categories

Digital Images: A Technical Introduction

The Need for Data Compression. Data Compression (for Images) -Compressing Graphical Data. Lossy vs Lossless compression

LECTURE 02 IMAGE AND GRAPHICS

Pooja Rani(M.tech) *, Sonal ** * M.Tech Student, ** Assistant Professor

BEST PRACTICES FOR SCANNING DOCUMENTS. By Frank Harrell

Images and Graphics. 4. Images and Graphics - Copyright Denis Hamelin - Ryerson University

Understanding Image Formats And When to Use Them

Byte = More common: 8 bits = 1 byte Abbreviation:

Raster (Bitmap) Graphic File Formats & Standards

Developing Multimedia Assets using Fireworks and Flash

UNIT 7B Data Representa1on: Images and Sound. Pixels. An image is stored in a computer as a sequence of pixels, picture elements.

WordPress Users Group Manchester, NH July 13, Preparing Images for the Web. Daryl Johnson SvenGrafik

Topics. 1. Raster vs vector graphics. 2. File formats. 3. Purpose of use. 4. Decreasing file size

Digital Imaging and Image Editing

Color, graphics and hardware Monitors and Display

Lecture #2: Digital Images

Learning Outcomes. Black and White pictures. Bitmap Graphics. COMPSCI 111/111G Digital Images and Vector Graphics

COMPSCI 111 / 111G Mastering Cyberspace: An introduction to practical computing. Digital Images Vector Graphics

Color & Compression. Robin Strand Centre for Image analysis Swedish University of Agricultural Sciences Uppsala University

Digital photo sizes and file formats

Ch. 3: Image Compression Multimedia Systems

The next table shows the suitability of each format to particular applications.

MOTION GRAPHICS BITE 3623

Computers and Imaging

Digital Imaging & Photoshop

UNIT 7C Data Representation: Images and Sound

CGT 511. Image. Image. Digital Image. 2D intensity light function z=f(x,y) defined over a square 0 x,y 1. the value of z can be:

Using Adobe Photoshop

Assistant Lecturer Sama S. Samaan

Information Hiding: Steganography & Steganalysis

Elements of Design. Basic Concepts

Guide to Computer Forensics and Investigations Third Edition. Chapter 10 Chapter 10 Recovering Graphics Files

Digital Image Processing Introduction

Glossary Unit 1: Hardware/Software & Storage Media

ITP 140 Mobile App Technologies. Images

Common File Formats. Need to store an image on disk Real photos Synthetic renderings Composed images. Desirable Features High quality.

CS Lecture 10:

Multimedia. Graphics and Image Data Representations (Part 2)

Pros and Cons for Each Type of Image Extensions

2.1. General Purpose Run Length Encoding Relative Encoding Tokanization or Pattern Substitution

TEST INFORMATION: 40 questions 50 minutes 70% minimum required to pass. Score is based on a 1000 pt system so passing will be a 700.

Image Perception & 2D Images

3. Image Formats. Figure1:Example of bitmap and Vector representation images

A raster image uses a grid of individual pixels where each pixel can be a different color or shade. Raster images are composed of pixels.

BMMB 597D - Practical Data Analysis for Life Scientists. Week 13 -Lecture 25. István Albert Huck Institutes for the Life Sciences

Introduction to Photography

CMPSC 390 Visual Computing Spring 2014 Bob Roos Review Notes Introduction and PixelMath

LECTURE VI: LOSSLESS COMPRESSION ALGORITHMS DR. OUIEM BCHIR

Lecture - 3. by Shahid Farid

*Which code? Images, Sound, Video. Computer Graphics Vocabulary

Lossy and Lossless Compression using Various Algorithms

JPEG Encoder Using Digital Image Processing

The Application of Selective Image Compression Techniques

Image Processing Computer Graphics I Lecture 20. Display Color Models Filters Dithering Image Compression

An Analytical Study on Comparison of Different Image Compression Formats

REVIEW OF IMAGE COMPRESSION TECHNIQUES FOR MULTIMEDIA IMAGES

Raster Image File Formats

Anti aliasing and Graphics Formats

Digital Image Fundamentals

Dr. Shahanawaj Ahamad. Dr. S.Ahamad, SWE-423, Unit-06

CSC 170 Introduction to Computers and Their Applications. Lecture #3 Digital Graphics and Video Basics. Bitmap Basics

Scientific Working Group on Digital Evidence

IMAGE SIZING AND RESOLUTION. MyGraphicsLab: Adobe Photoshop CS6 ACA Certification Preparation for Visual Communication

6. Graphics MULTIMEDIA & GRAPHICS 10/12/2016 CHAPTER. Graphics covers wide range of pictorial representations. Uses for computer graphics include:

A SURVEY ON DICOM IMAGE COMPRESSION AND DECOMPRESSION TECHNIQUES

Sampling Rate = Resolution Quantization Level = Color Depth = Bit Depth = Number of Colors

Applying mathematics to digital image processing using a spreadsheet

Starting a Digitization Project: Basic Requirements

Coreldraw Crash Course

NXPowerLite Technology

Subjective evaluation of image color damage based on JPEG compression

PCCLUB.ORG.UK Tuesday, 3 rd May 2005 Stuart Crump. Picture Editing, Printing & Publishing Tutorial 1 of 2

CHAPTER 3 I M A G E S

UNIT 7C Data Representation: Images and Sound Principles of Computing, Carnegie Mellon University CORTINA/GUNA

Practical Content-Adaptive Subsampling for Image and Video Compression

1. Describe how a graphic would be stored in memory using a bit-mapped graphics package.

Transcription:

CS101 Lecture 18: Image Compression Aaron Stevens 21 October 2010 Some material form Wikimedia Commons Special thanks to John Magee and his dog 1 What You ll Learn Today Review: how big are image files? How can we make image files smaller? What are the main image file formats, and how are they different from each other? What are the main techniques for compressing images? 2 1

Image File Size: HUGE! Raster/Bitmap Graphics Storage of data on a pixel-by-pixel basis Bitmap (BMP), GIF, JPEG, and PNG, for example How much data is required to represent a picture? Typical size might be 1024 by 768 pixels (~ 800,000) At 3 bytes per pixel, about 2,400,000 bytes for one picture. A 10Mpixel picture would be 30,000,000 bytes per picture. 3 Consider download times Example: A 10Mpixel picture would be 30,000,000 bytes This is 240,000,000 bits. Typical home cable modem downloads at 5 Mbits per second (5,000,000 bits per second). How long to download this picture? 240,000,000 / 5,000,000 = 48 seconds What factors make the image so big? 4 2

Describe this picture Vector Graphics describes an image by coordinates, lines, geometric shapes and colors. This image was a homework assignment by a CS108 student, Spring 2008. 5 Vector Graphics Example Instructions written in Python by CS108 student (Spring 2010). File size: 29743 bytes. 6 3

Vector Graphics Advantages: Small file sizes (instructions take much less space than sampling pixels) Easy to resize mathematically without loss of detail Disadvantages: Image shapes are not lifelike Color contrast and texturing are rigid, not lifelike Requires software to interpret the drawing instructions 7 Raster vs. Vector Graphics When would you use each? Drawings, Diagrams, Games, etc. Photography, video, etc. 8 4

Storing an image in fewer bytes What are our choices? What are reasonable tradeoffs? Raster Graphics vs. Vector Graphics? Decrease sampling rate (fewer pixels) Decrease quantization (fewer colors) Compression 9 Lower Image Resolution? Original bitmap image dimensions: 1524 * 2034 = 3,099,816 pixels 3,099,816 pixels * 3 bytes = 9,299,448 bytes How about 300 * 400 pixels? 300 * 400 pixels = 120,000 pixels 120,000 pixels * 3 bytes = 360,000 bytes A compression ratio of 0.038. What s the catch? 10 5

Fewer Colors: GIF Images Graphics Interchange Format (GIF) Each image is made up of any 256 (or 16) RGB colors, but only those colors. How does this affect quantization? 256 colors: 8 bits per pixel 16 colors: 4 bits per pixel 300 * 400 pixels 16 Colors 120,000 bytes 11 How About Fewer Colors? 16 Color GIF 120,000 bytes 256 Color GIF 200,000 bytes Original BMP 360,000 bytes 12 6

Data Compression (saving space) Data compression Reduction in the amount of space needed to store a piece of data. Data compression techniques can be: lossless, which means the data can be retrieved without any loss of the original information lossy, which means some information may be lost in the process of compaction 13 Example: Text Compression Problem: Unicode assigns 16 bits to each character in a document; uses a heck of a lot of space. We need ways to store and transmit text efficiently. Why? Common lossless compression techniques: keyword encoding run-length encoding Huffman encoding 14 7

Keyword Encoding Replace frequently used words with a single character 15 Keyword Encoding Example Given the following paragraph, We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. 16 8

Keyword Encoding Example The encoded paragraph is We hold # truths to be self-evident, $ all men are created equal, $ ~y are endowed by ~ir Creator with certain unalienable Rights, $ among # are Life, Liberty + ~ pursuit of Happiness. $ to secure # rights, Governments are instituted among Men, deriving ~ir just powers from ~ consent of ~ governed, $ whenever any Form of Government becomes destructive of # ends, it is ~ Right of ~ People to alter or to abolish it, + to institute new Government, laying its foundation on such principles + organizing its powers in such form, ^ to ~m shall seem most likely to effect ~ir Safety + Happiness. 17 Keyword Encoding Compression ratio The size of the compressed data divided by the size of the original data (0 < c.r. <= 1) What did we save? Original paragraph: 656 characters Encoded paragraph: 596 characters Characters saved: 60 characters Compression ratio: 596/656 = 0.9085 Could we use this substitution chart for all text? 18 9

Run-Length Encoding Consider a single character which is repeated over and over again in a long sequence. Replace a repeated sequence with a flag character repeated character number of repetitions Example: *n8 * is the flag character n is the repeated character 8 is the number of times n is repeated 19 Run-Length Encoding Example Original text bbbbbbbbjjjkllqqqqqq+++++ Encoded text *b8jjjkll*q6*+5 (Why isn't l encoded? J?) The compression ratio is 15/25 or.6 Encoded text *x4*p4l*k7 Original text xxxxpppplkkkkkkk This type of repetition isn t very helpful for English text; can you think of a situation where it might be helpful? 20 10

Huffman Encoding Why should the character X" and "z" take up the same number of bits as "e" or " "? Huffman codes use variable-length bit strings to represent each character. More frequently used letters have shorter strings to represent them. 21 Huffman Encoding Example ballboard would be 1010001001001010110001111011 Encoded is 28 bits vs 144 bits with Unicode; The compression ratio is 28/144 or 0.39 Try to encode roadbed 22 11

Huffman Encoding Prefix Property No character's bit string is the prefix of any other character's bit string. To decode look for match left to right, bit by bit record letter when a match is found begin next character where you left off 23 Huffman Encoding Example Try it! Decode 1011111001010 24 12

Huffman Encoding The technique for creating codes guarantees the prefix property of the codes. There is no single Huffman code -- each depends on the application. Two types of Huffman codes: general, based on use of letters in English, Spanish,. specialized, based on text itself or specific types of text 25 Lossless Compression Strategies Recall: Keyword encoding Run-length encoding Huffman encoding How can we apply these to images? 26 13

PNG Image Format Portable Network Graphics (PNG) 24-bit bitmapped color. Uses lossless compression. 2-stage compression process: 1. Filter image by adjacent pixels, record the differences 2. Use the DEFLATE algorithm (Huffman encoding scheme) 27 JPEG Images The Joint Photographic Experts Group created the standard codec in 1992, approved by ISO 10918-1 in 1994. Default format on most digital cameras Compression reduces file size up to 90% with little loss is visible quality Great for life-like images the web 28 14

Recall: The RGB Colorspace = RGB has a lot of redundant information. JPEG Uses the YCbCr Colorspace = Y is the luminance component Cb and Cr are the chroma components (blue, red) 15

JPEG and the YCbCr Colorspace JPEG separates luma (brightness) from chroma (color differences). Our eyes are more sensitive to changes in luma than to changes in chroma. JPEG thus stores a high resolution Y, and lower-resolution CbCr. Smoothing colors among adjacent pixels. 31 JPEG Color Smoothing This image is progressively more smoothed from left to right (highest to lowest quality). 32 16

JPEG Compression Convert color space from RGB to YCbCr Smooth adjacent colors in Cb/Cr Apply Huffman compression after smoothing Which part of this is lossy compression? 33 Same Picture, Many Formats Original image was 2048 * 1536 pixels All others are 300 * 400 pixels 34 17

Image Manipulation Software There are many different image manipulation software packages, e.g.: Paint Built in to windows Photoshop Commercial software Irfanview Free software Paintshop Pro Shareware/Commercial GIMP Free software 35 36 18

What You Learned Today Factors in image file size Compression strategies Reduce colors Reduce resolution Lossless compression Lossy compression GIF, PNG, and JPEG Format Images 37 Student To Dos HW07 due WED 10/27 Readings: Wong ch 3, pp 66-86 (today) Wong ch 4, pp 102-117 (next week) 38 19