Image Compression

advertisement
Image Compression
Presenter:
Jin-Zuo Liu
Research Advisor:
Jian-Jiun Ding , Ph. D.
Digital Image and Signal Processing Lab
Graduate Institute of Communication Engineering
National Taiwan University
1
Outlines
 Introduction to Image compression
 JPEG Standard
 JPEG2000 Standard
 Shape-Adaptive Image Compression
 Modified JPEG Image Compression
 Conclusions
 Reference
2
Image Storage System
Camera
C
R-G-B
coordinate
Transform to
Y-Cb-Cr
coordinate
Object
Downsample
Chrominance
Encoder
Performance
RMSE
PSNR
HDD
Upsample
Chrominance
Decoder
Monitor
C
R-G-B
coordinate
V
3
Transform to
R-G-B
coordinate
 Transform function:
Y   0.299 0.587 0.114   R  0 
Cb    0.169 0.334 0.500  G   128
  
   
Cr   0.500 0.419 0.081  B  128
 Y: the luminance represents the brightness
 Cb: the difference between the gray and blue
 Cr: the difference between the gray and red
4
 Downsampling formats of YCbCr
(a) 4 : 4 : 4
W
H
Y
(b) 4 : 2 : 2
W
H
Y
(c) 4 : 2 : 0
W
H
W/2
W
W/2
H/2
H
Cb
H
W
5
Cr
W/2
W/2
H
Cb
Cb
H/2
H
Y
Cr
(d) 4 : 1 : 1
W
H
Y
W/4
H C
b
W/4
Cr
H Cr
Performance measures

n1: the data quantity of original image
n1
CR 
n2
n2:the data quantity of the generated bitstream.
W 1 H 1

RMSE 
  f ( x, y)  f '( x, y)
2
x 0 y 0
WH
W: the width
H : the height of the
original image

6
255
PSNR  20 log 10
MSE
Outlines
 Introduction to Image compression
 JPEG Standard
 JPEG2000 Standard
 Shape-Adaptive Image Compression
 Modified JPEG Image Compression
 Conclusions
 Reference
7
JPEG flowchart
G
R
B
YCbCr Color
Transform
Image
Quantizer
Quantization
Table
8
Chrominance
Downsampling
(4:2:2 or 4:2:0)
Zigzag &
Run Length
Coding
Huffman
Encoding
Differential
Coding
Huffman
Encoding
8×8
FDCT
Bit-stream
Why we apply DCT?
 Reduce the correlation between the neighboring pixels in the
image
 coordinate rotation
the f2th pixel value
Y
X
the f1th pixel value
︱ f1-f2 ︱= 3 pixels in horizontal
9
Covariance Matrix
Step1: Image partition
Step2: Re-aligned the pixels of a 2-D block into a
1-D vector
10
 E  x1 m  x1 m  

 
C xx  

 E  xN m  x1 m  

 
m
m
E  x1  xN   



m
m
E  xN  xN   

Karhunen-Loeve Transform (KLT)
 Coordinate rotation
y
m
 V t x
m
 Normal orthogonal transformation


 
t
 m  m t 
t  m
t  m 
t


Cyy  E V x V x
V E x x
V  Vt Cxx V




V = [ v1 v2
. .vN ]
vi :the eigenvector of the corrosponding
eigenvalue λi of Cxx
11
( i =1 ~N )
DCT V.S KLT

KLT is the Optimal Orthogonal Transform with minimal MSE
but is difficult to implement

DCT is the limit situation of KLT

DCT advantages:
1. Eliminate the dependence on image data
2. Obtain the general transformation for every
image
3. Reduce the correlation between pixels just
like KLT
4. Smaller computation time
5. Real numbers
12
Discrete Cosine Transform (DCT)
 Forward 2-D Discrete Cosine Transform
7
7
1
  (2 x  1)u 
  (2 y  1)v 
F (u, v)  C (u )C (v) f ( x, y ) cos 
cos



4
16
16

x 0 y 0
for u  0,..., 7 and v  0,..., 7

