CS101 Lecture 12: Image Compression. What You ll Learn Today

Similar documents
NUMBERS AND DATA REPRESENTATION. Introduction to Computer Engineering 2015 Spring by Euiseong Seo

Image coding and compression

Multimedia Systems Image III (Image Compression, JPEG) Mahdi Amiri April 2011 Sharif University of Technology

Quiz on Ch.2. Convert to decimal

DigiPoints Volume 1. Student Workbook. Module 8 Digital Compression

Logo & Icon. Fit Together Logo (color) Transome Logo (black and white) Quick Reference Print Specifications

MULTIMEDIA AND CODING

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Image Types Vector vs. Raster

Web graphics. Introduction

Image, video and audio coding concepts. Roadmap. Rationale. Stefan Alfredsson. (based on material by Johan Garcia)

7: Image Compression

Data Representation From 0s and 1s to images CPSC 101

Features. Sequential encoding. Progressive encoding. Hierarchical encoding. Lossless encoding using a different strategy

Publication Quality Graphics

Frequently Asked Questions about Text and Graphics

IMAGE COMPRESSION USING FOURIER TRANSFORMS

INF5063: Programming heterogeneous multi-core processors. September 17, 2010

Data Representation and Networking

Using Dreamweaver, Photoshop, and Fireworks: CS38: Graphics Production for the Web. Stanford University Continuing Studies CS 38

Introduction to Computer Science (I1100) Data Storage

Compression; Error detection & correction

"Digital Media Primer" Yue- Ling Wong, Copyright (c)2011 by Pearson EducaDon, Inc. All rights reserved.

Lecture 8 JPEG Compression (Part 3)

Repetition 1st lecture

G64PMM - Lecture 3.2. Analogue vs Digital. Analogue Media. Graphics & Still Image Representation

Final Study Guide Arts & Communications

CMPT 365 Multimedia Systems. Media Compression - Image

Digital Image Representation Image Compression

Web Design, 5 th Edition

Compression Part 2 Lossy Image Compression (JPEG) Norm Zeck

Image Coding and Compression

Wireless Communication

Compression; Error detection & correction

Lecture 5: Compression I. This Week s Schedule

VC 12/13 T16 Video Compression

IMAGE COMPRESSION. Image Compression. Why? Reducing transportation times Reducing file size. A two way event - compression and decompression

Introduction ti to JPEG

CS 335 Graphics and Multimedia. Image Compression

A COMPRESSION TECHNIQUES IN DIGITAL IMAGE PROCESSING - REVIEW

Common File Formats. Need a standard to store images Raster data Photos Synthetic renderings. Vector Graphic Illustrations Fonts

Multimedia Signals and Systems Still Image Compression - JPEG

Lesson 3 Creating and Using Graphics

This is not yellow. Image Files - Center for Graphics and Geometric Computing, Technion 2

Source coding and compression

Preview from Notesale.co.uk Page 2 of 88

1.6 Graphics Packages

Robert Matthew Buckley. Nova Southeastern University. Dr. Laszlo. MCIS625 On Line. Module 2 Graphics File Format Essay

Advanced High Graphics

Lecture 8 JPEG Compression (Part 3)

A New Compression Method Strictly for English Textual Data

CMPT 165 Graphics Part 2. Nov 3 rd, 2015

Feature-based methods for image matching

ECE 417 Guest Lecture Video Compression in MPEG-1/2/4. Min-Hsuan Tsai Apr 02, 2013

Standard File Formats

Chapter 5 Images. Presented by Thomas Powell. Slides adopted from HTML & XHTML: The Complete Reference, 4th Edition 2003 Thomas A.

Prentice Hall. Learning Microsoft PowerPoint , (Weixel et al.) Arkansas Multimedia Applications I - Curriculum Content Frameworks

Compression II: Images (JPEG)

Data and information. Image Codning and Compression. Image compression and decompression. Definitions. Images can contain three types of redundancy

IMGD The Game Development Process: File Formats

Compression. storage medium/ communications network. For the purpose of this lecture, we observe the following constraints:

Data encoding. Lauri Võsandi

Unicode. Standard Alphanumeric Formats. Unicode Version 2.1 BCD ASCII EBCDIC

255, 255, 0 0, 255, 255 XHTML:

Lossless Compression Algorithms

EDLD 5366 Digital Graphics and Web Design. Directions. Assignment 1.1

Multimedia on the Web

Bricks'n'Tiles. Tutorial Creating a brick file and texturing a medieval tower. Easy Creation of Architectural Textures.

Lecture 6: Compression II. This Week s Schedule

Lecture 6: Texturing Part II: Texture Compression and GPU Latency Hiding Mechanisms. Visual Computing Systems CMU , Fall 2014

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) Horizontal Rule Element

