JPEG Image compression: Transformation, Quantization and Encoding Catherine Holloway Honours Linear Algebra, April 2008

Similar documents
Video-Conferencing System

Image Compression through DCT and Huffman Coding Technique

Comparison of different image compression formats. ECE 533 Project Report Paula Aguilera

A JPEG Decoder Implementation in C Chris Tralie ELE 201 Fall 2007

JPEG Image Compression by Using DCT

Conceptual Framework Strategies for Image Compression: A Review

Data Storage 3.1. Foundations of Computer Science Cengage Learning

1) Write the following as an algebraic expression using x as the variable: Triple a number subtracted from the number

Introduction to image coding

Solving Systems of Linear Equations Using Matrices

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Digital Image Fundamentals. Selim Aksoy Department of Computer Engineering Bilkent University

Steganography Based Seaport Security Communication System

CHAPTER 2 LITERATURE REVIEW

JPEG compression of monochrome 2D-barcode images using DCT coefficient distributions

MMGD0203 Multimedia Design MMGD0203 MULTIMEDIA DESIGN. Chapter 3 Graphics and Animations

Reading.. IMAGE COMPRESSION- I IMAGE COMPRESSION. Image compression. Data Redundancy. Lossy vs Lossless Compression. Chapter 8.

CM0340 SOLNS. Do not turn this page over until instructed to do so by the Senior Invigilator.

Question 2: How do you solve a matrix equation using the matrix inverse?

Introduction to Medical Image Compression Using Wavelet Transform

0.8 Rational Expressions and Equations

Math Common Core Sampler Test

Structures for Data Compression Responsible persons: Claudia Dolci, Dante Salvini, Michael Schrattner, Robert Weibel

FACTORING QUADRATICS through 8.1.4

Compression techniques

Implementation of ASIC For High Resolution Image Compression In Jpeg Format

Figure 1: Relation between codec, data containers and compression algorithms.

A Robust and Lossless Information Embedding in Image Based on DCT and Scrambling Algorithms

CHAPTER 3: DIGITAL IMAGING IN DIAGNOSTIC RADIOLOGY. 3.1 Basic Concepts of Digital Imaging

Object Recognition and Template Matching

ADVANCED APPLICATIONS OF ELECTRICAL ENGINEERING

Statistical Modeling of Huffman Tables Coding

How to Send Video Images Through Internet

MATH BOOK OF PROBLEMS SERIES. New from Pearson Custom Publishing!

Arithmetic and Algebra of Matrices

Chapter 3 Graphics and Image Data Representations

Video Coding Basics. Yao Wang Polytechnic University, Brooklyn, NY11201

Computational Foundations of Cognitive Science

DCT-JPEG Image Coding Based on GPU

How To Understand And Solve A Linear Programming Problem

MEP Y9 Practice Book A

Linear Equations in One Variable

A comprehensive survey on various ETC techniques for secure Data transmission

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system

Study and Implementation of Video Compression Standards (H.264/AVC and Dirac)

Math 1050 Khan Academy Extra Credit Algebra Assignment

Mathematics Online Instructional Materials Correlation to the 2009 Algebra I Standards of Learning and Curriculum Framework

Calibration Best Practices

Admin stuff. 4 Image Pyramids. Spatial Domain. Projects. Fourier domain 2/26/2008. Fourier as a change of basis

International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Vol. XXXIV-5/W10

UNIVERSITY OF CALICUT

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Prentice Hall Mathematics: Algebra Correlated to: Utah Core Curriculum for Math, Intermediate Algebra (Secondary)

Mathematics Pre-Test Sample Questions A. { 11, 7} B. { 7,0,7} C. { 7, 7} D. { 11, 11}

NSM100 Introduction to Algebra Chapter 5 Notes Factoring

Automated Image Forgery Detection through Classification of JPEG Ghosts

Understanding HD: Frame Rates, Color & Compression

Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks

Module 8 VIDEO CODING STANDARDS. Version 2 ECE IIT, Kharagpur

Sachin Dhawan Deptt. of ECE, UIET, Kurukshetra University, Kurukshetra, Haryana, India

DIGITAL IMAGE PROCESSING AND ANALYSIS

MassArt Studio Foundation: Visual Language Digital Media Cookbook, Fall 2013

Florida Algebra 1 End-of-Course Assessment Item Bank, Polk County School District

How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

Guide to Using the Ti-nspire for Methods - The simple and the overcomplicated Version 1.5

Motion JPEG Video Authentication based on Quantization Matrix Watermarking: Application in Robotics

Fireworks CS4 Tutorial Part 1: Intro