1/ 2 for k  0
where C (k )  

 1 otherwise
 Inverse 2-D Discrete Cosine Transform
2 N 1 N 1
  (2 x  1)u 
  (2 y  1)v 
f ( x, y) 
C
(
u
)
C
(
v
)
F
(
u
,
v
)
cos
cos

 2M

 2 N

MN u 0 v 0
for x  0,..., M  1 and y  0,..., N  1
f(x,y) : the element in spatial domain
F(u,v) : the DCT coefficient in the frequency domain
13
Discrete Cosine Transform (DCT)
8×8 DCT
14
JPEG Quantization
 Qantization:
 F (u, v) 
F (u, v)Quantization  round 

Q
(
u
,
v
)


 Qantization table
15
DPCM for DC Components
 large correlation still exists between the DC components in
the neighboring macroblocks
DCi-1
…
16
Blocki-1
DCi
Blocki
Diffi = DCi - DCi-1
…
Grouping method for DC component
Values
Bits for the value
0
17
group
0
-1,1
0,1
1
-3,-2,2,3
00,01,10,11
2
-7,-6,-5,-4,4,5,6,7
000,001,010,011,100,101,110,111
3
-15,...,-8,8,...,15
0000,...,0111,1000,...,1111
4
-31,...,-16,16,...31
00000,...,01111,10000,...,11111
5
-63,...,-32,32,...63
000000,...,011111,100000,...,111111
6
-127,...,-64,64,...,127
0000000,...,0111111,1000000,...,1111111
7
-255,..,-128,128,..,255
...
8
-511,..,-256,256,..,511
...
9
-1023,..,-512,512,..,1023
...
10
-2047,...,-1024,1024,...,2047
...
11
Grouping method for DC component
Example: diff=17
(17)10 = (10001)2
group 5 codeword: (110)2
→ code: (11010001)2
18
Zigzag Scanning of the AC Coefficients
19
Run Length Coding of the AC
Coefficients
 The RLC step replaces the quantized values by
(RUNLENGTH , VALUE)
the number of zeros
the nonzero coefficients
 Example:
the zig-zag scaned 63 AC coefficients:
57, 45, 0, 0, 0, 0, 23, 0,
 30, 16, 0, 0, 1, 0, 0, 0,0, 0, 0, 0, ..., 0
Perform RLC :
20
 0,57   0, 45   4, 23 1, 30   0, 16   2,1 EOB 
The Run/Size Huffman table for the
luminance AC coefficients
Run/Size
code length
code word
0/0 (EOB)
4
1010
15/0 (ZRL)
11
11111111001
0/1
2
00
7
1111000
0/10
16
1111111110000011
1/1
4
1100
1/2
5
11011
1/10
16
1111111110001000
2/1
5
11100
16
1111111110011000
16
1111111111111110
...
0/6
...
...
...
4/5
...
15/10
21
Outlines
 Introduction to Image compression
 JPEG Standard
 JPEG2000 Standard
 Shape-Adaptive Image Compression
 Modified JPEG Image Compression
 Conclusions
 Reference
22
The JPEG 2000 Standard
 JPEG2000 fundamental building blocks
B
G
R
Image
Forward
Component
Transform
Context
Modeling
2D DWT
Arithmetic
Coding
Tier-1
23
JPEG 2000
Bit-stream
Quantization
EBCOT
RateDistortion
Control
Tier-2
Discrete Wavelet Transform
 The analysis filter bank of the 2-D DWT
Rows
Columns
h (n)
24
↓2
WD ( j , m, n)
h ( m)
↓2
WV ( j , m, n)
h ( m)
↓2
WH ( j , m, n)
h ( m)
↓2
W ( j , m, n)
↓2
W ( j  1, m, n)
h ( n)
h ( m)
↓2
Wavelet Transforms in Two Dimension
 Two-scale of 2-D decomposition
LL2
HL2
H