Lecture 12: Compression

15 Data Compression 2014/9/21. Objectives After studying this chapter, the student should be able to: 15-1 LOSSLESS COMPRESSION

Elementary Computing CSC 100. M. Cheng, Computer Science

JPEG Compression. What is JPEG?

CSE COMPUTER USE: Fundamentals Test 1 Version D

Fundamentals of Video Compression. Video Compression

Midterm Review. October 17

Lecture Coding Theory. Source Coding. Image and Video Compression. Images: Wikipedia

Forensic analysis of JPEG image compression

Index. 1. Motivation 2. Background 3. JPEG Compression The Discrete Cosine Transformation Quantization Coding 4. MPEG 5.

color bit depth dithered

Video Compression An Introduction

Vector- drawn: what is the meaning of " on the fly " in vector images? It means that computers draw the image as per instructions.

2.2: Images and Graphics Digital image representation Image formats and color models JPEG, JPEG2000 Image synthesis and graphics systems

Graphics File Formats

A Novel Image Compression Technique using Simple Arithmetic Addition

Digital Media. Daniel Fuller ITEC 2110

Multimedia Content. Web Architecture and Information Management [./] Spring 2009 INFO (CCN 42509) Contents. Erik Wilde, UC Berkeley School of

Digital Image Representation. Image Representation. Color Models

Data Representation. Types of data: Numbers Text Audio Images & Graphics Video

MEDIA RELATED FILE TYPES

GRAPHIC FILE FORMATS / SOFTWARE SELECTION / SOFTWARE COMPATIBILITY

REVIEW ON IMAGE COMPRESSION TECHNIQUES AND ADVANTAGES OF IMAGE COMPRESSION

Unit 2 Digital Information. Chapter 1 Study Guide

Operation of machine vision system

MSITA WORD LESSON 7 NOTES

Image/video compression: howto? Aline ROUMY INRIA Rennes

Computers Are Your Future Prentice-Hall, Inc.

Part 1 of 4. MARCH

Transcription:

CS101 Lecture 12: Image Compression Vector Graphics Compression Techniques Aaron Stevens (azs@bu.edu) 11 October 2012 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? 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. 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 Average download speed on 3G networks is closer to 1MB/second. http://www.cnn.com/2011/tech/mobile/02/18/att.verizon.3g.speed.wired/index.html 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. Vector Graphics Example Instructions written in Python by CS108 student (Spring 2010). File size: 29743 bytes. 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 Raster vs. Vector Graphics When would you use each? Drawings, Diagrams, Games, etc. Photography, video, etc. 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 What is the output resolution? iphone 3 has a resolution of 640 X 960 pixels. Evo has 480 X 800 pixels. Facebook pictures (in web browser) are 560 X 750 pixels. 5

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? Fewer Colors: GIF Images Graphics Interchange Format (GIF) Each image is made up of any 256 (or 16) RGB colors, but only those colors. 256 colors: 8 bits per pixel 16 colors: 4 bits per pixel 6

Fewer Colors: GIF Images 16 Color GIF 120,000 bytes 256 Color GIF 200,000 bytes Original BMP 360,000 bytes How do you fit more cars on this lot? Compress them! Data compression Reduction in the amount of space needed to store a piece of data. 7

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 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 8

Keyword Encoding Replace frequently used words with a single character 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. 9

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. 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? How could we apply keyword encoding to images? 10

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 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? 11

Run-Length Encoding Example How would you describe the colors in this image? Which letters occur most? 12

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 fewest bits. 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 13

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 Huffman Encoding Example Try it! Decode!! 1011111001010! 14

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 JPEG Images The Joint Photographic Experts Group created the standard codec in 1992. Default format on most digital cameras Compression reduces file size up to 90% with little loss in visible quality Great for life-like images the web Is JPEG compression lossy or lossless? 15

Recall: RGB Colorspace = RGB has a lot of redundant information. JPEG uses the YCbCr Colorspace Y (luminance) Cb (chroma blue) Cr (chroma red) 16

YCbCr Colorspace YCbCr separates luminance (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. JPEG Color Smoothing This image is progressively more less smoothed from left to right (lowest to highest quality). 17

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? 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) 18

Same Picture, Many Formats Original image was 2048 * 1536 pixels All others are 300 * 400 pixels 19

What You Learned Today Vector graphics vs raster graphics Factors in image file size Resolution, color depth Compression strategies Reduce colors Reduce resolution Lossless compression Lossy compression GIF, PNG, and JPEG Format Images Announcements and To Do HW06 due Tuesday 10/16 Readings: Wong ch 3, pp 66-86 (today) Wong ch 4, pp 102-117 (next week) 20

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 21