wavelets and multiresolution processing (wavelet transforms)

49
University of Ioannina - Department of Computer Science Wavelets and Multiresolution Processing (Wavelet Transforms) Christophoros Nikou [email protected] Digital Image Processing

Upload: others

Post on 02-Oct-2021

24 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Wavelets and Multiresolution Processing (Wavelet Transforms)

University of Ioannina - Department of Computer Science

Wavelets and Multiresolution Processing(Wavelet Transforms)

Christophoros [email protected]

Digital Image Processing

Page 2: Wavelets and Multiresolution Processing (Wavelet Transforms)

2

C. Nikou – Digital Image Processing (E12)

Contents

– Image pyramids– Subband coding– The Haar transform– Multiresolution analysis

• Series expansion• Scaling functions• Wavelet functions

– Wavelet series– Discrete wavelet transform (DWT)– Fast wavelet transform (FWT)– Wavelet packets

Page 3: Wavelets and Multiresolution Processing (Wavelet Transforms)

3

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Wavelet Series

A continuous signal may be represented by a scaling function in a subspace and some number of wavelet functions in subspaces

0 0

0

, ,( ) ( ) ( ) ( ) ( )j j k j j kk j j k

f x c k x d k xφ ψ∞

=

= +∑ ∑∑

Scaling coefficients

0jV

0 0 01 2,, , ...j j jW W W+ +

0 0 0, ,( ) ( ), ( ) ( ) ( )j j k j kc k f x x f x x dxφ φ= = ∫

Detail (wavelet) coefficients

, ,( ) ( ), ( ) ( ) ( )j j k j kd k f x x f x x dxψ ψ= = ∫

Page 4: Wavelets and Multiresolution Processing (Wavelet Transforms)

4

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Wavelet Series (cont…)

Example: using Haar wavelets and starting from j0=0, compute the wavelet series of

Scaling coefficients1 1

2 20 0,0

0 0

1(0) ( )3

c x x dx x dxφ= = =∫ ∫

There is only one scaling coefficient for k=0. Integer translations of the scaling function do not overlap with the signal.

2 , 0 1( )

0, otherwisex x

f x⎧ ≤ ≤

= ⎨⎩

Page 5: Wavelets and Multiresolution Processing (Wavelet Transforms)

5

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Wavelet Series (cont…)

Example (continued): Detail (wavelet) coefficients

1 0.5 12 2 2

0 0,00 0 0.5

1(0) ( )4

d x x dx x dx x dxψ= = − = −∫ ∫ ∫

1 0.25 0.52 2 2

1 1,00 0 0.25

2(0) ( ) 2 232

d x x dx x dx x dxψ= = − = −∫ ∫ ∫

1 0.75 12 2 2

1 1,10 0.5 0.75

3 2(1) ( ) 2 232

d x x dx x dx x dxψ= = − = −∫ ∫ ∫

Page 6: Wavelets and Multiresolution Processing (Wavelet Transforms)

6

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Wavelet Series (cont…)

Example (continued): Substituting these values:

0 0 1

1 0 0

2 1 1 0 0 1

0,0 0,0 1,0 1,11 1 2 2( ) ( ) ( ) ( ) ( ) ...3 4 32 32

V W W

V V W

V V W V W W

f x x x x xφ ψ ψ ψ

= ⊕

= ⊕ = ⊕ ⊕

⎡ ⎤⎡ ⎤= + − + − − +⎢ ⎥⎢ ⎥⎣ ⎦ ⎣ ⎦

Page 7: Wavelets and Multiresolution Processing (Wavelet Transforms)

7

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Wavelet Series (cont…)

Example (continued): The scaling function approximates the signal by its average value.

Each wavelet subspace adds a level of detail in the wavelet series representation of the signal.

Page 8: Wavelets and Multiresolution Processing (Wavelet Transforms)

8

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Discrete Wavelet Transform

If the signal is discrete, of length M, we compute its DWT.

0

0

0 , ,1 1( ) ( , ) ( ) ( , ) ( )j k j k

k j j kf n W j k n W j k n

M Mφ ψφ ψ∞

=

= +∑ ∑∑

Scaling coefficients

Detail coefficients

0

1

0 ,0

1( , ) ( ) ( )M