W ( j , m, n) W ( j , m, n)
HL1
LH2
HH2
W ( j  1, m, n)
WV ( j , m, n) WD ( j , m, n)
25
LH1
HH1
Discrete Wavelet Transform
One-scale of 2-D DWT
26
Outlines
 Introduction to Image compression
 JPEG Standard
 JPEG2000 Standard
 Shape-Adaptive Image Compression
 Modified JPEG Image Compression
 Conclusions
 Reference
27
Shape-Adaptive Image Compression
 Block-based transformation disadvantages:
1. block effect
2. no take advantage of the local
characteristics in an image segment
28
Shape-Adaptive Image Compression
 Algorithm structure
Boundary Descriptor
Boundary
Boundary
Transform
Coding
Quantization
And
Entropy Coding
Image
Segmentation
Interal texture
Bit-stream
Arbitrary Shape
Transform
Coding
Quantization
And
Entropy Coding
Coefficients of Transform Bases
29
Shape-Adaptive Transformation(1)
 Padding Algorithm
 Padding zeros into the pixel positions out of the image segment
0
0
105 98
30
0
0
75
96
0
0
99 101
73
85
66
60
0
100
97
89
94
87
64
55
0
0
84
94
90
81
71
66
0
0
93
86
94
81
70
0
0
0
0
86
86
81
72
0
0
0
0
98
97
78
0
0
0
0
0
105 104
0
0
0
Shape-Adaptive Transformation(2)
 Arbitrarily-Shaped DCT Bases
2C (u)C (v) W 1 H 1
  (2 x  1)u 
  (2 y  1)v 
F (u, v) 
f
(
x
,
y
)
cos
cos

 2W

 2H

H *W x 0 y 0
 For u  0,..., W  1 and v  0,..., H  1 , where

1 / 2 for k  0
C (k )  

 1 otherwise
 W: the width of the image segment
 H: the height of the image segment
31
Shape-Adaptive Transformation(2)
 Arbitrarily-Shaped DCT Bases
0
1
2
3
4
5
6
0
0
0
0
0
1
1
0
0
1
1
1
1
1
1
1
1
1
2
0
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
0
0
3
4
5
6
0
0
0
1
1
0
The shape matrix
0
0
7
The 8x8 DCT bases with the shape
32
7
Gram-Schmidt algorithm
 The 37 arbitrarily-shape orthogonal DCT bases
33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Shape-Adaptive Transformation(3)
 Shape-Adaptive DCT Algorithm ( SADCT )
x
y
x
DC values
x
u
DCT-1
DCT-2
DCT-3
DCT-4
DCT-6
DCT-3
y'
(a)
(b)
x
x'
u
34
DCT-6
DCT-5
DCT-4
DCT-2
DCT-1
DCT-1
u
(d)
DC coefficients
(e)
(c)
v
u
(f)
Shape-Adaptive DCT Algorithm
( SADCT )
 The variable length (N-point) 1-D DCT transform matrix
DCT-N
 
1  
DCT-N( p, k )  c0  cos  p  k     ,
2 N
 
1 / 2 for p  0
C ( p)  
 1 otherwise
 Transform function:
c j  (2 / N )  DCT-N  x j
35
k , p  0  N 1
p: the pth DCT basis vector
Morphological Erosion
Input Image
36
Image
Segmentation
Morphological
Operation (Erosion)
Shape
Adaptive DCT
Output
Bitstream
Entropy Coding
Quantization
Morphological Erosion
Contour sub-region
The overall
object
Interior sub-region
37
Morphological Erosion
 Algorithm structure
Segmentation
+
boundaries extraction
Interior sub -regions
Shapeadaptive
DCT
Contour sub-regions
Shapeadaptive
DCT
38
Shape-Adaptive Image Compression
Image segments
DCT coefficients
Quantizing & encoding
100111101010
M1
EOB
101010111111111001
S.A.
DCT
boundary
encoding
EOB
M2
111000111000101011111
EOB
M3
bit stream of
boundaries
combine
Bit-stream of image
segments
100111101010
EOB 1010101111111110
1010101011011111
01
39
EOB 111000111000101011111
EOB
Simulation Results
43
42.5
SADCT
SADCT with erosion
SADCT
SADCT with erosion operation
SADCT
SADCT with erosion
42
[dB]
41.5
41
PSNR
40.5
40
39.5
39
38.5
38
0.4
0.5
0.6
0.7
Bitrate(×104)
40
0.8
[Bits]
0.9
1
1.1
Outlines
 Introduction to Image compression
 JPEG Standard
 JPEG2000 Standard
 Shape-Adaptive Image Compression
 Modified JPEG Image Compression
 Conclusions
 Reference
