image compression ppt

74
IMAGE COMPRESSION Under Guidance of: Presented by:- Jayash Sharma Sir Shivangi Saxena M.tech,Semester-II

Transcript of image compression ppt

Page 1: image compression ppt

IMAGE COMPRESSION

Under Guidance of: Presented by:-

Jayash Sharma Sir Shivangi Saxena M.tech,Semester-II

Page 2: image compression ppt

• The problem of reducing the amount of data required to represent a digital image.

• From a mathematical viewpoint: transforming a 2-D pixel array into a statistically uncorrelated data set.

Image Compression?

Page 3: image compression ppt

• For data STORAGE and data TRANSMISSION• DVD• Remote Sensing• Video conference• FAX• Control of remotely piloted vehicle

• The bit rate of uncompressed digital cinema data exceeds one Gbps.

Why do We Need Compression?

Page 4: image compression ppt

REDUNDANTDATA

INFORMATION

DATA = INFORMATION + REDUNDANT DATA

Information vs Data

Page 5: image compression ppt

• Spatial redundancy

• Neighboring pixels are not independent but correlated

Temporal redundancy

Why Can We Compress?

Page 6: image compression ppt

• Basic data redundancies:1. Coding redundancy2. Inter-pixel redundancy3. Psycho-visual redundancy

Fundamentals

Page 7: image compression ppt

Let us assume, that a discrete random variable rk in the interval [0,1] represent the gray level of an image:

If the number of bits used to represent each value of rk is l(rk), then the average number of bits required to represent each pixel:

The total number bits required to code an MxN image:

