123
Digital Image Processing, 2nd ed. Digital Image Processing, 2nd ed. www.imageprocessingbook.com © 2002 R. C. Gonzalez & R. E. Woods 第八章 第八章 影像壓縮 影像壓縮 影像壓縮的主要目的在去除影像多餘資料,降低 表示影像所需的資料量 8.1 8.1 基本原理 基本原理 8.2 8.2 影像壓縮模型 影像壓縮模型 8.3 8.3 基本資訊理論 基本資訊理論 8.4 8.4 無失真壓縮 無失真壓縮 8.5 8.5 失真壓縮 失真壓縮 8.6 8.6 影像壓縮標準 影像壓縮標準

No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

  • Upload
    others

  • View
    29

  • Download
    0

Embed Size (px)

Citation preview

Page 1: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

第八章第八章 影像壓縮影像壓縮

影像壓縮的主要目的在去除影像多餘資料降低表示影像所需的資料量

81 81 基本原理基本原理

82 82 影像壓縮模型影像壓縮模型

83 83 基本資訊理論基本資訊理論

84 84 無失真壓縮無失真壓縮

85 85 失真壓縮失真壓縮

86 86 影像壓縮標準影像壓縮標準

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

資料多餘量

資料中某些部份被去除後仍不影響原本所表達的意思則可被去除的部份稱為多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

n1與n2代表相同資訊的兩種表示法

壓縮率

相對資料多餘量

( )1-81 11R

D CR minus=

( )2-81 2

1

nnCR =

bull n1=n2 壓縮率為1 相對資料多餘量為0

bull n1gtgtn2 壓縮率趨近infin 相對資料多餘量趨近1

bull n1ltltn2 壓縮率趨近0 相對資料多餘量趨近-infin

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

原圖片大小2MB 壓縮後1MBCR=21=2RD=1-12=05

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

應用在數位影像壓縮