41
Modified JPEG Image Compression
 2-D Orthogonal DCT Expansion in
Triangular and Trapezoid Regions
(a)
(b)
p
All 8X8 rectangular blocks
42
Triangular, trapezoid or rectangular
blocks
Trapezoid Definition
 Define the trapezoid :
K  m  K  M  1  m is a constant.
(M-1)th row
(M-2)th row
.
.
.
.
.
.
1st row
0th row
43
Trapezoid Definition
 Shearing a region that satisfies into the trapezoid region
whose first pixels in each row are aligned at the same column.
(a)
(b)
Shearing
 A triangular region can be viewed as a special case of the
trapezoid region where
(M-1)th row
.
.
.
.
1st row
44
0th row
Complete and Orthogonal DCT Basis in
the Trapezoid Region
(a)
m = M-1
m = M-2
.
.
.
.
.
.
m=1
m=0
n=0 1 2
(b)
Region A
Rotation by 180 ∘
Region B
Region A
Region B
Rectangular Region
45
Complete and Orthogonal DCT Basis in
the Trapezoid Region
(a)
(b)
2
2
4
4
2 4 6 8 10
2
2
2
4
2 4 6 8 10
2
4
2 4 6 8 10
2 4 6 8 10
2
4
2 4 6 8 10
2 4 6 8 10
2
4
2 4 6 8 10
2
4
4
2 4 6 8 10
2
4
2 4 6 8 10
2 4 6 8 10
2
4
2 4 6 8 10
2
4
4
2 4 6 8 10
2
4
2 4 6 8 10
2
4
2 4 6 8 10
2
4
46
2
4
2 4 6 8 10
2 4 6 8 10
Finding an approximate trapezoid
region in an arbitrary shape
(b)
(a)
approximate
(a)
47
(b)
Modified JPEG Image Compression
 Divide Images into three regions:
Trapezoid and triangular
regions
8X8 SADCT image blocks
Traditional 8X8 image
blocks
48
Simulation Results
(a) JPEG 692 Bytes
(b) Proposed scheme 165 Bytes
50
50
100
100
49
50
100
50
100
Simulation Results
50
Reference








51
[1] R. C. Gonzalea and R. E. Woods, "Digital Image Processing", 2nd Ed.,
Prentice Hall, 2004.
[2] Liu Chien-Chih, Hang Hsueh-Ming, "Acceleration and
Implementation of JPEG 2000 Encoder on TI DSP platform" Image
Processing, 2007. ICIP 2007. IEEE International Conference on, Vo1. 3,
pp. III-329-339, 2005.
[3] ISO/IEC 15444-1:2000(E), "Information technology-JPEG 2000
image coding system-Part 1: Core coding system", 2000.
[4] Jian-Jiun Ding and Jiun-De Huang, "Image Compression by
Segmentation and Boundary Description", Master’s Thesis, National
Taiwan University, Taipei, 2007.
[5] Jian-Jiun Ding and Tzu-Heng Lee, "Shape-Adaptive Image
Compression", Master’s Thesis, National Taiwan University, Taipei,
2008.
[6] G. K. Wallace, "The JPEG Still Picture Compression Standard",
Communications of the ACM, Vol. 34, Issue 4, pp.30-44, 1991.
[7] 張得浩,“新一代JPEG 2000之核心編碼 — 演算法及其架
構(上) ”,IC設計月刊 2003.8月號.
[8] 酒井善則、吉田俊之 共著,白執善 編譯,“影像壓縮
技術”,全華,2004.
Thank you for listening ~
52
Download