1,,2,1,0)( −== Lkn

nrp kkr

avgLNM ..

Coding Redundancy

∑−

=

=1

0

)()(L

kkrkavg rprlL

Page 8: image compression ppt

Coding Redundancy

bits

rprlLk

krkavg

7.2

)02.0(6)03.0(6)06.0(5

)08.0(4)16.0(3)21.0(2)25.0(2)19.0(2

)()(7

02

=+++

++++=

= ∑=

2

1

n

nCR =

Rd CR

11−=

Compression ratio:

Relative data redundancy:

11.17.2

3 ==RC 099.011.1

11 =−=dR

Page 9: image compression ppt

Inter-pixel Redundancy

Spatial Redundancy

Geometric Redundancy

Inter-frame Redundancy

Here the two pictures have

Approximately the same

Histogram.

We must exploit Pixel

Dependencies.

Each pixel can be estimated

From its neighbors

Page 10: image compression ppt

Psycho-visual RedundancyElimination of psych-visual redundant data results in a loss of quantitative information ,it is commonly referred as quantization.

Improved Gray-Scale

Page 11: image compression ppt

Psycho-visual Redundancy

IGS Quantization

Page 12: image compression ppt

Fideli ty Criteria

The general classes of criteria :1. Objective fidelity criteria

2. Subjective fidelity criteria

Page 13: image compression ppt

Fideli ty CriteriaObjective f ideli ty:

Level of information loss can be expressed as a function of the original and the compressed and subsequently decompressed image.

2/1

21

0

1

0

]),(),(ˆ[1

−= ∑∑

=

=

M

x

N

yrms yxfyxf

MNe

∑∑

∑∑−

=

=

=

=

−= 1

0

1

0

2

1

0

1

0

2

)],(),(ˆ[

),(ˆ

M

x

N

y

M

x

N

yms

yxfyxf

yxf

SNR

Root-mean-square error

Mean-square signal-to-noise ratio

Page 14: image compression ppt

Fideli ty Criteria

25.10

93.6

==

rm

rms

SNR

e

39.10

78.6

==

rm

rms

SNR

e

Page 15: image compression ppt

Fideli ty CriteriaSubjective f idelity (Viewed by Human):

• By absolute rating

• By means of side-by-side comparison of and),( yxf ),(ˆ yxf

Page 16: image compression ppt

Image Compression Model

Remove Input Redundancies

Increase the Noise Immunity

The source encoder is responsible for removing redundancy

(coding, inter-pixel, psycho-visual)

The channel encoder ensures robustness against channel noise.

Page 17: image compression ppt

Classif ication Lossless compression

lossless compression for legal and medical documents, computer programs

exploit only code and inter-pixel redundancy Lossy compression

digital image and video where some errors or loss can be tolerated

exploit both code and inter-pixel redundancy and sycho-visual perception properties

Page 18: image compression ppt

Error-Free Compression

Applications:

• Archive of medical or business documents

• Satellite imaging

• Digital radiography

They provide: Compression ratio of 2 to 10.

Page 19: image compression ppt

Huffman coding

Error-Free CompressionVariable-length Coding

The most popular technique for removing coding redundancy is due

to Huffman (1952)

Huffman Coding yields the smallest number of code symbols per

source symbol

The result ing code is optimal

Page 20: image compression ppt

Error-Free CompressionVariable-length Coding

Huffman coding (optimal code)

Page 21: image compression ppt

Huffman coding

Error-Free CompressionVariable-length Coding

symbolbitsentropy

symbolbits

Lavg

/14.2

/2.2

)5)(04.0()5)(06.0()4)(1.0()3)(1.0()2)(3.0()1)(4.0(

==

+++++=

Page 22: image compression ppt

Error Free Compression Technique.

Remove Inter-pixel redundancy.

Requires no priori knowledge of probability distribution of pixels.

Assigns fixed length code words to variable length sequences.

Patented Algorithm US 4,558,302.

Included in GIF and PDF file formats.

LZW Coding

Page 23: image compression ppt

Coding Technique

A codebook or a dictionary has to be constructed

For an 8-bit monochrome image, the first 256 entries are

assigned to the gray levels 0,1,2,..,255.

As the encoder examines image pixels, gray level sequences

that are not in the dictionary are assigned to a new entry.

For instance sequence 255-255 can be assigned to entry 256,

the address following the locations reserved for gray levels 0 to

255.

LZW Coding

Page 24: image compression ppt

LZW Coding

Example

Consider the following 4 x 4 8 bit image

39 39 126 12639 39 126 12639 39 126 12639 39 126 126

Dict ionary Location Entry

0 0

1 1

. .

255 255

256 -

511 -

Initial Dictionary

Page 25: image compression ppt

LZW Coding

39 39 126 12639 39 126 12639 39 126 12639 39 126 126

•Is 39 in the dict ionary……..Yes

•What about 39-39………….No

•Then add 39-39 in entry 256

•And output the last recognized symbol…39

Dict ionary Location Entry

0 0

1 1

. .

255 255

256 -

511 -

39-39

Page 26: image compression ppt

H.R. Pourreza

Error-Free CompressionBit-plane coding

Bit-plane coding is based on decomposing a multilevel image into a series of binary images and compressing each binary image .

a b c d e f

f

ed

cb

a

Page 27: image compression ppt

Error-Free CompressionBit-plane coding

Binary Bit-planes Gray Bit-planes

11

1

0121

00

22

11

20

:

222:

−−

+

−−

−−

−−

=−≤≤⊕=

+++−

mm

lll

mm

mm

mm

ag

mlaag

ggggcodeGray

aaascalegraybitm

Bit-plane decomposit ion

Page 28: image compression ppt

Error-Free CompressionBit-plane coding

Binary Bit-planes Gray Bit-planes

Bit-plane decomposit ion

Page 29: image compression ppt

Error-Free CompressionBit-plane coding

• Constant area Coding

• One-dimensional run-length coding10

10

LL

HHHRL +

+=

Average values of black and white run

lengths

Relative Address Coding (RAC) is based on tracking the binary transitions.

• Two-dimensional RLC

Page 30: image compression ppt

Error-Free CompressionLoss-less Predictive Coding

Page 31: image compression ppt

Error-Free CompressionLoss-less Predictive Coding

= ∑

=−

m

llnln froundf

1

ˆ α

In most cases, the predict ion is formed by a l inear combination of m previous pixels. That is:

1-D Linear Predict ive coding:

−= ∑

=

m

iin iyxfroundyxf

1

),(),(ˆ α

m is the order of l inear predictor

Page 32: image compression ppt

H.R. Pourreza

Error-Free CompressionLoss-less Predictive Coding

[ ])1,(),(ˆ −= yxfroundyxf α First-order l inear predictor

Page 33: image compression ppt

Lossy Compression

Lossy encoding is based on the concept of compromising the accuracy of the reconstructed image in exchange for increased compression.

Lossy encoding techniques are capable of reproducing recognizable mono-chrome images from data that have been compressed by more than 100:1 and images that are virtually indistinguishable from the original at 10:1 to 50:1 .

Lossy Compression:

1. Spatial domain methods

2. Transform coding

Page 34: image compression ppt

Lossy CompressionLossy Predictive Coding

• Predictive Coding : transmit the difference between estimate of future sample & the sample itself.

• Delta modulation• DPCM• Adaptive predictive coding• Differential frame coding

Page 35: image compression ppt

Lossy CompressionLossy Predictive Coding

Page 36: image compression ppt

Lossy CompressionLossy Predictive Coding – Delta Modulation (DM)

−>+

=

= −

otherwise

efore

ff

nn

nn

ζξ

α0

ˆ1

Page 37: image compression ppt

Lossy CompressionOptimal Prediction

=

=−

=−

−=

=

=+≈+=

−=

m

ii

m

iininn

m

iinin

nnnnnn

nnn

ffEeE

ff

ffefef

ffEeE

1

2

1

2

1

22

1

}{

ˆ

ˆˆ

}]ˆ{[}{

α

α

α

Differential Pulse Code Modulation (DPCM)

Page 38: image compression ppt

Lossy CompressionOptimal Prediction

)1,1()1,()1,1(),1(

),1(97.0

)1,(97.0),(ˆ

)1,1(5.0),1(75.0)1,(75.0),(ˆ

),1(5.0)1,(5.0),(ˆ

)1,(97.0),(ˆ

−−−−=∆−−−−=∆

−∆≤∆−

=

−−−−+−=

−+−=

−=

yxfyxfvandyxfyxfh

otherwiseyxf

vhifyxfyxf

yxfyxfyxfyxf

yxfyxfyxf

yxfyxf

Predict ion Error

Pred. #1

Pred. #2

Pred. #3

Pred. #4

Page 39: image compression ppt

Lossy CompressionOptimal Prediction

Page 40: image compression ppt

H.R. Pourreza

Lossy CompressionPrediction Error for dif ferent predictors

Pred. #1

Pred. #3

Pred. #2

Pred. #4

Page 41: image compression ppt

Lossy CompressionOptimal Quantization

)()( functionoddanisqsqt =

Decision Levels

Reconstruction Levels

Page 42: image compression ppt

Lossy CompressionOptimal Quantization

)()( functionoddanisqsqt =

Minimization of the mean-square quantization error

iiii

iii

s

s

i

ttss

Li

Li

tti

s

Lidssptsi

i

−=−=

=∞

−=+=

=

=−

−−

+

∫−

2

12,,2,1

2

00

2/,,2,1)()(

1

1

Addit ional constraint for optimum uniform quantizer:

θ=−=− −− 11 iiii sstt

Page 43: image compression ppt

Lossy CompressionOptimal Quantization

Unit variance Laplacian probabil i ty density function

As this table constructed for a unit variance distr ibution, the reconstruction and decision levels

for the case of are obtained by mult iplying the tabulated values by the standard deviat ion 0of

the probabil i ty density function

1≠σ

Page 44: image compression ppt

Lossy CompressionDPCM RMSE

The best of four possible quantizers is selected for each block of 16 pixels.

Scaling factors: 0.5, 1.0, 1.75 and 2.5

Page 45: image compression ppt

Lossy CompressionDPCM result images

2-level Lloyd-Max quantizer

1.0 bits/pixel

4-level Lloyd-Max quantizer

2.0 bits/pixel

8-level Lloyd-Max quantizer

3.0 bits/pixel

2-level adaptive quantizer

1.125 bits/pixel

4-level adaptive quantizer

2.125 bits/pixel

8-leveladaptive quantizer

3.125 bits/pixel

Page 46: image compression ppt

Lossy CompressionDPCM Predict ion Error

2-level Lloyd-Max quantizer

1.0 bits/pixel

4-level Lloyd-Max quantizer

2.0 bits/pixel

8-level Lloyd-Max quantizer

3.0 bits/pixel

2-level adaptive quantizer

1.125 bits/pixel

4-level adaptive quantizer

2.125 bits/pixel

8-leveladaptive quantizer

3.125 bits/pixel

Page 47: image compression ppt

Lossy CompressionTransform Coding

The goal of the transformation process is to decorrelate the pixels of each sub-image, or to pack as much information as possible into the smallest number of transform coeff icients

Page 48: image compression ppt

1,,1,0,),,,(),(),(

1,,1,0,),,,(),(),(

1

0

1

0

1

0

1

0

−==

−==

∑∑

∑∑−

=

=

=

=

NyxvuyxhvuTyxf

NvuvuyxgyxfvuT

N

u

N

v

N

u

N

v

Forward kernel is Separable if :

Lossy CompressionTransform Coding

),().,(),,,( 21 vyguxgvuyxg =

Forward kernel is Symmetric i f:

),().,(),,,( 1121 vyguxgvuyxggg =⇒=

Page 49: image compression ppt

Discrete Fourier Transform (DFT):

Lossy CompressionTransform Coding

Nvyuxj

Nvyuxj

evuyxh

eN

vuyxg

/)(2

/)(2

),,,(

1),,,(

+

+−

=

=

π

π

Walsh-Hadamard Transform (WHT):

)2()1(1

),,,(),,,(

1

0

)]()()()([m

vpybupxb

NN

vuyxhvuyxg

m

iiiii

=∑

−==

=

+

bk(z) is the kth bit (from right to left) in the binary representation of z.

Page 50: image compression ppt

)()()(

)()()(

)()()(

)()(

011

322

211

10

ububup

ububup

ububup

ubup

m

mm

mm

m

+=

+=+=

=

−−

−−

Lossy CompressionTransform Coding

Page 51: image compression ppt

Discrete Cosin Transform (DCT):

Lossy CompressionTransform Coding

−=

==

+

+=

=

1,,2,12

01

)(

2

)12(cos

2

)12(cos)()(

),,,(),,,(

NuforN

uforNuwhere

N

vy

N

uxvu

vuyxhvuyxg

α

ππαα

Page 52: image compression ppt

Lossy CompressionTransform Coding

Page 53: image compression ppt

Lossy CompressionTransform Coding

1. Dividing the image into sub-images of size 8x8

2. Representing each sub-image using one of the transforms

3. Truncating 50% of the result ing coeff icients

4. Taking the inverse Transform of the truncated coeff icients

DFT

WHT

DCT

rmse=1.28

rmse=0.86

rmse=0.68

Page 54: image compression ppt

H.R. Pourreza

Lossy CompressionTransform Coding• DCT Advantages:

1. Implemented in a single integrated circuit (IC)

2. Packing the most information into the fewest coeff icients

3. Minimizing the block-like appearance (blocking art ifact)

Page 55: image compression ppt

Lossy CompressionTransform Coding

Sub-image size selection

Truncating 75% of the result ing coefficients

Page 56: image compression ppt

Lossy CompressionTransform Coding

Truncating 75% of the result ing coefficients.

Sub-images size:

8x8

4x4

2x2

Page 57: image compression ppt

Lossy CompressionTransform Coding

Bit allocation87.5% of the DCT coeff. Of each 8x8 subimage.

Threshold coding (8 coef)

Zonal coding

Page 58: image compression ppt

H.R. Pourreza

Lossy CompressionTransform Coding- Bit allocation

Page 59: image compression ppt

Lossy CompressionTransform Coding- Bit allocation• Zonal coding

1. Fixed number of bits / coeff icient

- Coeff icients are normalized by their standard deviat ions and uniformly quantized

2. Fixed number of bits is distributed among the coeff icients unequally.

- A quantizer such as an optimal Lloyed-Max is designed for each coeff. :

- DC coeff. Is modeled by Rayleigh density func.

- The remaining coeff. Are modeled by Laplcian or

Gaussian

Page 60: image compression ppt

Lossy CompressionTransform Coding- Bit allocation• Threshold coding

1. Single global threshold

2. Different threshold for each subimage (N-Largest coding)

3. Threshold can be varied as a function of the location of each coeff.

Page 61: image compression ppt

H

Lossy CompressionTransform Coding

Bit allocation 67:1

rmse: 6.33

34:1

rmse: 3.42

Page 62: image compression ppt

Lossy CompressionTransform Coding

Wavelet Coding

Page 63: image compression ppt

Lossy CompressionTransform Coding

Wavelet Coding34:1

rmse: 2.29

67:1

rmse: 2.96

No blocking

Page 64: image compression ppt

Lossy CompressionTransform Coding

108:1

rmse: 3.72

167:1

rmse: 4.73

Wavelet Coding

Page 65: image compression ppt

Lossy CompressionTransform Coding

Quantizer selectionEffectiveness of the quantization can be improved by:

• introducing an enlarge quantization interval around zero

• Adapting the size of the quantization interval from scale to scale

Page 66: image compression ppt

Why Do We Need International Standards?

International standardization is conducted to achieve inter-operability . Only syntax and decoder are specified. Encoder is not standardized and its optimization is left to the

manufacturer. Standards provide state-of-the-art technology that is

developed by a group of experts in the field. Not only solve current problems, but also anticipate the future

application requirements. Most of the standards are sanction by the International

Standardization Organization (ISO) and the Consultative Committee of the International Telephone and Telegraph (CCITT)

Image Compression Standards

Page 67: image compression ppt

CCITT Group 3 and 4

They are designed as FAX coding methods. The Group 3 applies a non-adaptive 1-D run length

coding and optionally 2-D manner. Both standards use the same non-adaptive 2-D coding

approach, similar to RAC technique. They sometime result in data expansion. Therefore, the

Joint Bilevel Imaging Group (JBIG), has adopted several other binary compression standards, JBIG1 and JBIG2.

Image Compression StandardsBinary Image Compression Standards

Page 68: image compression ppt

What Is JPEG?

"Joint Photographic Expert Group". Voted as

international standard in 1992.

Works with color and grayscale images, e.g., satellite,

medical, ...

Lossy and lossless

Image Compression StandardsContinues Tone Sti l l Image Comp.

Page 69: image compression ppt

First generation JPEG uses DCT+Run length Huffman entropy coding.

Second generation JPEG (JPEG2000) uses wavelet transform + bit plane coding + Arithmetic entropy coding.

Image Compression StandardsContinues Tone Sti l l Image Comp. - JPEG

Page 70: image compression ppt

Still-image compression standard Has 3 lossless modes and 1 lossy mode

sequential baseline encoding encode in one scan input & output data precision is limited to 8 bits, while quantized

DCT values are restricted to 11 bits progressive encoding hierarchical encoding lossless encoding

Can achieve compression ratios of up-to 20 to 1 without noticeable reduction in image quality

Image Compression StandardsContinues Tone Sti l l Image Comp. - JPEG

Page 71: image compression ppt

Work well for continuous tone images, but not good for cartoons or computer generated images.

Tend to filter out high frequency data. Can specify a quality level (Q)

with too low Q, resulting images may contain blocky, contouring and ringing structures.

5 steps of sequential baseline encoding transform image to luminance/chrominance space (YCbCr) reduce the color components (optional) partition image into 8x8 pixel blocks and perform DCT on each

block quantize resulting DCT coefficients variable length code the quantized coefficients

Image Compression StandardsContinues Tone Sti l l Image Comp. - JPEG

Page 72: image compression ppt

Original JPEG 27:1

Image Compression StandardsJPEG Encoding

Page 73: image compression ppt

Video compression standards:1. Video teleconferencing standards

H.261 (Px64) H.262 H.263 (10 to 30 kbit/s) H.320 (ISDN bandwidth)

2. Multimedia standards MPEG-1 (1.5 Mbit/s) MPEG-2 (2-10 Mbit/s) MPEG-4 (5 to 64 kbit/s for mobile and PSTN and uo to 4

Mbit/s for TV and film application)

Image Compression StandardsVideo Compression Standards

Page 74: image compression ppt

THANK YOU