1.3 Algebraic Expressions

Lectures 6&7: Image Enhancement

Automatic Detection of Emergency Vehicles for Hearing Impaired Drivers

A Concrete Introduction. to the Abstract Concepts. of Integers and Algebra using Algebra Tiles

Part 2: Analysis of Relationship Between Two Variables

Khalid Sayood and Martin C. Rost Department of Electrical Engineering University of Nebraska

ENG4BF3 Medical Image Processing. Image Visualization

3. Solve the equation containing only one variable for that variable.

Algebra I Credit Recovery

Expression. Variable Equation Polynomial Monomial Add. Area. Volume Surface Space Length Width. Probability. Chance Random Likely Possibility Odds

Chapter 7 - Roots, Radicals, and Complex Numbers

Determine If An Equation Represents a Function

KEANSBURG SCHOOL DISTRICT KEANSBURG HIGH SCHOOL Mathematics Department. HSPA 10 Curriculum. September 2007

MATH 423 Linear Algebra II Lecture 38: Generalized eigenvectors. Jordan canonical form (continued).

Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

1. Introduction to image processing

MBA Jump Start Program

POLYNOMIAL FUNCTIONS

Computer Networks and Internets, 5e Chapter 6 Information Sources and Signals. Introduction

Algebraic expressions are a combination of numbers and variables. Here are examples of some basic algebraic expressions.

Students Currently in Algebra 2 Maine East Math Placement Exam Review Problems

Algebra I Vocabulary Cards

A NEW LOSSLESS METHOD OF IMAGE COMPRESSION AND DECOMPRESSION USING HUFFMAN CODING TECHNIQUES

X On record with the USOE.

H.264/MPEG-4 AVC Video Compression Tutorial

FUNDAMENTALS of INFORMATION THEORY and CODING DESIGN

SECTION 0.6: POLYNOMIAL, RATIONAL, AND ALGEBRAIC EXPRESSIONS

How To Understand Algebraic Equations

Get the Best Digital Images Possible. What s it all about anyway?

AIP Factoring Practice/Help

Digital Audio and Video Data

Classes of multimedia Applications

Transcription:

Holloway JPEG Image Compression - 1 JPEG Image compression: Transformation, Quantization and Encoding Catherine Holloway Honours Linear Algebra, April 2008 Abstract: Discrete cosine transformation, quantization and entropy encoding are all steps in the compression of the JPEG image format. In order to investigate these steps, a sample DCT was calculated, an image was quantized using several different quantization matrices, and the file sizes of a JPEG with and without Huffman Coding were compared. INTRODUCTION: The JPEG has been the most common image format on the web for many years. Standardized in 1994, it is capable of retaining high quality with small file sizes. Its ability to pack so much visual information into a small file is largely due to taking advantage of the capabilities, or rather limitations, of the human eye. Linear algebra is the perfect form of math for computing. JPEG images are a collection of numbers in arrays corresponding to different colour channels. The data comprising a digital image is like a matrix in that it has discrete values, and unlike calculus, which is continuous. Three steps are used in JPEG compression: a discrete cosine transformation, quantization, and entropy encoding (Huffman Coding). DISCRETE COSINE TRANSFORMATION: The Discrete Cosine Transformation (hereafter referred to as DCT) is like a discrete Fourier transform in that it turns the spatial domain of an image into its frequency domain. The spatial domain contains numbers that reflect the intensity of every channel at a given pixel, while the frequency domain contains the change of intensity from one pixel to the next. The frequency domain usually contains less information than the spatial domain. In general, the pictures we take of our world have few extreme changes in intensity, and are

Holloway JPEG Image Compression - 2 made up of gradients that are easy to predict. The DCT represents the frequency domain as a combination of cosine functions in the x and y directions, like the Fourier transform. The equation for the DCT between spatial domain and frequency domain is: Where C(u,v) is the coefficient of the DCT matrix at point (u,v), f(x,y) is the spatial domain value at a coordinate (x,y) of the JPEG image array, N is the width and height of the image, and a(u), a(v) are normalization constants. Doing the above calculation for an entire 2000*800 pixel JPEG image would take a lot of resources. Instead, the JPEG image is first subdivided into 8*8 blocks. Figure 1: a magnification of an 8*8 pixel block used in DCT Each pixel contains 24 binary bits that represent the colour of the pixel, 8 bits are used for each of the three channels (red, blue, green). Since 2^8 = 256, each value within the 8*8 square ranges from 0 to 256. In order to apply the DCT, these values must be centred on zero. Do to so, 128 (2^8/2) is subtracted from each value.

