16
Sejong University, DMS Lab. Digital Image Processing 8. Image Compression [email protected] Sejong University, DMS Lab. What is image compression? Image compression Reducing the amount of data needed to represent the image Removing duplicate data existing in the image Applications Digital TV broadcasting Televideo-conferencing Medical imaging Facsimile transmission Multi-media environment Transport and storage 1

Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

  • Upload
    buidan

  • View
    216

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Digital Image Processing8. Image Compression

[email protected]

Sejong University, DMS Lab.

What is image compression?

Image compression• Reducing the amount of data needed to represent the image• Removing duplicate data existing in the image

Applications• Digital TV broadcasting• Televideo-conferencing• Medical imaging• Facsimile transmission• Multi-media environment

Transport and storage

1

Page 2: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Fundamentals

Compression and Restoration• Lossless compression Precisely reproducing original information when restored after compression

• Lossy compression Loss occurs when you restore the original information after compression

Duplicate characteristics of the image data• Coding redundancy• Interpixel redundancy• Psychovisual redundancy

2

Sejong University, DMS Lab.

Fundamentals _ coding redundancy

Removing coding redundancy• Generating a short code assigned to the high frequency value• Generating a long code assigned to the low frequency value• The length of the code change• Reducing the total amount of data• Low bit for this histogram assign a higher value

3

Page 3: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Fundamentals _ coding redundancy

The amount of data required• Show the pixel value range of [0,1] of random variable rk

• pr(rk) = rk of probability of occurrence

• L is total pixels and l(rk) is represented bits amounts of rk

4

n

nrp kkr )(

1

0

)()(L

kkrkavg rprlL

Sejong University, DMS Lab.

Fundamentals_ coding redundancy

Removing coding redundancy

5

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

code 1 code 2

bits

rprlLk

krkavg

0.3

)02.0(3)03.0(3)06.0(3)08.0(3

)16.0(3)21.0(3)25.0(3)19.0(3

)()(7

01

Page 4: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Fundamentals _ Interpixel redundancy

Removing interpixel redundancy• Using the similarity between neighboring pixels• Using the similarity between neighboring fields• Data represented by the difference between the neighboring pixels• Using Run-length encoding, DPCM, ADPCM• Spatial redundancy

6

Sejong University, DMS Lab.

Fundamentals _ Interpixel redundancy

Removing of interpixel redundancy

7

Page 5: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Fundamentals _ Psychovisual redundancy

Removing of psychovisual redundancy• HVS It doesn’t respond accurately to the image information• Certain image information is ignored by eye of human• The removal of this information Doesn’t difference in perception• Relate to Sampling and Quantization

8

Sejong University, DMS Lab.

Fundamentals _ Fidelity

Standard of fidelity• Building evaluation means define the Characteristics information and

amount of lost HVS Objective fidelity criteria

– Root-mean-square error of input image and output image– are each input image, output image.– The total amount of error between two images of MxN

– root-mean-square of two images erms

9

),(ˆ),,( yxfyxf

1

0

1

0

)],(),(ˆ[M

x

N

y

yxfyxf

2/11

0

1

0

2)],(),(ˆ[1

M

x

N

yrms yxfyxf

MNe

Page 6: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Fundamentals _ Fidelity

Examples of objective fidelity criteria• Mean-square signal-to-noise ratio of the output image

10

1

0

1

0

2

1

0

1

0

2

)],(),(ˆ[

),(ˆ

M

x

N

y

M

x

N

yms

yxfyxf

yxf

SNR

Sejong University, DMS Lab.

Image compression model

Image compression system• Composed of the encoder and decoder• Source encoder : removing redundancy of input data• Channel encoder : reinforced immune to noise

11

Source encoder

Channel encoder Channel Channel

decoderSource decoder

Encoder Decoder

),( yxf ),(ˆ yxf

Page 7: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Image compression model _ Source encoding

Step of source encoding• Mapper

Converting the data types in input image to reduce interpixel redundancy ex) run-length coding

• Quantizer Reducing the accuracy of the mapper output Reducing the Psychovisual redundancy

• Symbol encoder Reducing the Coding redundancy Outputting the fixed length or variable length code

12

Mapper Quantizer Symbol encoder Channel

<Source Encoder>

),( yxf

Sejong University, DMS Lab.

Image compression model _ Source decoding Source Decoder

• Reconstruction original image in reverse process of source encoding• When encoding time, if the quantization process is not fully

recoverable

Process of Source Decoding

13

Symbol Decoder

Inverse Mapper

Channel

<Source Decoder>

),(ˆ yxf

Page 8: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Lossless compression

Lossless compression• Removing interpixel, coding redundancy• The compression method used in the case does not allow the loss

Application• Medical or business documents• Satellite images• Digital radiography

Compression techniques • Variable-length coding• Arithmetic coding• Run-length coding• Lossless predictive coding

14

Sejong University, DMS Lab.

Lossless compression _ variable length coding

Variable-length coding• The simplest compression technique • Removing coding redundancy• Specify the shortest codes to the most appeared to value

Category• Huffman coding• Truncated Huffman coding• Shift coding• Huffman shift coding

15

Page 9: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

variable length coding _ Huffman coding

Huffman coding• Allocate fewer bits to frequently used code

Process of Huffman coding• 1. Sort the probability of symbol• 2. Continuously reducing the number of exit symbol by combining the

symbol with the lowest probability of a single symbol• 3. Assigned to each code symbol in the smallest number• 4. Exit to allocate an additional code symbol is reduced to inverse

process

16

Sejong University, DMS Lab.

variable length coding _ Huffman coding

17

<Reducing the number of symbol>

<Assign code>

Page 10: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

variable length coding _ Huffman coding

Advantages• Generating 1 code at a time Optimized code• It can be encoded as a look-up table method• Source symbol is mapped to a code symbol of a certain length

Disadvantages• If the symbol is difficult to configure a large number of code tables

Ex) The code assignment