j kn

W j k f n nMφ φ

=

= ∑

0

1

, 00

1( , ) ( ) ( ), forM

j kn

W j k f n n j jMψ ψ

=

= ≥∑

Page 9: Wavelets and Multiresolution Processing (Wavelet Transforms)

9

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Discrete Wavelet Transform (cont…)

We take M equally spaced samples over the support of the scaling and wavelet functions.Normally, we let j0=0 and M=2J.

Therefore, the summations are performed over

0

0

0 , ,1 1( ) ( , ) ( ) ( , ) ( )j k j k

k j j k

f n W j k n W j k nM Mφ ψφ ψ

=

= +∑ ∑∑

0, 1, 2,..., 1, 0, 1, 2,..., 1, 0, 1, 2,..., 2 1jn M j J k= − = − = −

For Haar wavelets, the discretized scaling and wavelet functions correspond to the rows of the MxM Haarmatrix.

Page 10: Wavelets and Multiresolution Processing (Wavelet Transforms)

10

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Discrete Wavelet Transform (cont…)

Example: f(n)={1, 4, -3, 0}.

We will compute the DWT of the signal using the Haar scaling function and the corresponding wavelet functions.

Here, M=4=2J, J=2 and with j0=0 the summations are performed over n=0, 1, 2, 3, j=0, 1 and k=0 for j=0 or k=0, 1 for j=1. The values of the sampled scaling and wavelet functions are the elements of the rows of H4.

Page 11: Wavelets and Multiresolution Processing (Wavelet Transforms)

11

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Discrete Wavelet Transform (cont…)

Example (continued): f(n)={1, 4, -3, 0}.

00

1 3

0 , 0,00, 00 0

1 1( , ) ( ) ( ) ( ) ( )2

M

j k j kn n

W j k f n n f n nMφ φ φ

= == =

= = ⇔∑ ∑

1(0,0) [1 1 4 1 3 ( 1) 0 ( 1)] 42

Wψ = ⋅ + ⋅ − ⋅ − + ⋅ − =

1(0,0) [1 1 4 1 3 1 0 1] 12

Wφ = ⋅ + ⋅ − ⋅ + ⋅ =

1(1,0) [1 2 4 ( 2) 3 0 0 0] 1.5 22

Wψ = ⋅ + ⋅ − − ⋅ + ⋅ = −

1(1,1) [1 0 4 0 3 2 0 ( 2)] 1.5 22

Wψ = ⋅ + ⋅ − ⋅ + ⋅ − = −

Page 12: Wavelets and Multiresolution Processing (Wavelet Transforms)

12

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Discrete Wavelet Transform (cont…)

Example (continued): f(n)={1, 4, -3, 0}. The DWT relative to the Haar scaling and wavelet functions is

{ }1, 4, 1.5 2, 1.5 2− −

To reconstruct the signal, we compute

0

0

0 , ,

0,0 0,0 1,0 1,1

1 1( ) ( , ) ( ) ( , ) ( )

1 (0,0) ( ) (0,0) ( ) (1,0) ( ) (1,1) ( )2

j k j kk j j k

f n W j k n W j k nM M

W n W n W n W n

φ ψ

φ ψ ψ ψ

φ ψ

φ ψ ψ ψ

=

= +

⎡ ⎤= + + +⎣ ⎦

∑ ∑∑

for n=0, 1, 2, 3. Notice that we could have started from a different approximation level j0∫0.

Page 13: Wavelets and Multiresolution Processing (Wavelet Transforms)

13

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform

A computationally efficient implementation of the DWT [Mallat 1989]. It resembles subband coding.Consider the multiresolution refinement equation

Scaling x by 2j, translating it by k and letting m=2k+n:

( ) ( ) 2 (2 )n

x h n x nφφ φ= −∑

( )(2 ) ( ) 2 2(2 )j j

nx k h n x k nφφ φ− = − − =∑

1( ) 2 (2 2 )j

nh n x k nφ φ += − −∑

1( 2 ) 2 (2 )j

mh m k x mφ φ += − −∑

Page 14: Wavelets and Multiresolution Processing (Wavelet Transforms)

14

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

The scaling vector hφ may be considered as weights used to expand φ(2jx-k) as a sum of scale j+1 scaling functions.