Holloway JPEG Image Compression - 3 Dividing the image into 8*8 blocks provides another advantage to applying DCT. With set values of N, i &j, a standard DCT coefficient matrix can be constructed, simplifying the transformation to matrix multiplication, where B, the frequency domain matrix, is equal to CAC t, where C is the DCT coefficient matrix and A is the 8*8 frequency domain. Figure 2 is a sample calculation of the frequency domain using Maple.

Holloway JPEG Image Compression - 4 Figure 2: Maple Sample DCT calculation DCT has the property of removing variation in terms of intensity from an image. Figure 3 shows an uncompressed image and its luminosity histogram and a highly compressed image and its luminosity histogram. The standard deviation in the first case is 59.84, compared to 59.35 for the highly compressed image. Figure 3: the luminosity histograms for an uncompressed (right) image and a compressed (left) version While the DCT converts the image to its frequency domain and removes some variation, it produces more information than it started off with. While values of the spatial domain

Holloway JPEG Image Compression - 5 range from 128 to 128, the values in the matrix after DCT range from 1024 to 1024. A second compression method, quantization, is used to remove this excess information. QUANTIZATION: After DCT, the image is described in terms of its frequency domain in great detail. However, the human eye cannot pick out changes very bright or very dim colours. JPEGs can be compressed further by rounding the changes in frequency that are indistinguishable to the eye to zero. Quantization requires a quantization matrix. Every number in the 8*8 block in the JPEG image is divided by the corresponding number at the coordinates of the quantization matrix and rounded to an integer. A standard quantization matrix is: Figure 4 shows the same image compressed under a variety of quantization matrices.

Holloway JPEG Image Compression - 6 Figure 4: JPEG image compression using three different quantization matrices. The top uses the standard JPEG compression matrix, the middle uses the standard JPEG matrix where all of the values are multiplied by 16, and the bottom uses a matrix with constant values (100) Quantization significantly reduces file size, reducing the amount of bits to encode every pixel. Huffman Coding can further reduce JPEG images in size. HUFFMAN CODING: DCT usually results in a matrix in which the lower frequencies appear at the top left corner of the matrix. Quantization then makes many of the higher frequencies round

Holloway JPEG Image Compression - 7 down to 0. Following in a zig-zag path (figure 5) through the 8*8 blocks typically yields a few non-zero matrix coefficients followed by a string of zeros. Huffman coding takes advantage of redundancies such as a list of numbers ending with a long list of zeros by inserting a new code in the place of a frequent combination of numbers. In JPEGs a common code signifying that the rest of the coefficients in a matrix are zero is EOB. Figure 5: the zig-zag pattern of coefficients in an 8*8 block used for Huffman coding For example, a list of 64 coefficients that you might get from an 8*8 block such as 2, 0, 5, 10, -43, -3, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, can be simplified as 2, 0, 5, 10, -43, -3, EOB, which takes up much less space than the original list. Figure 7 compares an uncompressed JPEG with one compressed at a high quality but using Huffman coding. Figure 6: Comparison of an image without Huffman coding (left) and one with Huffman coding (right)

Holloway JPEG Image Compression - 8 The image quality in the two images in figure 7 is nearly equal, but the image with Huffman coding is 213 kilobytes in size while the image without Huffman coding is 292.15 kilobytes. CONCLUSION: Formats such as the bitmap and tiff require a lot of information to be able to store an image because they need 32 bits to encode the colour at every pixel. JPEGs, on the other hand, have three levels of compression. First, the discrete chunks of information at every pixel are transformed into a pattern of 2-dimensional curves. Next, the excess information that the human eye can t resolve is taken out. The information left over is perfect for further compression by Huffman coding. The combination of these three steps allows for very small image sizes and a large variety of image quality and level of compression. It is because of these features that the JPEG is now the dominant format of images on the internet. REFERENCES: Khayam, A. S. The Discrete Cosine Transform: Theory and Application. Michigan State University, March 10 th 2003. Watson, A. B. Image Compression Using the Discrete Cosine Transform. Mathematica Journal, 4(1), 1994, p. 81-88. Barni, M. Document and image compression. Taylor & Francis, Boca Raton, Florida, 2006. Shi, Y. Q. Image and video compression for multimedia engineering. CRC Press, Boca Raton, Florida, 1999. Salomon, D. Data Compression: the complete reference. Springer, 2004. Sayood, K. Introduction to Data Compression. Morgan Kaufmann, 2006. IMAGES USED: Rose taken by author in Golden Gate Park, San Francisco. David Huffman & Catherine Holloway taken from author s family photo album.