-三種資料多餘量可用編碼多餘量(coding redundancy)像素間多餘量(interpixel redundancy)心理視覺多餘量(psychovisual redundancy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張影像需要多少bits

由影像的histogram計算影像灰階值的出現機率

( ) ( )3-81 1210 L-knnrp k

kr ==

1每個灰階值需要l(rk)個位元表示

2每個像素的平均位元數為

( ) ( ) ( )4-81 1

0summinus

=

=L

kkrkavg rprlL

3MtimesN個像素的影像需要MtimesNtimesLavg位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

編碼方法

固定長度編碼

每一種狀態使用相同位元數目

可變長度編碼

每一種狀態可用不同位元數目

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 2: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

資料多餘量

資料中某些部份被去除後仍不影響原本所表達的意思則可被去除的部份稱為多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

n1與n2代表相同資訊的兩種表示法

壓縮率

相對資料多餘量

( )1-81 11R

D CR minus=

( )2-81 2

1

nnCR =

bull n1=n2 壓縮率為1 相對資料多餘量為0

bull n1gtgtn2 壓縮率趨近infin 相對資料多餘量趨近1

bull n1ltltn2 壓縮率趨近0 相對資料多餘量趨近-infin

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

原圖片大小2MB 壓縮後1MBCR=21=2RD=1-12=05

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

應用在數位影像壓縮

-三種資料多餘量可用編碼多餘量(coding redundancy)像素間多餘量(interpixel redundancy)心理視覺多餘量(psychovisual redundancy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張影像需要多少bits

由影像的histogram計算影像灰階值的出現機率

( ) ( )3-81 1210 L-knnrp k

kr ==

1每個灰階值需要l(rk)個位元表示

2每個像素的平均位元數為

( ) ( ) ( )4-81 1

0summinus

=

=L

kkrkavg rprlL

3MtimesN個像素的影像需要MtimesNtimesLavg位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

編碼方法

固定長度編碼

每一種狀態使用相同位元數目

可變長度編碼

每一種狀態可用不同位元數目

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 3: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

n1與n2代表相同資訊的兩種表示法

壓縮率

相對資料多餘量

( )1-81 11R

D CR minus=

( )2-81 2

1

nnCR =

bull n1=n2 壓縮率為1 相對資料多餘量為0

bull n1gtgtn2 壓縮率趨近infin 相對資料多餘量趨近1

bull n1ltltn2 壓縮率趨近0 相對資料多餘量趨近-infin

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

原圖片大小2MB 壓縮後1MBCR=21=2RD=1-12=05

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

應用在數位影像壓縮

-三種資料多餘量可用編碼多餘量(coding redundancy)像素間多餘量(interpixel redundancy)心理視覺多餘量(psychovisual redundancy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張影像需要多少bits

由影像的histogram計算影像灰階值的出現機率

( ) ( )3-81 1210 L-knnrp k

kr ==

1每個灰階值需要l(rk)個位元表示

2每個像素的平均位元數為

( ) ( ) ( )4-81 1

0summinus

=

=L

kkrkavg rprlL

3MtimesN個像素的影像需要MtimesNtimesLavg位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

編碼方法

固定長度編碼

每一種狀態使用相同位元數目

可變長度編碼

每一種狀態可用不同位元數目

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 4: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

原圖片大小2MB 壓縮後1MBCR=21=2RD=1-12=05

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

應用在數位影像壓縮

-三種資料多餘量可用編碼多餘量(coding redundancy)像素間多餘量(interpixel redundancy)心理視覺多餘量(psychovisual redundancy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張影像需要多少bits

由影像的histogram計算影像灰階值的出現機率

( ) ( )3-81 1210 L-knnrp k

kr ==

1每個灰階值需要l(rk)個位元表示

2每個像素的平均位元數為

( ) ( ) ( )4-81 1

0summinus

=

=L

kkrkavg rprlL

3MtimesN個像素的影像需要MtimesNtimesLavg位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

編碼方法

固定長度編碼

每一種狀態使用相同位元數目

可變長度編碼

每一種狀態可用不同位元數目

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 5: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理

應用在數位影像壓縮

-三種資料多餘量可用編碼多餘量(coding redundancy)像素間多餘量(interpixel redundancy)心理視覺多餘量(psychovisual redundancy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張影像需要多少bits

由影像的histogram計算影像灰階值的出現機率

( ) ( )3-81 1210 L-knnrp k

kr ==

1每個灰階值需要l(rk)個位元表示

2每個像素的平均位元數為

( ) ( ) ( )4-81 1

0summinus

=

=L

kkrkavg rprlL

3MtimesN個像素的影像需要MtimesNtimesLavg位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

編碼方法

固定長度編碼

每一種狀態使用相同位元數目

可變長度編碼

每一種狀態可用不同位元數目

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 6: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張影像需要多少bits

由影像的histogram計算影像灰階值的出現機率

( ) ( )3-81 1210 L-knnrp k

kr ==

1每個灰階值需要l(rk)個位元表示

2每個像素的平均位元數為

( ) ( ) ( )4-81 1

0summinus

=

=L

kkrkavg rprlL

3MtimesN個像素的影像需要MtimesNtimesLavg位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

編碼方法

固定長度編碼

每一種狀態使用相同位元數目

可變長度編碼

每一種狀態可用不同位元數目

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 7: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

編碼方法

固定長度編碼

每一種狀態使用相同位元數目

可變長度編碼

每一種狀態可用不同位元數目

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 8: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼

1表示L狀態需要log2L位元

2MxN個像素的影像需要MxNx log2L個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 9: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

一張100x100的8階灰階影像需要多少位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 10: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼

1像素依出現機率不同使用不同位元

2影像使用位元數目

[ ]sumsumminus

=

minus

=

=1

0

1

0

M

i

N

jjiavg VBL

Vij是第i行第j列位置的像素值 B[]為表示該像素值所需的位元數

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 11: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

固定長度編碼與可變長度編碼比較

Lavg=2019+2025+2021+3016+4008+5006+6003+6002=27 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 12: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼需要比較少的位元

90011

11

1172

3

=minus=

==

D

R

R

C壓縮率

相對資料多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 13: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

可變長度編碼依灰階值出現機率決定編碼方式

出現機率愈高與編碼位元數愈少

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 14: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

知道灰階值出現機率如何決定編碼方式

Huffman Coding

019 025 021 016 008 006 003 002

005011

019035

040 060

1001

1 01

0

1

0

1

0

10

1 0

11 01 10 001 0001 00001 000001 000000

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 15: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0 11r1 01r2 10r3 001r4 0001r5 00001r6 000001r7 000000

傳送端傳送資料串r0r1r2r3r4r5r6r7

轉換成位元串11 01 10 001 0001 00001 000001 000000

接收端如何收

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 16: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理811 811 編碼多餘量編碼多餘量

r0=045r1=02r2=015r3=01r4=004r5=003r6=002r7=001

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 17: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

計算像素間的相關程度

( ) ( )( ) ( )

( ) ( ) ( ) ( )6-81 1

5-81 0

1

0sum

∆minusminus

=

∆+∆minus

=∆

∆=∆

nN

y

nyxfyxfnN

nA

AnAnγ

A(0)表像素與自己的相關程度

A(∆n)表像素與相鄰∆n的相關程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 18: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

範例

∆n=1時相關程度分別為

09922與09928

可利用像素之間的相似度壓縮

Interpixel redundancyspatial redundancygeometric redundancyinterframe redundancy

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 19: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

原圖

使用何種方式編碼可減少資料儲存量

二值化

影像中一行

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 20: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

使用Run-Length coding

需要bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 21: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

不使用Run-Length需要1024 bits

使用Run-Length需要88bits

91406361111

6361188

1024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 22: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理812 812 像素間多餘量像素間多餘量

用Run-Length Coding整張影像需要12166對

( )( )( )( )( )

06263211

6321112166

13431024

=minus=

==

D

R

R

C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 23: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

心理視覺多餘量利用人類視覺偏好處理影像

人類感覺不明顯的部份可被去除掉不會對

影像品質造成太大的影響

這個處理過程是不可逆的

會失真

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 24: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

改良式灰階量化方法(Improved Gray-Scale Quantization )

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 25: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

1111已經是最大值了所以不處理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 26: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color-216 colors

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 27: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsDiffusion

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 28: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsPattern

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 29: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

Original Web Color - 216 colorsNoise

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 30: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理813 813 心理視覺多餘量心理視覺多餘量

電視交錯式掃描顯示(Interlacing)方法

1秒60張

OddField

EvenField

OddField

EvenField

time

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 31: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

如何判斷兩張影像相似程度

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 32: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

一個像素的誤差

( ) ( ) ( ) ( )7-81 ˆ yxfyxfyxe minus=

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 33: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

具MtimesN個像素之影像的誤差

( ) ( )[ ]sumsumminus

=

minus

=

minus1

0

1

M

x

N

yyxfyxf

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 34: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

均方差(root-mean-square error)

( ) ( )[ ] ( )8-81 ˆ1 21

21

0

1

0 ⎥⎥⎦

⎢⎢⎣

⎡minus= sumsum

minus

=

minus

=

M

x

N

yrms yxfyxf

MNe

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 35: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Signal to Noise Ratio (SNR)計算影像內容與總誤差量的比值

( )

( ) ( )[ ]( )9-81

ˆ

ˆ

21

0

1

0

1

0

1

0

2

sumsum

sumsumminus

=

minus

=

minus

=

minus

=

minus

=M

x

N

y

M

x

N

yms

yxfyxf

yxfSNR

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 36: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

Peak Signal to Noise Ratio (PSNR)計算峰值與總誤差量的比值

( ) ( )[ ] ⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

minus

timestimes=

sumsumminus

=

minus

=

1

0

1

0

2

2

10

ˆ

255log10PSNR M

x

N

y

yxfyxf

NM

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 37: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

81 81 基本原理基本原理814 814 傳真程度判斷傳真程度判斷

使用人眼判斷

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 38: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

前一節所講的三種壓縮方法通常會搭配使用

影像壓縮模型

避免雜訊干擾

去除影像多餘量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 39: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

來源(Source)資料編碼器與解碼器

bull Mapper - 減少像素間多餘量(可逆)bull Quantizer - 減少心理視覺多餘量 (不可逆)bull Symbol encoder - 減少編碼多餘量(可逆)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 40: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

82 82 影像壓縮模型影像壓縮模型

通道(Channel)資料編碼器與解碼器

bull減少通道雜訊對影像的影響

bull 漢明碼(Hamming code)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 41: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

某事件E發生的機率為P(E)表示該事件需要資訊量I(E)

( ) ( ) ( ) ( )1-83 log1log EPEP

EI minus==

其中log的底依所使用的數字系統而定二進位使用log2十進位使用log10十六進位使用log16

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 42: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2P(E1)=P(E2)=05

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 43: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(05)=-log2(12)=log2(2)=1 bit

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 44: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

四個狀態E1E2E3E4 P(Ei)=025 i=1~4

表示E1E2E3E4需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 45: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E)=-log2(025)=-log2(14)=log2(4)=2 bits

二進位表示法要使用log2

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 46: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

兩個狀態E1與E2 P(E1)=025 P(E2)=075

表示E1與E2分別需要幾個位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 47: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(E1)=-log2(025)=-log2(14)=log2(4)=2 bits

I(E2)=-log2(075)=-log2(34)=-log2(3)+log2(4)=-1585+2=0415 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 48: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論831 資訊量量測(Measuring Information)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 49: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

假設所有可能符號集合稱為A 假設A內所有符號發生機率的集合稱為z 即A=a1a2aj z=P(a1)P(a2)P(aj)T

資訊來源的熵(Entropy)或稱uncertainty(不確定性)

( ) ( )

( ) ( ) ( ) ( )sum

sum

=

=

minus=

=

J

jjj

J

jj

aPaPzH

aP

1

1

3-83 log

2-83 1

H(z)稱為熵(Entropy)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 50: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I(r0)=-log2(019)=24I(r1)=-log2(025)=2 I(r2)=-log2(021)=225I(r3)=-log2(016)=264I(r4)=-log2(008)=364I(r5)=-log2(006)=406I(r6)=-log2(003)=506I(r7)=-log2(002)=564

Code1 Code2 與I哪一種比較有效率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 51: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

三種不同編碼方式所需的位元數

Code13 bits

Code 20192+0252+0212+0163+0084+0065+0036+0026=27 bits

H(z) 01924+0252+021225+016264+008364+006406+003506+002564=26503 bits

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 52: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

資訊來源資訊通道與使用者之間的關係

Q為通道的轉換公式即將進來資料轉換成輸出的資料

輸入與輸出一樣(資料沒錯) 否則(資料有錯)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 53: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )

( ) ( ) ( )( )

( )6-83

5-83

4-83

21

22212

12111

1

Qzv

abPabPabP

abPabPabPabPabPabP

Q

aPabPbP

Jkkk

J

J

J

jjjkk

=⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

=

=sum=

L

MLMM

L

L

P(bi|aj)表input第i種狀態output第j種狀態的機率

經過Q運算後資料可能被改變以致資料錯誤

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 54: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

相對資訊(Mutual Information)條件熵函式

對所有bk

相對資訊

( ) ( ) ( ) ( )sum=

minus=J

jkjkjk baPbaPbzH

1

7-83 log

( ) ( ) ( ) ( )9-83 log1 1sumsum= =

minus=J

j

K

kkjkj baPbaPvzH

( ) ( ) ( ) ( )10-83 vzHzHvzI minus=

I(zv)表經過通道後剩餘資訊量

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 55: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

通道容量 (Capacity)

( ) ( ) ( )

( ) ( )( ) ( ) ( )11-83

log

1 1sumsum= =

=

minus=J

j

K

k kj

kjkj bPaP

baPbaP

vzHzHvzI

( ) ( )( )

( )12-83 log1 1

1

sumsumsum= =

=

=J

j

K

kJ

ikii

kjkjj

qaP

qqaPvzI

( )[ ] ( )13-83 maxz

vzIC =

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 56: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

範例假設只傳0與1

1經通道Q後所有可能情形

0經通道Q後所有可能情形

1這個狀態的I1這個狀態的C

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 57: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

pbs = 0發生的機率

I(0)=-log2(05)=1 bitsI(1)=-log2(05)=1 bits

I(0)=-log2(025) 2 bitsI(1)=-log2(075)=0415 bits

0與1發生的機率一樣時Entropy最大

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 58: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

I跟Entropy成正比但受通道錯誤率影響

( )[ ]z

vzIC max=

pbs = 0發生的機率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 59: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

錯誤率05時通道容量最小-最不可預測

錯誤率

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 60: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論832 資訊通道(Channel)

無雜訊編碼定理

雜訊編碼定理

資訊理論

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 61: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

無雜訊編碼定理

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 62: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

雜訊編碼定理

雜訊與傳輸率的關係

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 63: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

資訊理論

4x8影像

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

21 21 21 95 169 243 243 243

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 64: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray Level Count Probability

21 12 38

95 4 18

169 4 18

243 12 38

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 65: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

83 83 基礎資訊理論基礎資訊理論833 基礎編碼定理

Gray-Level Pair Count Probability

(21 21) 8 14

(21 95) 4 18

(95 169) 4 18

(169 243) 4 18

(243 243) 8 14

(243 21) 4 18

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 66: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 67: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Huffman Coding

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 68: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 69: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

算術編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 70: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮8841 41 可變長度編碼可變長度編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 71: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

8844 無錯誤壓縮無錯誤壓縮884242 LZWLZW編碼編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 72: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解1依二進位多項式分解

缺點灰階值差異不大但內容差異大例如127=(01111111)與128=(10000000)

2依Gray code分解

不會因灰階值細微變化而導致大的內容差異例如127=(01000000)128=(11000000)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 73: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解原圖

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 74: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖左邊二進位多項式右邊Gray code

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 75: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

Bit-Plane 分解圖Gray code較易取得位元平面間的差異

低位元位元平面較亂

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 76: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

固定面積編碼(Constant Area CodingCAC)

1將一張ptimesq二元影像切割成多個區塊2有三種區塊全為0全為1混合3出現頻率高的編碼為0

其餘兩個分別編為10或114混合區塊編號後跟隨其內容

可再分子區塊

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 77: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

一維Run Length Coding(1D RLC)bullFAX標準編碼方法bull記錄每一列0的個數與1的個數bull可用可變長度編碼作進一步壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 78: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

二維Run Length Coding(2D RLC)相對位址編碼(Relative Address Coding)

1找出0 to 1或1 to 0轉換點c及同一行前一轉換點e2找出上一行與c同向的轉換點crsquo3若ccrsquo ≧ec則記錄ec長度否則記錄ccrsquo長度 1100 0 11

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 79: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

輪廓追蹤編碼(Contour Tracing and Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 80: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮843 位元面編碼

-表效果比不壓還差

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 81: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

無失真預測編碼(Lossless Predictive Coding)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 82: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

1利用事先設計的預測器(Predictor)估影像內容2記錄預測誤差Predictor設計的好誤差範圍小編碼效果好

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 83: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

84 84 無失真壓縮無失真壓縮844 無失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 84: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 85: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Delta Modulation (DM)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 86: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

範例

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 87: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮851 失真預測編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 88: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 89: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Walsh-Hadamard Transform(WHT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 90: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Discrete Cosine Transform(DCT)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 91: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 92: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 93: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

影像區塊大小的選擇

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 94: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 95: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 96: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 97: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 98: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 99: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 100: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

85 85 失真壓縮失真壓縮852 轉換編碼

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 101: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

bull JPEG(Joint Photographic Expert Group)ndash JPEG (Joint Photographic Experts Group)ndash ISO與CCITT

bull ISOIEC 10918-1 (1991)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 102: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

ndash 失真壓縮方法

bull DCT轉換

bull 量化(Quantization)bull Variable Length Coding

ndash ACndash DC

ndash 支援無失真壓縮方法

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 103: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y

OriginalImage Cb

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

minusminusminusminus=

⎥⎥⎥

⎢⎢⎢

BGR

CrCbY

081304187050503313016870

114058702990times

Cr

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 104: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

411

Y Y

CrCrDown

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 105: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

DCT Quantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

8x8blocks

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 106: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 107: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

x

y

The 8x8 block of pixels

u

v

DCT coefficients

DCACACACACACACACACAC AC

AC ACACAC

AC

AC

AC

ACACACAC

ACACACACACAC

AC

ACAC

ACAC

ACAC

AC

ACAC

ACAC

AC

ACAC

ACAC

ACAC

AC

ACACACACACACACAC

ACAC

ACAC

ACAC

AC

AC

DCT(00) (00)

(77) (77)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 108: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

DCT係數的波型

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 109: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

量化(Quantization)

DCT係數

量化表

Y channel CrCb channels

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9910310011298959272

10112012110387786449

921131048164553524

771031096856372218

6280875129221714

5669574024161314

5560582619141212

6151402416101116

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

9999999999999999

9999999999999999

9999999999999999

9999999999999999

9999999999996647

9999999999562624

9999999966262118

9999999947241817

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 110: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Entropy Coding

DC係數使用DPCM編碼方式

64 68 72 86 100

DC =64 68 72 86 100 DC差異值=64 4 4 14 14

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 111: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

AC係數使用Zig-Zag掃描方式以及Run-length coding

2

5

9

12

20

23

35

37

increasing horizontal frequency

increasingverticalfrequency

1

3

4

10

11

21

22

36

6

8

13

19

24

34

38

49

7

14

18

25

33

39

48

50

28

30

42

45

53

56

60

63

39

43

44

54

55

61

62

64

16

27

31

41

46

52

57

59

15

17

26

32

40

47

51

58

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 112: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

範例

DCT係數

量化後結果

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 113: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

按Zig-Zag順序排列

編碼結果

Run=(0-3)(01)(0-3)(0-2)(0-6)(02)(0-4)(01)(0-4)(01)(01)(05)(12)(2-1)(02)(5-1)(0-1)EOB

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 114: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 115: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

亮度編碼表

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 116: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 117: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Table 819 (Conrsquot)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 118: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

解壓縮

InverseDCT

InverseQuantization

QuantizationTable

VariableLengthCoding

YCompressed

Image

CodingTable

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 119: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y Y

CrCrup

sampling

CbCb

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 120: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準862 862 連續色調靜態影像壓縮連續色調靜態影像壓縮

Y R

Cb G⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡minusminus=

⎥⎥⎥

⎢⎢⎢

CrCbY

BGR

0772117141403441401402101

times

Cr B

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 121: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

bull 視訊會議

ndash H261-T1專線

ndash H263-低傳輸率(10-30kbps)ndash H264-ISDN

bull 多媒體

ndash MPEG-1VCD 15Mbpsndash MPEG-2CableTV DVD 2~10Mbpsndash MPEG-4低速傳輸5~64Kbps

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 122: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEGI pictureIntra pictureP picturePredicted pictureB picturesBi-directionally predicted picture

I B P PB B B BB B

Group Of Picture(GOP)

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮
Page 123: No Slide Title - 南華大學CSIE/ycliaw/DIP/08_Image_Compression.pdf · 8.1 基本原理基本原理 8.1.1 編碼多餘量編碼多餘量 可變長度編碼 1.像素依出現機率不同使用不同位元

Digital Image Processing 2nd edDigital Image Processing 2nd edwwwimageprocessingbookcom

copy 2002 R C Gonzalez amp R E Woods

86 86 影像壓縮標準影像壓縮標準863 863 動態影像壓縮標準動態影像壓縮標準

MPEGMPEG

  • 第八章 影像壓縮