A similar sequence of operations leads to

1(2 ) ( 2 ) 2 (2 )j j

mx k h m k x mφφ φ +− = − −∑

1(2 ) ( 2 ) 2 (2 )j j

mx k h m k x mψψ φ +− = − −∑

Page 15: Wavelets and Multiresolution Processing (Wavelet Transforms)

15

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

Injecting these expressions into the DWT formulas1

,0

1( , ) ( ) ( )M

j kn

W j k f n nMφ φ

=

= ∑

0

1

, 00

1( , ) ( ) ( ), forM

j kn

W j k f n n j jMψ ψ

=

= ≥∑yields the following important equations relating the DWT coefficients of adjacent scales.

( , ) ( 2 ) ( 1, )m

W j k h m k W j mφ φ φ= − +∑( , ) ( 2 ) ( 1, )

m

W j k h m k W j mψ ψ φ= − +∑

Page 16: Wavelets and Multiresolution Processing (Wavelet Transforms)

16

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

Both the scaling and the wavelet coefficients of a certain scale jmay be obtained by

• convolution of the scaling coefficients of the next scale j+1(the finer detail scale), with the order-reversed scaling and wavelet vectors hφ(-n) and hψ(-n).• subsampling the result.

( , ) ( 2 ) ( 1, )m

W j k h m k W j mφ φ φ= − +∑( , ) ( 2 ) ( 1, )

m

W j k h m k W j mψ ψ φ= − +∑

The complexity is O(M).

Page 17: Wavelets and Multiresolution Processing (Wavelet Transforms)

17

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

The convolutions are evaluated at non-negative even indices. This is equivalent to filtering and downsampling by 2.

2 , 0( , ) ( ) ( 1, )

n k kW j k h n W j nφ φ φ = ≥

= − ∗ +

2 , 0( , ) ( ) ( 1, )

n k kW j k h n W j nψ ψ φ = ≥

= − ∗ +

Page 18: Wavelets and Multiresolution Processing (Wavelet Transforms)

18

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

The procedure may be iterated to create multistage structures of more scales.The highest scale coefficients are assumed to be the values of the signal itself ( , ) ( )W J n f nφ =

Page 19: Wavelets and Multiresolution Processing (Wavelet Transforms)

19

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

The corresponding frequency splitting characteristics for the two-stage procedure.

Page 20: Wavelets and Multiresolution Processing (Wavelet Transforms)

20

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

Page 21: Wavelets and Multiresolution Processing (Wavelet Transforms)

21

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

Reconstruction may be obtained by the IFWT• upsampling by 2 (inserting zeros).• convolution of the scaling coefficients by hφ(n) and the wavelet coefficients by hψ(n) and summation.

2 2

0( 1, ) ( ) ( , ) ( ) ( , )

kW j k h k W j k h k W j kφ φ φ ψ ψ

↑ ↑

≥+ = ∗ + ∗

Page 22: Wavelets and Multiresolution Processing (Wavelet Transforms)

22

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

It can also be extended to multiple stages.

Page 23: Wavelets and Multiresolution Processing (Wavelet Transforms)

23

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsThe Fast Wavelet Transform (cont…)

Page 24: Wavelets and Multiresolution Processing (Wavelet Transforms)

24

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsRelation to the Fourier Transform

• The Fourier basis functions guarantee the existence of the transform for energy signals.• The wavelet transform depends upon the availability of scaling functions for a given wavelet function.• The wavelet transform depends on the orthonormality (biorthogonality) of the scaling and wavelet functions.• The F.T. informs us about the frequency content of a signal. It does not inform us on the specific time instant that a certain frequency occurs.•The W.T. provides information on “when the frequency occurs”.

Page 25: Wavelets and Multiresolution Processing (Wavelet Transforms)

25

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsRelation to the Fourier Transform (cont…)

Heisenberg cells.• The width of each rectangle in (a) represents one time instant.• The height of each rectangle in (b) represents a single frequency.

Signal DFT DWT

Page 26: Wavelets and Multiresolution Processing (Wavelet Transforms)

26

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsRelation to the Fourier Transform (cont…)