18

a b c d e

0.4 0.3 0.2 0.06 0.04

a b c d e

1 00 010 0110 0111

Sejong University, DMS Lab.

Lossless compression _ Arithmetic coding

Arithmetic coding• Generating nonblock code Several of the source symbols are gathered Create one arithmetic code

• Code word has a real number between 0 and 1

19

Source symbol

Probability Initial subinterval

a1 0.2 [0.0,0.2)

a2 0.2 [0.2,0.4)

a3 0.4 [0.4,0.8)

a4 0.2 [0.8,1.0)

Page 11: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Lossless compression _ LZW coding

LZW coding ( Lempel-Ziv-Welch coding)• Source symbol of variable length Assign a code word of fixed

length• Using Gif, tiff, pdf file• Creating a basic codebook ( assignment 0~255 in image )• If source symbols in codebook are replaced with a code word in the

codebook• No prior knowledge required

20

Sejong University, DMS Lab.

Lossless compression _ Bit-plane coding

21

Bit-plane coding• After decomposing the image into a series of binary tone image,

compressing the data by using the coding method of binary image• Technology to increase the compression ratio for each bit-plane

Page 12: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Lossless compression _ Bit-plane coding

Reconstruction of bit-plane• The change of the data is very large in the low bit• Using m-bit gray code reducing bit changing

In the case of pixels adjacent to each other with similar characteristics using value

10진수 BCD 코드 그레이코드

0 0000 0000 1 0001 0001 2 0010 0011 3 0011 0010 4 0100 0110 5 0101 0111 6 0110 0101 7 0111 0100 8 1000 1100 9 1001 1101

22

Sejong University, DMS Lab.

Lossless compression

23

original image

original gray coded original gray coded

Page 13: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Lossless compression _ run-length coding

Run-length coding• Removing interpixel redundancy technique• Binary image compression• Applied to each bit-plane of the tone image• Representing the image of a continuous length (black, white)• FAX transmission• Tone image of 1,2,4 bit

• Input : 0000011110000000000• Output : 5b4w10b• BMP file

24

Sejong University, DMS Lab.

Lossless predictive coding

Lossless predictive coding• Removing interpixel redundancy• Using the information obtained from previous pixel Only extract new information from neighboring pixels Encoding

• New information : (previous pixel – predictive value)

25

Page 14: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Lossy compression

Lossy coding• Allowing the loss to increase the compression ratio• Removing interpixel, coding redundancy, psychovisual redundancy• Presence of Quantization step

Application• Digital TV : MPEG-2, image conference• Still image : JPEG

Coding technique• Lossy predictive coding• Transform coding• Hierarchical coding• Hybrid coding, wavelet coding

26

Sejong University, DMS Lab.

Predictive coding

Lossy predictive coding

27

Page 15: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Predictive coding _ DM

DM (Delta Modulation)• Assigning one bit to the representation of a pixel• Code assignment method

Comparing the input signal value and the current value If input value >= current value assignment ‘1’ Otherwise, ‘0’

• Implementation Define regular amplitude, encoding residual signal ‘1’ = + delta, ‘0’ = - delta

• Granular noise No change occurs in the part of the input image ( Amplitude )

• Slope overload The change in the input image generated in large part ( Amplitude )

28

Sejong University, DMS Lab.

Predictive coding

ADM (Adaptive Delta Modulation)• Process the amplitude to a variable

DPCM (Differential Pulse Code Modulation)• Techniques to minimize the prediction error encoding unit

29

}]ˆ{[}{ 22nnn ffEeE

Page 16: Sejong University, DMS Lab.dasan.sejong.ac.kr/~dihan/dip/D08_Image Compression1.pdf · Sejong University, DMS Lab. Fundamentals _ coding redundancy The amount of data required •

Sejong University, DMS Lab.

Ex) lossy coding about DPCM

30

1 bits/pixel 1.25 bits/pixel

2 bits/pixel

2.125 bits/pixel

3 bits/pixel3.125 bits/pixel

Sejong University, DMS Lab.

Ex) DPCM Error

31

1.25 bits/pixel

2.125 bits/pixel

3.125 bits/pixel

1 bits/pixel

2 bits/pixel

3 bits/pixel