EE465: Introduction to Digital Image Processing1 Data Compression Techniques Text: WinZIP, WinRAR...
-
Upload
alexandrina-murphy -
Category
Documents
-
view
241 -
download
0
Transcript of EE465: Introduction to Digital Image Processing1 Data Compression Techniques Text: WinZIP, WinRAR...
EE465: Introduction to Digital Image Processing 1
Data Compression Techniques
Text: WinZIP, WinRAR (Lempel-Ziv compression’1977)
Image: JPEG (DCT-based), BMP (run-length coding)
Video: VCD/DVD (MPEG), Real Player/Windows Media Player (H.263/H.264), BluRay
Audio and Speech: MP3, G.728 (CELP)
EE465: Introduction to Digital Image Processing 2
Lossless vs. Lossy Compression
One is original and the other is compressed, which one is original?
Mathematical lossy can still be visually lossless
EE465: Introduction to Digital Image Processing 3
Engineering is About Design and Implementation
cost
performance
Product A
Product B
EE465: Introduction to Digital Image Processing 4
A Tour of JPEG Coding Algorithm
Flow-chart diagram of DCT-based coding algorithm specified by Joint Photographic Expert Group (JPEG)
T Q C
EE465: Introduction to Digital Image Processing 5
First Building Block: 8-by-8 DCT
8881
1811
88
......
............
............
......
aa
aa
A
81,82,16
)1)(12(cos
2
1
81,1,8
1
lkkl
lkakl
i
jDC
TAXAY X T
EE465: Introduction to Digital Image Processing 6
Transform Coding of Images
Why not transform the whole image together? Require a large memory to store transform
matrix It is not a good idea for compression due to
spatially varying statistics within an imageIdea of partitioning an image into blocks
Each block is viewed as a smaller-image and processed independently
It is not a magic, but a compromise
EE465: Introduction to Digital Image Processing 7
Block Processing under MATLAB
Type “help blkproc” to learn the usage of this function B = BLKPROC(A,[M N],FUN) processes the
image A by applying the function FUN to each distinct M-by-N block of A, padding A with zeros if necessary.
ExampleI = imread('cameraman.tif'); fun = @dct2; J = blkproc(I,[8 8],fun);
EE465: Introduction to Digital Image Processing 8
Block-based DCT Example
JI
note that white lines are artificially added to the border of each 8-by-8 block to denote that each block is processed independently
EE465: Introduction to Digital Image Processing 9
Boundary Padding
padded regions
Example
1213141516171819
1213141516171819
1213141516171819
1213141516171819
When the width/height of an image is not the multiple of 8, the boundary isartificially padded with repeated columns/rows to make them multiple of 8
EE465: Introduction to Digital Image Processing 10
Work with a Toy Example
169130
173129
170181
170183
179181
182180
179180
179179169132
171130
169183
164182
179180
176179
180179
178178167131
167131
165179
170179
177179
182171
177177
168179169130
165132
166187
163194
176116
15394
153183
160183
Any 8-by-8 block in an image is processed in a similar fashion
EE465: Introduction to Digital Image Processing 11
Encoding Stage I: Transform
• Step 1: DC level shifting
169130
173129
170181
170183
179181
182180
179180
179179169132
171130
169183
164182
179180
176179
180179
178178167131
167131
165179
170179
177179
182171
177177
168179169130
165132
166187
163194
176116
15394
153183
160183
412
451
4253
4255
5153
5452
5152
5151414
432
4155
3654
5152
4851
5251
5050393
393
3751
4251
4951
5443
4949
4051412
374
3859
3566
4812
2534
2555
3655
128 (DC level)
_
EE465: Introduction to Digital Image Processing 12
• Step 2: 8-by-8 DCT
412
451
4253
4255
5153
5452
5152
5151414
432
4155
3654
5152
4851
5251
5050393
393
3751
4251
4951
5443
4949
4051412
374
3859
3566
4812
2534
2555
3655
13
42
12
09
40
21
13
4430
55
47
73
30
46
32
16113
916
109
621
179
3310
810
17201024
2727
132
6078
4413
1827
2738
56313
Encoding Step 1: Transform (Con’t)
88DCT
EE465: Introduction to Digital Image Processing 13
Second Building Block: Quantization
99103
101120
100112
121103
9895
8778
9272
644992113
77103
10481
10968
6455
5637
3524
22186280
5669
8751
5740
2922
2416
1714
13145560
6151
5826
4024
1914
1610
1212
1116
Q-table
8,1
ˆ:
:
1
ji
Qsxf
Q
xsf
ijijij
ij
ijij
: specifies quantization stepsize (see slide #28)
Notes: Q-table can be specified by customerQ-table is scaled up/down by a chosen quality factor Quantization stepsize Qij is dependent on the coordinates (i,j) within the 8-by-8 block Quantization stepsize Qij increases from top-left to bottom-right
EE465: Introduction to Digital Image Processing 14
Encoding Stage II: Quantization (Con’t)
13
42
12
09
40
21
13
4430
55
47
73
30
46
32
16113
916
109
621
179
3310
810
17201024
2727
132
6078
4413
1827
2738
56313
00
00
00
00
00
00
00
0000
00
00
00
00
00
00
0000
00
00
01
10
11
01
1100
01
01
23
21
13
23
520
Example
f
xijsij
EE465: Introduction to Digital Image Processing 15
The Third Building Block: Entropy Coding
Zigzag Scan
00
00
00
00
00
00
00
0000
00
00
00
00
00
00
0000
00
00
01
10
11
01
1100
01
01
23
21
13
23
520
(20,5,-3,-1,-2,-3,1,1,-1,-1,0,0,1,2,3,-2,1,1,0,0,0,0,0,0,1,1,0,1,EOB)
zigzag scan
End Of the Block:All following coefficients are zero
EE465: Introduction to Digital Image Processing 16
Run-length Coding
(20,5,-3,-1,-2,-3,1,1,-1,-1,0,0,1,2,3,-2,1,1,0,0,0,0,0,0,1,1,0,1,EOB)
DCcoefficient
ACcoefficient
- DC coefficient : DPCM coding- AC coefficient : run-length coding (run, level)
(5,-3,-1,-2,-3,1,1,-1,-1,0,0,1,2,3,-2,1,1,0,0,0,0,0,0,1,1,0,1,EOB)
(0,5),(0,-3),(0,-1),(0,-2),(0,-3),(0,1),(0,1),(0,-1),(0,-1),(2,0),(0,1),(0,2),(0,3),(0,-2),(0,1),(0,1),(6,0),(0,1),(0,1),(1,0),(0,1),EOB
Huffman codingencoded bit stream
encoded bit stream
EE465: Introduction to Digital Image Processing 17
JPEG Decoding Stage I: Entropy Decoding
(20,5,-3,-1,-2,-3,1,1,-1,-1,0,0,1,2,3,-2,1,1,0,0,0,0,0,0,1,1,0,1,EOB)
Huffman decodingencoded bit stream
AC coefficients
DC coefficient
DPCM decoding
(0,5),(0,-3),(0,-1),(0,-2),(0,-3),(0,1),(0,1),(0,-1),(0,-1),(2,0),(0,1),(0,2),(0,3),(0,-2),(0,1),(0,1),(6,0),(0,1),(0,1),(1,0),(0,1),EOB
encoded bit stream
EE465: Introduction to Digital Image Processing 18
JPEG Decoding Stage II: Inverse Quantization
(20,5,-3,-1,-2,-3,1,1,-1,-1,0,0,1,2,3,-2,1,1,0,0,0,0,0,0,1,1,0,1,EOB)
00
00
00
00
00
00
00
0000
00
00
00
00
00
00
0000
00
00
01
10
11
01
1100
01
01
23
21
13
23
520
zigzag
00
00
00
00
00
00
00
0000
00
00
00
00
00
00
0000
00
00
040
290
2416
014
131400
051
026
8072
3814
1630
2436
55320
f-1
EE465: Introduction to Digital Image Processing 19
JPEG Decoding Stage III: Inverse Transform
00
00
00
00
00
00
00
0000
00
00
00
00
00
00
0000
00
00
040
290
2416
014
131400
051
026
8072
3814
1630
2436
55320
169130
185127
170181
162192
179181
181184
179180
178183173128
161129
169191
175186
174181
168186
178181
182172170131
177128
170185
166187
171187
168172
180169
169174175124
170120
168193
171197
158143
148119
153186
140195
412
571
4253
3464
5153
5356
5152
5055450
331
4163
4758
4653
4058
5053
5444423
490
4257
3859
4359
4044
5241
4146474
438
4065
4369
3015
209
2558
1267
88IDCT
128 (DC level)
+
EE465: Introduction to Digital Image Processing 20
Quantization Noise
169130
173129
170181
170183
179181
182180
179180
179179169132
171130
169183
164182
179180
176179
180179
178178167131
167131
165179
170179
177179
182171
177177
168179169130
165132
166187
163194
176116
15394
153183
160183
169130
185127
170181
162192
179181
181184
179180
178183173128
161129
169191
175186
174181
168186
178181
182172170131
177128
170185
166187
171187
168172
180169
169174175124
170120
168193
171197
158143
148119
153186
140195
X X^
MSE=||X-X||2^Distortion calculation:
Rate calculation: Rate=length of encoded bit stream/number of pixels (bps)
EE465: Introduction to Digital Image Processing 21
JPEG Examples
1000
90 (58k bytes)50 (21k bytes)10 (8k bytes)
best quality,
lowest compression
worst quality,
highest compression
EE465: Introduction to Digital Image Processing 22
Rate-Distortion Tradeoff
EE465: Introduction to Digital Image Processing 23
Block artifacts of JPEG when the bit rate is low (0.25bpp)
EE465: Introduction to Digital Image Processing 24
JPEG Coding Algorithm Summary
EE465: Introduction to Digital Image Processing 25
Lossy Compression of Color Images
Color-space transformation
B
G
R
C
C
Y
b
r
063.0375.0438.0
45.03.015.0
1.06.03.0luminance
chrominance
b
r
C
C
Y
B
G
R
021
7994.03341.01
5987.10016.01
inverse transform
forward transform
Luminance channel can be treated just like a gray-scale image
EE465: Introduction to Digital Image Processing 26
Compression of Chrominance Channels
Human eye is relatively insensitive to the high-frequencycontent of the chrominance channels.
Down-sampling
2
Cr/Cb
Q-Table
9999
9999
9999
9999
9999
9999
9999
99999999
9999
9999
9999
9999
9999
9999
99999999
9999
9999
9999
9999
9956
6647
26249999
9999
9999
9999
6626
4724
2118
1817
EE465: Introduction to Digital Image Processing 27
Technology is About New Tools
The same design principle but each building block can be replaced by a more advanced technique Transform: DCT becomes Wavelet Transform Quantization: uniform quantization becomes
bitplane coding (to support scalability) Entropy coding: Huffman coding becomes
arithmetic coding (more flexible)
JPEG becomes JPEG2000
EE465: Introduction to Digital Image Processing 28
A Glimpse into Wavelet Transform*
Multi-Resolution Analysis in Vision
Human vision system is capable of interpretingthe visual information regardless of the resolution
EE465: Introduction to Digital Image Processing 29
Progressive Image Transmission
I hate to wait – show me a piece and see if I like it or not
Low-resolution (LR)
High-resolution (HR)
EE465: Introduction to Digital Image Processing 30
Haar Transform – the simplest wavelet transform
2
12
1
,
2
12
1
,11
11
2
12121 bbbbA
TAXAY
Example
5050
100100X
050
0150Y
EE465: Introduction to Digital Image Processing 31
Reordering Coefficients
5050
5050
5050
5050100100
100100
100100
100100
X
Apply Haar transformto each 2-by-2 block
00
0100
00
010000
0200
00
0200
Y regrouping
00
00
00
0000
00
100100
200200
Y
HHHL
LHLL
approximation horizontal details
diagonal detailsvertical details
EE465: Introduction to Digital Image Processing 32
Multi-level Wavelet Transform
5050
5050
5050
5050100100
100100
100100
100100
X
Apply one-level Haar transform
00
00
00
0000
00
100100
200200
Y
Apply Haar transformto Low-Low band only
00
00
00
0000
00
0100
0300
Z
11
1
HHHL
LH22
22
HHHL
LHLL
EE465: Introduction to Digital Image Processing 33
Image Example
EE465: Introduction to Digital Image Processing 34
Wavelet Image Compression
WaveletTransform
ScalarQuantization
EntropyCodingimage
compressedbit stream
Major improvements
Wavelet transform instead of DCT
Arithmetic coding instead of Huffman coding
Modeling location instead of intensity
Those are the topics in EE565: Advanced Image Processing
EE465: Introduction to Digital Image Processing 35
FBI Wavelet Scalar Quantization (WSQ) Standard
Established by FBI in 1990s as the standard for fingerprint image compression
Wavelet-based: Daubechies’ wavelets were built just in time to win the race
Demonstrate better Rate-Distortion performance than DCT-based JPEG standard
EE465: Introduction to Digital Image Processing 36
JPEG2000 Standard
Developed by ISO in late 1990s to replace the DCT-based JPEG standard
Accumulative research progress on wavelet image compression has dramatically pushed the art of lossy image compression forward
Demonstrate much better Rate-Distortion performance than DCT-based JPEG standard for typical photographic images
EE465: Introduction to Digital Image Processing 37
Wavelet vs. DCT
JPEG (CR=64) JPEG2000 (CR=64)
discrete cosine transform based wavelet transform based
EE465: Introduction to Digital Image Processing 38
BIGGER Question
Why haven’t we seen JPEG being replaced by JPEG2000?
Technical superiority DO NOT always imply economical wins (think about Unix vs. Windows)
THE next image compression standard has to wait for the right timing
Anyone including you can be a part of that business