Time domain pinpoints the instance an event occurs but has no frequency information.DFT domain pinpoints the frequencies that are present in the events but provides no time resolution (when a certain frequency appears).

Signal DFT DWT

Page 27: Wavelets and Multiresolution Processing (Wavelet Transforms)

27

C. Nikou – Digital Image Processing (E12)

1-D Wavelet TransformsRelation to the Fourier Transform (cont…)

In DWT the time-frequency resolution varies but the area of each tile is the same. There is a compromise between time and frequency resolutions.At low frequencies the tiles are shorter (better frequency resolution, less ambiguity regarding frequency) but wider (more ambiguity regarding time).At high frequencies the opposite happens (time resolution is improved).

Signal DFT DWT

Page 28: Wavelets and Multiresolution Processing (Wavelet Transforms)

28

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform

Extension from 1-D wavelet transforms.A 2-D scaling function and three 2-D wavelet functions are required.They are separable. They are the product of two 1-D functions.

( , ) ( ) ( )( , ) ( ) ( )( , ) ( ) ( )( , ) ( ) ( )

H

V

D

x y x yx y x yx y x yx y x y

φ φ φ

ψ ψ φ

ψ φ ψ

ψ ψ ψ

=

=

=

=

Variations along columns

Variations along rows

Variations along diagonals

Page 29: Wavelets and Multiresolution Processing (Wavelet Transforms)

29

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

Given separable scaling and wavelet functions the scaled and translated basis

, ,

/ 2, ,

/ 2

( , ) 2 (2 ,2 )

( , ) 2 (2 ,2 ), { , , }j m n

j j jj m n

i j i j j

x y x m y n

x y x m y n i H V D

φ φ

ψ ψ

= − −

= − − =

where i is an index and there are two translations m and n.

Page 30: Wavelets and Multiresolution Processing (Wavelet Transforms)

30

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

The DWT is given by

And the inverse transformation is

0

1 1

0 , ,0 0

1( , , ) ( , ) ( , )M N

j m nm n

W j m n f m n m nMNφ φ

− −

= =

= ∑∑

, .0

1 1

0 0

1( , , ) ( , ) ( , ), { , , }j m n

M Ni i

m n

W j m n f m n m n i H V DMNψ ψ

− −

= =

= =∑∑

0

0

0 , ,

, ,, ,

1( , ) ( , , ) ( , )

1 ( , , , ) ( , )

j m nm n

i ij m n

i H V D j j m n

f m n W j m n m nMN

W j m n k m nMN

φ

ψ

φ

ψ∞

= =

=

+

∑∑

∑ ∑∑∑

Page 31: Wavelets and Multiresolution Processing (Wavelet Transforms)

31

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

We take M equally spaced samples over the support of the scaling and wavelet functions.We normally, we let j0=0 and select N=M=2J

so that0, 1, 2,..., 1, 0, 1, 2,..., 1, 0, 1, 2,..., 2 1jm n M j J k= = − = − = −

Like the 1-D transform it can be implemented using filtering and downsampling.We take the 1-D FWT of the rows followed by the 1-D FWT of the resulting columns.

Page 32: Wavelets and Multiresolution Processing (Wavelet Transforms)

32

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

Page 33: Wavelets and Multiresolution Processing (Wavelet Transforms)

33

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

Reconstruction (inverse 2-D FWT)

Page 34: Wavelets and Multiresolution Processing (Wavelet Transforms)

34

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

Page 35: Wavelets and Multiresolution Processing (Wavelet Transforms)

35

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

Page 36: Wavelets and Multiresolution Processing (Wavelet Transforms)

36

C. Nikou – Digital Image Processing (E12)

2-D Discrete Wavelet Transform (cont…)

a) Noisy CT image. We wish to remove the noise by manipulating the DWT.

b) Thresholding all of the detail coefficients of the two scale DWT. Significant edge information is eliminated.

c) Zeroing the highest resolution detail coefficients (not thresholding the lowest resolution details).

d) Information loss in c) with respect to the original image. The edges are slightly disturbed.

e) Zeroing all of the detail coefficients of the two scale DWT.

d) Information loss in e) with respect to the original image. Significant edge information is removed.

Page 37: Wavelets and Multiresolution Processing (Wavelet Transforms)

37

