Lec9 - Transform Coding-Jpeg2000
Lec9 - Transform Coding-Jpeg2000
Lecture 9
Block Transform Coding
Image transform
• Two main types:
-Orthogonal transform:
e.g. Walsh-Hadamard transform, DCT
-Subband transform:
e.g. Wavelet transform
12/9/2022 2
Disadvantages of DCT
• DCT based JPEG uses blocks of image, there is still correlation across blocks.
• Block boundaries are noticeable in some cases
• Can overlap the blocks Computationally expensive
• Only spatial correlation of the pixels inside the single 2-D block is
considered and the correlation from the pixels of the neighboring blocks is
neglected
• Impossible to completely decorrelate the blocks at their boundaries using
DCT
• Does not perform efficiently for binary images (fax or pictures of
fingerprints) characterized by large periods of constant amplitude (low
spatial frequencies), followed by brief periods of sharp transitions
•
Why Wavelets?
• No need to block the image
• More robust under transmission errors
• Facilitates progressive transmission of the image (Scalability)
Was JPEG not good enough?
• JPEG is based on DCT.
• Equal subbands.
• At low bit rates, there is a sharp
degradation with image quality.
• 43:1 compression ratio
Advantages of Discrete Wavelet Transform over DCT
• No need to divide the input coding into non-overlapping 2-D blocks, it has higher
compression ratios avoid blocking artifacts.
• Allows good localization both in time and spatial frequency domain.
• Transformation of the whole image introduces inherent scaling
• Better identification of which data is relevant to human perception higher
compression ratio
Discrete Wavelet Transform
• Performance
• Peak Signal to Noise ratio used to be a measure of image quality
• The PSNR between two images having 8 bits per pixel or sample in terms of decibels (dBs)
is given by: 255 2
• PSNR = 10 log10
MSE
• mean square error (MSE)
• Generally when PSNR is 40 dB or greater, then the original and the reconstructed images
are virtually indistinguishable by human observers
Wavelet Transform
f (t ) ak k (t )
k
Example:
scale
ψ(t)
translate
Basis Construction - Mother Wavelet
(dyadic/octave grid)
jk (t )
scale =1/2j
(1/frequency) j
k
Continuous Wavelet Transform (CWT)
1 t
Forward C ( , s) f t
dt
CWT: s t s
1 t
Forward CWT: C ( , s) f t
dt
s t s
1 t
Inverse CWT: f (t )
s s C ( , s) ( s )d ds
where jk (t ) 2 j / 2 2 j t k
Convention for illustrating
1D Haar wavelet decomposition
x x x x x x … x x
average
(LP)
… detail
(HP)
re-arrange: …
…
… LP HP
re-arrange: …
Haar Wavelet Transform
Find the average of each pair of samples
Find the difference between the average and sample
Fill the first half with averages
Fill the second half with differences
Repeat the process on the first half
Step 1:
[3 5 4 8 13 7 5 3]
Averaging
Differencing
[4 6 10 4 -1 -2 3 1]
18
Haar Wavelet Transform
Step 2
[4 6 10 4 -1 -2 3 1]
Averaging Differencing
[5 7 -1 3 -1 -2 3 1]
ex. (4 + 6)/2 = 5
4 - 5 = -1
19
Haar Wavelet Transform
Step 3
[5 7 -1 3 -1 -2 3 1]
Averaging Differencing
[6 -1 -1 3 -1 -2 3 1]
row average
ex. (5 + 7)/2 = 6
5 - 6 = -1
20
Example - Haar Wavelets
(with sub-sampling)
L0 D1 D2 D3
Example - Haar Wavelets (cont’d)
• Start by averaging and subsampling the pixels
together (pairwise) to get a new lower resolution
image:
[9 7 3 5]
1
Example - Haar Wavelets (cont’d)
• Repeating this process on the averages (i.e., low
resolution image) gives the full decomposition:
Harr decomposition:
Example - Haar Wavelets (cont’d)
• The original image can be reconstructed by adding or
subtracting the detail coefficients from the lower-
resolution representations.
L0 D1 D2 D3
2 1 -1
[6]
Summary: wavelet expansion (Section 7.2)
f (t ) ck (t k ) d jk (2 j t k )
k k j
φ(t) ψ(t)
[9 7 3 5]
low-pass, high-pass,
down-sampling down-sampling
[9 7 3 5]
low-pass, high-pass,
down-sampling down-sampling
LP HP
(8+4)/2 (8-4)/2
2D Haar Wavelet Transform
• Steps:
row-transformed result
… …
…
…
… … . … … .
…
Standard Haar wavelet decomposition (cont’d)
average
detail
(2) column-wise Haar decomposition:
row-transformed result
…
re-arrange terms …
…
… … .
…
… … .
Example (cont’d)
column-transformed result
…
…
… … .
…
Low part High part
137-134=-3/2=1
135-141=-6/2=-3
138-134=4/2 =2
131-29=2/2 =1
129+131=260/2=130
133+132=-265/2=132
134+131=265/2=132
133+131=264/2=132
LL HL
135+138=273/2=136 1+ -3=-2/2=-1
136+130=266/2=133 2+1=3/2= 1
130+132=262/2=131 -1+0=-1/2= 0
136 131 1 0
132+132=264/2=132 133 LL132 1 HL 1 1+1=2/2= 1
1 1 2 0 HH
HL LH HH
135-138=-3/2= -1 3 0 0 0 1- -3=4/2= 2
136-130=6/2= 3 2-1=1/2= 0
130-132=-2/2= -1 -1-0=-1/2= 0
132-132=0/2= 0 1-1=0/2= 0
Image representation
64 2 3 61 60 6 7 57
9 55 54 12 13 51 50 16
17 47 49 20 21 43 42 24
A 40 26 27 37 36 30 31 33
32 34 35 29 28 38 39 25
41 23 22 44 45 19 18 48
49 15 14 52 53 11 10 56
8 58 59 5 4 62 63 1
[33 32 33 32 31 -29 27 -25]
[32.5 32.5 0.5 0.5 31 -29 27 -25]
[32.5 0 0.5 0.5 31 -29 27 -25]
38
Applying on rows
32.5 0 0.5 0.5 31 29 27 25
32.5 0 0.5 0.5 23 21 19 17
32.5 0 0.5 0.5 15 13 11 9
32.5 0 0.5 0.5 7 5 3 1
32.5 0 0.5 0.5 1 3 5 7
32.5 0 0.5 0.5 9 11 13 15
32.5 0 0.5 0.5 17 19 21 23
32.5 0 0.5 0.5 25 27 29 31
detail coefficients
row average
39
Applying on columns
Choose a threshold δ
32.5 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 4 4 4 4
0 0 0 0 4 4 4 4
0 0 0.5 0.5 27 25 23 21
0 0 .5 .5 11 9 7 5
0 0 0.5 0.5 5 7 9 11
0 0 .5 .5 21 23 25 27 δ=5
40
Features of JPEG2000
• Multiple Resolution: Decomposes the image into a multiple resolution
representation.
• Progressive transmission: By pixel and resolution accuracy, referred to
as progressive decoding and signal-to-noise ratio (SNR) scalability:
This way, after a smaller part of the whole file has been received, the
viewer can see a lower quality version of the final picture.
• Lossless and lossy compression
• Random code-stream access and processing: JPEG 2000 supports
spatial random access or region of interest access at varying degrees
of granularity. This way it is possible to store different parts of the
same picture using different quality.
• Error resilience: JPEG 2000 is robust to bit errors introduced by noisy
communication channels, due to the coding of data in relatively small
independent blocks.
JPEG2000 Basics
General block diagram of the JPEG 2000 (a) encoder and (b) decoder
Compression algorithms using DWT