Top Banner
Image Compression Image Compression Techniques Techniques Presented by PARTHA PRATIM DEB MTECH(CSE),1 st YEAR
26
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Image compression

Image Compression Image Compression TechniquesTechniques

Presented by PARTHA PRATIM

DEB MTECH(CSE),1st

YEAR

Page 2: Image compression

OutlineOutline Image Compression Fundamentals

◦ Why Compress◦ How is compression possible?◦ Redundancy◦ The Flow of Image Compression◦ General Image Storage SystemLossy compression:

Reduce correlation between pixels◦ Karhunen-Loeve Transform◦ Discrete Cosine Transform◦ Discrete Wavelet Transform◦ Differential Pulse Code Modulation◦ Differential Coding

Lossless compression: Quantization and Source Coding

◦ Huffman Coding◦ Arithmetic Coding◦ Run Length Coding◦ Lempel Ziv 77 Algorithm◦ Lempel Ziv 78 Algorithm

Overview of Image Compression Algorithms◦ JPEG◦ JPEG 2000◦ Shape-Adaptive Image Compression

Page 3: Image compression

OutlineOutlineImage Compression

Fundamentals Reduce correlation between

pixelsQuantization and Source CodingOverview of Image Compression

Algorithms

Page 4: Image compression

The Flow of Image The Flow of Image CompressionCompression

What is the so-called image compression coding? ◦ To store the image into bit-stream as compact as possible and to

display the decoded image in the monitor as exact as possible Flow of compression

◦ The image file is converted into a series of binary data, which is called the bit-stream

◦ The decoder receives the encoded bit-stream and decodes it to reconstruct the image

◦ The total data quantity of the bit-stream is less than the total data quantity of the original image

Encoder 0101100111... Decoder

Original Image Decoded ImageBitstream

Page 5: Image compression

Basic concept of Basic concept of compressioncompression

Page 6: Image compression

spatial redundancyspatial redundancy

Elements that are duplicated within a structure, such as pixels in a still image and bit patterns in a file. Exploiting spatial redundancy is how

compression is performed.

Intraframe coding Compressing redundant areas within a single video frame.Interframe codingInterframe coding often provides substantial compression because in many motion sequences, only a small percentage of the pixels are actually different from one frame to another.

Page 7: Image compression

General Image Storage General Image Storage System System

Object

R-G-Bcoordinate

Transform toY-Cb-Cr

coordinate

DownsampleChrominance

Encoder

DecoderR-G-B

coordinate

Transform to R-G-B

coordinate

UpsampleChrominance

Monitor

C

Camera

C

V

HDDPerformance

RMSEPSNR

Page 8: Image compression

CodingCoding

Java Syntax: private int[] capture() throws InterruptedException { dim = Toolkit.getDefaultToolkit().getScreenSize(); Image tmp = robot.createScreenCapture(new

Rectangle(dim.width,dim.height)).getScaledInstance(800,600,BufferedImage.SCALE_SMOOTH);

int pix[] = new int[IMG_WIDTH*IMG_HEIGHT]; PixelGrabber pg = new

PixelGrabber(tmp,0,0,IMG_WIDTH,IMG_HEIGHT,pix,0,IMG_WIDTH); pg.grabPixels(); return pix; }

Page 9: Image compression

OutlineOutline Image Compression Fundamentals Reduce correlation between pixels(lossy)Quantization and Source CodingOverview of Image Compression Algorithms

Page 10: Image compression

Reduce the Correlation Reduce the Correlation between Pixelsbetween Pixels

Lossy compression:Orthogonal Transform Coding

◦ KLT (Karhunen-Loeve Transform) Maximal Decorrelation Process

◦ DCT (Discrete Cosine Transform) JPEG is a DCT-based image compression standard, which

is a lossy coding method and may result in some loss of details and unrecoverable distortion.

Subband Coding◦ DWT (Discrete Wavelet Transform)

To divide the spectrum of an image into the lowpass and the highpass components, DWT is a famous example.

JPEG 2000 is a 2-dimension DWT based image compression standard.

Predictive Coding◦ DPCM

To remove mutual redundancy between successive pixels and encode only the new information

Page 11: Image compression
Page 12: Image compression
Page 13: Image compression
Page 14: Image compression

OutlineOutline Image Compression Fundamentals Reduce correlation between pixels(lossy)Quantization and Source Coding(lossless)Overview of Image Compression Algorithms

Page 15: Image compression

Quantization and Source Quantization and Source CodingCodingLossless compression techniques:

Quantization◦ The objective of quantization is to reduce the precision and to

achieve higher compression ratio◦ Lossy operation, which will result in loss of precision and

unrecoverable distortion Source Coding

◦ To achieve less average length of bits per pixel of the image.◦ Assigns short descriptions to the more frequent outcomes and

long descriptions to the less frequent outcomes◦ Entropy Coding Methods

Huffman Coding Arithmetic Coding Run Length Coding Dictionary Codes

Lempel-Ziv77 Lempel-Ziv 78

Page 16: Image compression

Huffman CodingHuffman Coding

Codeword length

2

2

3

3

3

Codeword X

01

10

11

000

001

1

2

3

4

5

Probability

0.25

0.25

0.2

0.15

0.15

0.25

0.25

0.2

0.45 0.55 10.3

0.3

0.25

0.45

0

1

1

00

01

00

01

10

11

01

10

11

000

001

Page 17: Image compression

Arithmetic Coding (1/3)Arithmetic Coding (1/3) Arithmetic Coding: a direct extension of Shannon-Fano-Elias

coding calculate the probability mass function p(xn) and the cumulative distribution function F(xn) for the source sequence xn

◦ Lossless compression technique◦ Treate multiple symbols as a single data unitArithmetic Coding Algorithm

