Documente Academic
Documente Profesional
Documente Cultură
– Forward transform
In the form of inner product
Min Wu Project a vector onto a new set of basis to obtain N “coefficients”
power of 2
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [3] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [4]
1
Haar Transform Compare Basis Images of DCT and Haar
1 1 1 1 1 1 1 1
1 1 1 1 −1 −1 −1 − 1
Haar transform H 2 2 − 2 − 2 0 0 0 0
1 0 0 0 0 2 2 − 2 − 2
– Sample hk(x) at {m/N} 8 2 −2 0 0 0 0 0 0
0 0 2 −2 0 0 0 0
m = 0, …, N-1
0 0 0 0 2 −2 0 0
0 0 0 0 0 0 2 −2
– Real and orthogonal
– Transition at each scale p is
localized according to q
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [5] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [6]
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [7] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [8]
2
From Ken Lam’s DCT talk 2001 (HK Polytech)
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [9] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [11]
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [12] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [13]
3
E.g. of Entropy Coding: Huffman Coding Huffman Coding (cont’d)
Variable length code
– assigning about log2 (1 / pi) bits for the ith value
has to be integer# of bits per symbol 000 00 S0 0.25 0
0.54 0
001 10 S1 0.21 0
Step-1 1 1.0
010 010 S2 0.15 0
– Arrange pi in decreasing order and consider them as tree leaves 1
0.29 1
011 011 S3 0.14 0.46
Step-2 100 1100 S4 0.0625 0
0.125
– Merge two nodes with smallest prob. to a new node and sum up prob. 101 1101 S5 0.0625 1 0 1
0.25
– Arbitrarily assign 1 and 0 to each pair of merging branch 110 1110 S6 0.0625 0 1
0.125
Step-3 111 1111 S7 0.0625 1
– Repeat until no more than one node left. PCM Huffman
– Read out codeword sequentially from root to leaf
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [15] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [16]
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [17] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [18]
4
Probability Model of Run-
Run-Length Coding How to Encode Correlated Sequence?
Consider: high correlation between successive samples
Assume successive “0” occur independently w.p. p
Predictive coding
Prob. of getting an L runs of “0” (L=0,1, …, M)
– Basic principle: Remove redundancy between successive pixels and only
– P( L ) = pL (1-p) for 0 <= l <= M-1 (geometric distribution) encode residual between actual and predicted
– P( L ) = pM for L=M – Residue usually has much smaller dynamic range
Allow fewer quantization levels for the same MSE => get compression
Avg. # binary symbols per run – Compression efficiency depends on intersample redundancy
– Savg = ΣL (L+1) pL (1-p) + M pM = (1 – pM ) / ( 1 – p ) First try u(n) e(n) eq(n)
Quantizer
– Compression ratio C = Savg / log2 (M+1) = (1 – pM ) / [( 1–p ) log2(M+1)] _
Predictor Encoder
Example
– P = 0.9, M=15 Savg = 7.94, C = 1.985, H = 0.469 bpp eq(n) uq (n)
– Avg. run-length coding rate Bavg = 4 bit / 7.94 ~ 0.516 bpp +
Predictor Decoder
– Coding efficiency = H / Bavg ~ 91% uq~(n)
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [19] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [20]
+ Run-length
– Use quantized sequence uq(n) for Predictor
uq~(n)
prediction at both encoder and decoder
– Predictive coding
uq~(n)= f( uq(n-1), uq(n-2), …, uq(n-m) )
Decoder
– Prediction error e(n) Next time: transform coding
– Quantized prediction error eq(n)
What predictor to use?
– Distortion d(n) = e(n) – eq(n)
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [21] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [22]
5
Assignment
Readings
– Jain’s 11.1-11.3
Reference
– Bovik’s Handbook Sec.5.1 ENE631 Course Project: Introduction
Announcement
– 1st in-class exam will be given after “Image Compression”
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [23] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [24]
M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [25] M. Wu: ENEE631 Digital Image Processing (Fall'01) Lec7 – Image Compression 9/20/01 [26]