Professional Documents
Culture Documents
Data vs Information
Information = Matter ()
Image Compression
Concept: assign the longest code word to the symbol with the least
probability of occurrence.
Interpixel redundancy:
Parts of an image are
highly correlated.
Binary image
= 343x1024x1 = 351232 bits
Line 100: (1,63) (0,87) (1,37) (0,5) (1,4) (0,556) (1,62) (0,210)
Total 12166 runs, each run use 11 bits Total = 133826 Bits
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Psychovisual Redundancy
8-bit gray scale 4-bit gray scale 4-bit IGS
image image image
False
contours
The eye does not response with equal sensitivity to all visual
information. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Improved Gray Scale Quantization
2. Keep only the most significant 4 bits of Sum for IGS code.
Fidelity Criteria: how good is the compression algorithm
Noise Channel
Source encoder
f ( x, y ) Mapper Quantizer Symbol encoder
Source decoder
Measuring information
1
I ( E ) log log P( E )
P( E )
H P( a j ) log( P ( a j ))
j
Simple Information System
Mutual
information I(z,v)=H(z) - H(z|v)
Capacity C max I ( z, v )
z
Binary Symmetric Channel
Let pe = probability of error
p(a1 ) pbs
z
1 p ( a )
1 p
bs
1 pe pe pbs
v p
p e 1 pe bs
I ( z, v ) H bs ( pbs pe pbs pe ) H bs ( pe )
C 1 H bs ( pe )
Binary Symmetric Channel
1 1
log l (i ) log 1
P(i ) P(i )
from H ( z) nH ( z )
then
Lavg 1
H ( z) H ( z)
n n
or
Lavg The minimum average code word
lim H ( z) length per source symbol cannot
n
n lower than the entropy.
Coding efficiency
H ( z)
n
Lavg
Extension Coding Example
H = 0.918
Lavg = 1
H = 1.83
Lavg = 1.89
0.918 1.83
1 1 0.918 2 0.97
1 1.89
= code size
r = Block length
Rate Distortion Function for BSC
The number
between 0.0688
and 0.06752
can be used to
represent the
sequence
a1 a2 a3 a3 a4
24 Bits
9 Bits
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
LZW Coding Algorithm
0. Initialize a dictionary by all possible gray values (0-255)
1. Input current pixel
2. If the current pixel combined with previous pixels
form one of existing dictionary entries
Then
2.1 Move to the next pixel and repeat Step 1
Else
2.2 Output the dictionary location of the currently recognized
sequence (which is not include the current pixel)
Bit plane
images
Bit 7 Bit 3
Bit 6 Bit 2
Original gray
scale image
Bit 5 Bit 1
Bit 4 Bit 0
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Gray-coded Bit Planes
Original
bit planes a Gray code:
7 g7
gi ai ai 1
for 0i6
and
a6 g6
g7 a7
a1 g1
a0 g0
Relative Address Coding (RAC)
Concept: Tracking binary transitions that begin and end eack black
and white run
Source encoder
Lossless f ( x, y ) Mapper Symbol encoder
coding
Reduce Reduce
interpixel coding
redundancy redundancy
Source encoder
Lossy f ( x, y ) Mapper Quantizer Symbol encoder
coding
Encoder
1. Type of transformation
2. Size of subimage
3. Quantization algorithm
2D Discrete Transformation
Forward transform:
N 1 N 1
T (u, v ) f ( x, y ) g ( x, y , u, v )
x 0 y 0
1 bi ( x ) pi ( u )bi ( y ) pi ( v )
g ( x, y , u, v ) h(u, v, x, y ) ( 1) i 0
N
N = 2m
bk(z) = the kth bit of z
p0 (u ) bm1 (u )
p1 (u ) bm 1 (u ) bm 2 (u )
p2 (u ) bm 2 (u ) bm 3 (u )
pm 1 (u ) b1 (u ) b0 (u )
Advantage: simple, easy to implement
N=4 Disadvantage: not good packing ability
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Transform Example: Discrete Cosine Basis Functions
(2 x 1)u ( 2 y 1)v
g ( x, y , u, v ) h(u, v, x, y ) (u ) (v ) cos cos
2N 2N
1
for u 0
(u ) N
2
for u 1, , N 1
N
Hadamard
Original image
512x512 pixels
Subimage size:
8x8 pixels = 64 pixels RMS Error = 0.86
DCT
Quatization by truncating
50% of coefficients (only
32 max cofficients are kept.)
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition. RMS Error = 0.68
DCT vs DFT Coding
DFT
coefficients
have abrupt
changes at
boundaries
of blocks
1 Block
This experiment:
Quatization is made by
truncating 75% of
transform coefficients
Reconstructed Reconstructed
by using 12.5% by using 12.5%
of coefficients of coefficients
(8 coefficients (8 coefficients
with largest with largest
magnitude are variance are
used) used)
Zoom details
Bit allocation T ( u, v )
T (u, v ) round
Z ( u , v )
Restoration before decompressing
~
T (u, v ) T (u, v ) Z (u, v )
Example of
Normalization
Matrix Z(u,v) (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
DCT Coding Example
Method:
- Normalized
Error image Thresholding,
RMS Error = 3.42 - Subimage size:
8x8 pixels
Blocking
Zoom details Artifact at
Subimage
boundaries
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Wavelet Transform Coding: Multiresolution approach
Encoder
Compressed
image
Decoder
Inverse
Decompressed Symbol
wavelet
image decoder
transform
f ( x, y )e j 2 ( u0 x v0 y ) F (u u0 , v v0 )
Wavelet History: Image Pyramid
If we smooth and then down sample an image repeatedly, we will
get a pyramidal image:
Down
Image Image
Smooth Sampling
NxN N/2xN/2
By 2
Question: What Up
Information is Sampling
loss after down By 2
Sampling?
Prediction Prediction
Error Error
NxN N/2xN/2
Image Pyramid and Multiscale Decomposition (cont.)
Prediction error
Original Image N/4xN/4
=
NxN Prediction
error
N/2xN2
Prediction error
(residue)
NxN
Multiresolution Representation
Multiresolution Decomposition Process
Approximation
Images (using
Gaussian
Smoothing)
Prediction
residues
h0(n) Approximation
LPF Down
a(n)
Sampling
N/2 points
by 2
x(n)
N points
h1(n) Detail
Down
HPF Freq. d(n)
Sampling
shift by N/2 points
by 2
N/2
g0(n)
Up
a(n)
Sampling
N/2 points Interpolation
by 2
x(n)
N points
g1(n)
Up
d(n) Freq.
Sampling
N/2 points Interpolation shift by
by 2
N/2
Subband Coding (cont.)
h (n) 2
Note that the number
of points of x(n) and
wavelet coefficients h (n) 2 d3(n) N/8 points
are equal.
h (n) 2 a3(n) N/8 points
(n) = a wavelet function
(n) = a scaling function Wavelet coefficients
(N points)
1D Discrete Wavelet Transformation
2D Discrete Wavelet Transformation
d = diagonal detail
Original image h = horizontal detail
NxN v = vertical detail
a = approximation
d1 h1
v1 a1
d2 h2
Level 1 Level 3
v2 a2
d3 h3
Level 2 v3 a3
2D Discrete Wavelet Transformation (cont.)
a3h3 h2
v3d3 h1
Original image v2 d2
NxN
v1 d1
Wavelet coefficients
NxN
Original
Image
Original image
Example of 2D Wavelet Transformation (cont.)
LL1 HL1
LH1 HH1
LL2 HL2
HL1
LH2 HH2
LH1 HH1
LL3 HL3
HL2
LH3 HH3
HL1
LH2 HH2
LH1 HH1
Haar Daubechies
wavelets wavelets
Biorthogonal
Symlets wavelets
Encoder
Compressed
image
Decoder
Inverse
Decompressed Symbol
wavelet
image decoder
transform
Zoom details
No blocking
Artifact
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Wavelet Transform Coding Example (cont.)
Zoom details
Zoom details