Input symbol is l

Previouslow is the lower bound for the old interval

Previoushigh is the upper bound for the old interval

Range is Previoushigh - Previouslow

Let Previouslow= 0, Previoushigh = 1, Range = Previoushigh – Previouslow =1

WHILE (input symbol != EOF)

get input symbol l

Range = Previoushigh - Previouslow

New Previouslow = Previouslow + Range* intervallow of l

New Previoushigh = Previouslow + Range* intervalhigh of l

END

Page 18: Image compression

Arithmetic Coding (2/3)Arithmetic Coding (2/3)SymbolSymbol ProbabilityProbability Sub-intervalSub-interval

kk 0.050.05 [0.00,0.05)[0.00,0.05)

ll 0.20.2 [0.05,0.25)[0.05,0.25)

uu 0.10.1 [0.20,0.35)[0.20,0.35)

ww 0.050.05 [0.35,0.40)[0.35,0.40)

ee 0.30.3 [0.40,0.70)[0.40,0.70)

rr 0.20.2 [0.70,0.90)[0.70,0.90)

?? 0.20.2 [0.90,1.00)[0.90,1.00)

Input String : l l u u r e ?l l u u r e ?

?

r

e

wu

lk0

1.00

0.25

0.35

0.40

0.70

0.90

0.05

0

1

?

r

e

wu

lk

0.25

0.05

?

r

e

wu

lk

0.10

0.06

?

r

e

wu

lk

0.074

0.070

?

r

e

wu

lk

0.0714

0.0710

?

r

e

wu

lk

0.07136

0.07128

?

r

e

wu

lk

0.071336

0.07132

?

r

e

wu

lk

0.0713360

0.0713336

Codeword : 0001001001000011

0.0713348389=2-4+2-7+2-10+2-

15+2-16

Page 19: Image compression

Arithmetic Coding (3/3)Arithmetic Coding (3/3)SymbolSymbol ProbabilityProbability Huffman codewordHuffman codeword

kk 0.050.05 1010110101

ll 0.20.2 0101

uu 0.10.1 100100

ww 0.050.05 1010010100

ee 0.30.3 1111

rr 0.20.2 0000

?? 0.20.2 10111011

Input String : l l u u r e ?Huffman Coding

Codeword : 01,01,100,100,00,11,1101

18 bits

Arithmetic coding yields better compression because it encodes a message as a whole new symbol instead of separable symbolsMost of the computations in arithmetic coding use floating-point arithmetic. However, most hardware can only support finite precision

While a new symbol is coded, the precision required to present the range growsThere is a potential for overflow and underflowIf the fractional values are not scaled appropriately, the error of encoding occurs

Arithmetic CodingCodeword :

0001001001000011

16 bits

Page 20: Image compression

Zero-Run-Length Coding-Zero-Run-Length Coding-JPEG (1/2)JPEG (1/2) The notation (L,F)

◦ L zeros in front of the nonzero value F EOB (End of Block)

◦ A special coded value means that the rest elements are all zeros

◦ If the last element of the vector is not zero, then the EOB marker will not be added

An Example:

57, 45, 0, 0, 0, 0, 23, 0, -30, -16, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, ..., 0

(0,57) ; (0,45) ; (4,23) ; (1,-30) ; (0,-16) ; (2,1) ; EOB

(0,57) ; (0,45) ; (4,23) ; (1,-30) ; (0,-16) ; (2,1) ; (0,0)

(0,6,111001);(0,6,101101);(4,5,10111);(1,5,00001);(0,4,0111);(2,1,1);(0,0)

1111000 1111001 , 111000 101101 , 1111111110011000 10111 , 11111110110 00001 , 1011 0111 , 11100 1 , 1010

1.

2.

3.

4.

5.

Page 21: Image compression

Dictionary CodesDictionary Codes Dictionary based data compression algorithms

are based on the idea of substituting a repeated pattern with a shorter token

Dictionary codes are compression codes that dynamically construct their own coding and decoding tables “on the fly” by looking at the data stream itself

It is not necessary for us to know the symbol probabilities beforehand. These codes take advantage of the fact that, quite often, certain strings of symbols are “frequently repeated” and these strings can be assigned code words that represent the “entire string of symbols”

Two series◦ Lempel-Ziv 77: LZ77, LZSS, LZBW◦ Lempel-Ziv 78: LZ78, LZW, LZMW

Page 22: Image compression

OutlineOutlineImage Compression

Fundamentals Reduce correlation between

pixelsQuantization and Source CodingOverview of Image Compression

Algorithms

Page 23: Image compression

OutlineOutline Image Compression Fundamentals Reduce correlation between pixels(lossy)Quantization and Source Coding(lossless)Overview of Image Compression Algorithms

Page 24: Image compression

JJoint oint PPhotographic hotographic EExperts xperts GGroup roup (JPEG)(JPEG) The JPEG Encoder

Image

RG

B

YVU colorcoordinate

ChrominanceDownsampling(4:2:2 or 4:2:0)

8 X 8 FDCT

Quantizer

QuantizationTable

zigzag

DifferentialCoding

HuffmanEncoding

HuffmanEncoding

Bit-stream

The JPEG Decoder

DecodedImage

RG

B

ChrominanceUpsampling

(4:2:2 or 4:2:0)

8 X 8IDCT

YVU colorcoordinate

Dequantizer

QuantizationTable

De-zigzag

De-DC coding

HuffmanDecoding

HuffmanDecoding

Bit-stream

Page 25: Image compression

ReferenceReference

Digital image processing, by Rafael C.Gonzalez and Richard E.Woods

page no:421-423,440-456,459-486.

Page 26: Image compression

THANK U

FOR UR PATIENCE