C. Nikou – Digital Image Processing (E12)

Wavelet Packets

The DWT, as it was defined, decomposes a signal into a sum of scaling and wavelet functions whose bandwidths are logarithmically related.• low frequencies use narrow bandwidths.• high frequencies use wider bandwidths.For greater flexibility of the partitioning of the time-frequency plane the DWT must be generalized.

Signal DFT DWT

Page 38: Wavelets and Multiresolution Processing (Wavelet Transforms)

38

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

Coefficient tree and subspace analysis tree for the two-scale (three levels) FWT filter bank.The subspace analysis tree provides a more compact representation of the decomposition in terms of subspaces.

11 JJ JV V W−−= ⊕

Page 39: Wavelets and Multiresolution Processing (Wavelet Transforms)

39

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

Subspace analysis tree and spectrum splitting for the three-scale (four levels) FWT filter bank.Here, we have three options for the expansion:

1

2

3

1

2 1

3 2 1

J

J

J

J J

J J J

J J J J

V V W

V V W W

V V W W W

− −

− − −

= ⊕

= ⊕ ⊕

= ⊕ ⊕ ⊕

Page 40: Wavelets and Multiresolution Processing (Wavelet Transforms)

40

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

Wavelet packets are conventional wavelet transforms in which the details are filtered iteratively. For example, the three scale wavelet packet tree is

Indices A (approximation) and D (detail) denote the path from the parent to the node.

Page 41: Wavelets and Multiresolution Processing (Wavelet Transforms)

41

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)Filter bank and spectrum (three scale wavelet packet).

Page 42: Wavelets and Multiresolution Processing (Wavelet Transforms)

42

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

The cost of this generalization increases the computational complexity of the transform from O(M)to O(MlogM).Also, the three scale packet almost triples the number of decompositions available from the three low pass bands.

Page 43: Wavelets and Multiresolution Processing (Wavelet Transforms)

43

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

The subspace of the signal may be expanded as

33 2, 2, 1, 1, 1, 1,JJ J J A J D J AA J AD J DA J DDV V W W W W W W W−− − − − − − −= ⊕ ⊕ ⊕ ⊕ ⊕ ⊕ ⊕

with spectrum:

Page 44: Wavelets and Multiresolution Processing (Wavelet Transforms)

44

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

It can also be expanded as

1 1, 1, 1,J J J A J DA J DDV V W W W− − − −= ⊕ ⊕ ⊕

with spectrum:

Page 45: Wavelets and Multiresolution Processing (Wavelet Transforms)

45

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

In general, a P-scale 1-D wavelet packet (associated with P+1 level analysis trees) supports

[ ]2( 1) ( ) 1D P D P+ = +

unique decompositions, where D(1)=1 is the initial signal.

For instance, D(4)=26 and D(5)=677.

Page 46: Wavelets and Multiresolution Processing (Wavelet Transforms)

46

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

The problem increases dramatically in 2-D.a P-scale 2-D wavelet packet (associated with P+1 level analysis trees) supports

[ ]4( 1) ( ) 1D P D P+ = +

unique decompositions, where D(1)=1 is the initial signal.

For instance, D(4)=83.522 possible decompositions.How do we select among them? Impractical to examine each one of them for a given application.

Page 47: Wavelets and Multiresolution Processing (Wavelet Transforms)

47

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)A common application of wavelets is image compression. Here we will examine a simplified example.We seek to compress the fingerprint image by selecting the “best” three-scale wavelet packet decomposition.

Page 48: Wavelets and Multiresolution Processing (Wavelet Transforms)

48

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

A criterion for the decomposition is the image energy2( ) ( , )

m n

E f f m n=∑∑

AlgorithmFor each node of the analysis tree, from the root to the leaves:Step 1: Compute the energy of the node (EP) and the energy of its offsprings (EA, EH, EV, ED).Step 2: If EA+EH+EV+ED <EP include the offsprings in the analysis tree as they reduce the initial energy.Otherwise, keep only the parent which is a leaf of the tree.

Page 49: Wavelets and Multiresolution Processing (Wavelet Transforms)

49

C. Nikou – Digital Image Processing (E12)

Wavelet Packets (cont…)

Many of the 64 initial subbands are eliminated.