Digital Image Processing Lectures 15 & 16

28
Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT Digital Image Processing Lectures 15 & 16 M.R. Azimi, Professor Department of Electrical and Computer Engineering Colorado State University M.R. Azimi Digital Image Processing

Transcript of Digital Image Processing Lectures 15 & 16

Page 1: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Digital Image ProcessingLectures 15 & 16

M.R. Azimi, Professor

Department of Electrical and Computer EngineeringColorado State University

M.R. Azimi Digital Image Processing

Page 2: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

CWT and Multi-Resolution Signal Analysis

Wavelet transform offers multi-resolution by allowing for variation of timeand frequency resolutions. This is done by using analysis (bandpass)filters with ‘constant-Q’ such that ∆ω

ωo= constant (e.g., frequency

response of cochlea in inner ear which offers better auditory perception).Thus, as frequency increases, ∆ω also increase (Heisenberg equality) toallow small time resolution ∆t. That is, the time resolution ∆t becomesarbitrarily good at high frequencies while the frequency resolutionbecomes arbitrarily good at low frequencies. For example, two very closeshort time bursts can always be separated by going up to higher analysisfrequency to improve the time resolution.

The CWT exactly accomplishes this task with an added simplification i.e.all the basis functions are defined as scaled (i.e. stretched or compressed)versions of a prototype (mother wavelet) Ψ(t) i.e:

Ψa(t) =1√a

Ψ(t

a)

M.R. Azimi Digital Image Processing

Page 3: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

where a is called “scaling” or “dilatation” factor and 1√a

is used

for energy normalization. Small a < 1 implies narrow time windowsfor detecting high frequency activities (zoom-in); while large a > 1widens the window for low frequency analysis (zoom-out). TheCWT is then defined by

XCWT (τ, a) =1√a

∫ ∞−∞

x(t)Ψ∗(t− τa

)dt =

∫ ∞−∞

x(t)Ψ∗a(t− τ)dt

or

XCWT (τ, a) =√a

∫ ∞−∞

x(at)Ψ∗(t− τ

a)dt

From the second equation very large a means large contraction ofthe signal, x(at), is seen through a constant filter (global view)and very small a means detailed view.

M.R. Azimi Digital Image Processing

Page 4: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Remarks and Properties of CWT

1 Scale change of continuous signals (e.g. x(at)) does not changeresolution since it can be reversed while in discrete signals increasingscale involves subsampling (e.g., x(an) for a > 1) and reduction ofresolution. Decreasing scale (upsampling) can be undone and henceit does not change the resolution.

2 In contrast to STFT, the wavelet basis are no longer linked tofrequency modulation instead they are scaled versions of a prototype(mother) wavelet.

3 The function Ψ(t) should satisfy the following conditions in order toqualify as a mother wavelet.

Ψ(t) is absolutely integrable and square integrable (finite energy).∫ ∞−∞|Ψ(t)|dt <∞

∫ ∞−∞|Ψ(t)|2dt <∞

M.R. Azimi Digital Image Processing

Page 5: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

If Ψ(ω) is FT of Ψ(t) the “admissibility” condition which isrequired for inverse operation is.

C =

∫ ∞−∞

|Ψ(ω)|2dωω

<∞

Since Ψ(ω) is continuous function finiteness of this functionimplies that Ψ(0) =

∫∞−∞Ψ(t)dt = 0 (the reason Ψ(t) is called a

wavelet).

4 If above conditions are satisfied the inverse operation or“synthesis equation” consists of

x(t) =1

C

∫ ∫XCWT (τ, a)Ψ∗a(t− τ)

dadτ

a2

i.e. any signal x(t) can be written as a superposition ofshifted and dilated wavelets. Here, C is a constant thatdepends on choice of Ψ(t).

M.R. Azimi Digital Image Processing

Page 6: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

5 CWT is unitary 1C

∫ ∫|XCWT (τ, a)|2 dadτ

a2=∫|x(t)|2dt i.e.

preserves the signal energy. Thus, similar to STFT|XCWT (τ, a)|2 is called “scalogram” that gives the energydistribution of the signal in time-scale plane. In contrast tothe spectrogram, the energy of the signal is distributed atmultiple resolutions.

Following figures show the CWT (using Morlet waveletΨ(t) = 1√

2πe−jωote−t

2/2) of the two previous STFT examples.

Clearly, multi-resolution property is evident (f ∝ 1a).

M.R. Azimi Digital Image Processing

Page 7: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Besides linearity CWT possesses the following properties.

6 Shifting property: If x(t) has CWT XCWT (τ, a) then CWTfor shifted signal y(t) = x(t− τ ′) is

YCWT (τ, a) = XCWT (τ − τ ′, a)

i.e. invariance to shift.7 Scaling property: If x(t) has CWT XCWT (τ, a) then CWT for

scaled signal y(t) = (1/√b)x(t/b) is

YCWT (τ, a) = XCWT (τ

b,a

b)

8 Time Localization property: Let x(t) = δ(t− t0) then CWT is

XCWT (τ, a) =1√a

∫Ψ(t− τa

)δ(t− t0)dt =1√a

Ψ(t0 − τa

)

which is the scaled mother wavelet reversed in time andlocated at t0 i.e. perfect localization.

M.R. Azimi Digital Image Processing

Page 8: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Wigner-Ville Distribution

An alternative to spectrogram for non-stationary signal analysis isthe Wigner-Ville (WV) distribution (bilinear expansion).

WVx(τ, ω) ≡∫x(τ +

t

2)x∗(τ − t

2)e−jwtdt

WV distribution has many interesting properties which are :

Always real-valued.

Preserves time shifts and frequency shifts.

Frequency or time integrals of WVD correspond to the signalsinstantaneous power and its spectral energy density,respectively, i.e. ∫

τWVx(τ, ω)dτ = |X(ω)|2

1

∫ωWVx(τ, ω)dω = |x(t)|2

M.R. Azimi Digital Image Processing

Page 9: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

WVD has time-frequency shift invariance i.e. ify(t) = x(t− τ0)ejω0t, thenWVy(τ, ω) = WVx(τ − τ0, ω − ω0).

The relation between WVD and CWT is given by

|CWT (τ, a)|2 =

∫ ∫WVx(t, ξ)WVΨ(

t− τa

, aξ)dtdξ

i.e. 2-D correlation between the signal and the ”basic”wavelet WVD.

M.R. Azimi Digital Image Processing

Page 10: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Discretization of Time-Scale Parameters & Wavelet Series

A natural way to discretize the time-scale parameters τ and a isvia the dyadic sampling where a = ajo and τ = k ajoT withj, k ∈ I i.e. set of integers. The idea behind this sampling is thatnarrow (high frequency) windows are translated by small steps inorder to catch small details; while wider (low frequency) waveletsare translated by larger steps. Note that this sampling is NOTapplied to the signal, i.e. x(t) is till continuous time. The sampledwavelets are

Ψj,k(t) = a−j2o Ψ(a−jo t− kT )

resulting in

Xj,k =

∫x(t)Ψ∗j,k(t)dt, Analysis Equation

M.R. Azimi Digital Image Processing

Page 11: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

To observe small details (i.e. magnification), a−jo must be large.This calls for j negative and large whereas global views require a−joshould be small and positive. The reconstruction equation is

x(t) = c∑j

∑k

Xj,kΨj,k(t), Synthesis Equation

Typically, we choose ao = 2 , T = 1 for which there exist veryspecial choices of Ψ(t) such that Ψj,k constitute an orthogonalbasis. ∫

Ψj,kΨ∗j′,k′(t)dt =

1, when j = j′, k = k′

0, otherwise

Thus, an arbitrary signal can be represented exactly as a weightedsum of the basis functions i.e.

x(t) =∑j

∑k

Xj,kΨj,k(t), Synthesis Equation

M.R. Azimi Digital Image Processing

Page 12: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Filter Bank Implementation, Sub-band Coding and DWT

Given a signal x(n) we first obtain a lower resolution signal by filteringwith a half-band low-pass filter (LPF) with impulse response g(n). Bythe Nyquist rule, we can down-sample the resulting signal by two (dropevery other sample) i.e. doubling the scale in the analysis. This gives:

y(k) =∑n

g(n)x(2k − n)

i.e. half-band LPF reduces the resolution by 2 (loss of high freq detail)

while scale is unchanged. The subsequent subsampling doubles the scale.

Note that up-sampling by two (inserting a 0 sample between samples)

then low pass filtering (g′(n)) halves the scale while leaving the

resolution unchanged.

M.R. Azimi Digital Image Processing

Page 13: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

This is the principle idea behind sub-band coding which is widelyused for speech and image data compression.

The above system shows one-level DWT where a1(k) and d1(k)are called low-pass approximation and added detail, respectively.The reconstruction via synthesis filter bank is not perfect i.e.x(n) 6= x(n) unless impulse responses of FIR filters g1 and h1 aretime reversed versions of g1 and h1, respectively, i.e.g1(n) = g1(L− 1− n) and h1(n) = h1(L− 1− n).

M.R. Azimi Digital Image Processing

Page 14: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Further, if we assume that the LP and HP FIR filters g1 and h1 arerelated via the “alternating flip” i.e. h1(n) = (−1)ng1(L− 1− n)where L (even number) is the filter order, then the sub-bandanalysis/synthesis corresponds to a decomposition onto anorthonormal basis. The low-pass approximation and added detailare

a1(k) =∑n

x(n)g1(2k − n)

d1(k) =∑n

x(n)h1(2k − n)

Now, because the filter impulse responses form an orthonormal set,x(n) can easily be reconstructed as

x(n) =∑k

[a1(k)g1(n− 2k) + d1(k)h1(n− 2k)]

i.e. weighted sum of the orthogonal impulse responses whereweights are the inner products of signal with impulse response.

M.R. Azimi Digital Image Processing

Page 15: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

The sub-band decomposition can be iterated on the low-passapproximations to yield the multi-level DWT. A three-level DWTdecomposition is shown with one lowest order approximation, a3(m) andthree added details d1(k), d2(l), and d3(m).

x(n) d2(l)

a2(l) g1(n)

h1(n) ↓2X

↓2X d3(m)

a3(m) g1(n)

h1(n) ↓2X

↓2X

x(n) d1(k)

a1(k) g1(n)

h1(n) ↓2X

↓2X

Lowest order Approximation

Added Details

For N-level DWT we have one lowest order approximation and N addeddetails, i.e.

aN (p) =∑n

x(n)gN (2Np− n)

dj(m) =∑n

x(n)hj(2jm− n), j ∈ [1, N ]

where gN (n) =∑

k gN−1(k)g1(n− 2k) is a LPF and

hj(n) =∑

k gj−1(k)h1(n− 2k)′s are BPF’s or HPF.

M.R. Azimi Digital Image Processing

Page 16: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

The reconstruction equation becomes

x(n) =

N∑j=1

∑k

dj(k)hj(n− 2jk) +∑k

aN (k)gN (n− 2Nk)

Note that if the sub-band decomposition is iterated on both thelow-pass approximation and the added details this results inmulti-level wavelet packets (WP) decomposition.The subsequent figures show the 5-level DWT decompositions for“frequency-break” and a noisy speech signal using the Daubechies(dB4) wavelet. As can be observed, each sub-band picks up thebehavior of the signals at certain resolution and scale. The last twofigures show the wavelet functions and the FIR filter impulseresponses for the two filters and two different types of wavelets,namely dB4 and Symlet (Sym4). The former wavelet is orthogonalbut not linear phase; while the latter is orthogonal with nearlylinear phase (good for speech and acoustic processing).

M.R. Azimi Digital Image Processing

Page 17: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

M.R. Azimi Digital Image Processing

Page 18: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

M.R. Azimi Digital Image Processing

Page 19: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Wavelet Transform and Denoising

DWT can also be used for denoising applications. The idea is thatnoise commonly manifest itself as fine-grained structure in animage, and the wavelet transform provides a scale-baseddecomposition, hence most of the noise tends to be represented bywavelet coefficients at the finer scales. Discarding these coefficientswould naturally result in filtering out of the noise. The method ofDonoho et. al. ,1992 thresholds the wavelet coefficients to zero iftheir values are below a threshold. These coefficients mostlycorrespond to noise. The edge-related coefficients, on the otherhand, are usually above the threshold. An alternative to such hardthresholding is the soft thresholding, which leads to less severedistortion of the object of interest. The hard and soft thresholdingmethods are given in the following equations, respectively:

M.R. Azimi Digital Image Processing

Page 20: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

xth =

x if |x| > t0 if |x| ≤ t

xth =

sign(x)(|x| − t) if |x| > t0 if |x| ≤ t

There are several approaches for setting the threshold for eachband of the DWT. A common approach is to decide the thresholdbased upon the histogram of each sub-image.

M.R. Azimi Digital Image Processing

Page 21: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Example 1Show that the alternating flip h1(n) = (−1)ng1(L− 1− n) maps a LPFg1 to a HPF h1.

Proof:(a): Let G1(z) =

∑L−1n=0 g1(n)z−n then

H1(z) =

L−1∑n=0

(−1)ng1(L− 1− n)z−n =

L−1∑n=0

(−1)L−1−ng1(n)z−(L−1−n)

= (−z)−(L−1)L−1∑n=0

g1(n)(−z−1)−n = (−z)−(L−1)G1(−z−1)

Since G1(z) is LPF |G1(z)|z=−1 = 0 and |G1(z)|z=1 = 1. Now, it isclear that |H1(z)|z=−1 = 1 and |H1(z)|z=1 = 0 i.e. H1(z) is HPF.

M.R. Azimi Digital Image Processing

Page 22: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Example 2Show that the Haar filter bank offers both linear phase andorthonormality properties.

Proof:(a): The LPF and HPF for Haar filter bank are: g1(n) = 1√

2, 1√

2 and

h1(n) = 1√2,− 1√

2. Clearly, h1(n) = (−1)ng1(1− n), i.e. alternating

flip is satisfied.G1(Ω) =

√2 cos(Ω/2)e−jΩ/2

andH1(Ω) =

√2j sin(Ω/2)e−jΩ/2

i.e. linear phase.(b) To show orthonormality, (i) < g1(2k − n), g1(2l − n) >= δ(k − l),(ii) < h1(2k − n), h1(2l − n) >= δ(k − l), and (iii)< g1(2k − n), h1(2l − n) >= 0 ∀k, l.Using g1(n) it is easy to show that

< g1(2k − n), g1(2k − n) >=∑

n g21(2k − n) = 1/2 + 1/2 = 1, while

< g1(2k − n), g1(2l − n) >=∑

n g1(2k − n)g1(2l − n) = 0, k 6= l and

similarly for (ii).

M.R. Azimi Digital Image Processing

Page 23: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Also, for (iii) we have< g1(2k − n), h1(2l − n) >=

∑n g1(2k − n)h1(2l − n) = 0, ∀k, l.

The lowpass approximation and added details using Haar basis are:

a1(k) =∑n

x(2k − n)g1(n) =1√2

(x(2k) + x(2k − 1))

d1(k) =∑n

x(2k − n)h1(n) =1√2

(x(2k)− x(2k − 1))

Thus, the reconstruction equations are:

x(2k) =1√2

(a1(k) + d1(k))

x(2k − 1) =1√2

(a1(k)− d1(k))

which gives the Haar reconstruction filters as g1(n) = 1√2, 1√

2 and

h1(n) = − 1√2, 1√

2 .

M.R. Azimi Digital Image Processing

Page 24: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

2-D DWT and Filter Banks

An obvious way to extend DWT to the 2-D case is to use ”separablewavelets” obtained from 1-D wavelets. A one-level 2-D DWT of anN ×N image can be implemented using 1-D DWT along the rows,leading to two “sub-images” of size N

2 ×N , followed by 1-D DWT alongthe columns of these two images, resulting in four sub-images of sizeN2 ×

N2 . The figure below shows this process.

M.R. Azimi Digital Image Processing

Page 25: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

The first sub-image that is obtained by low-pass filtering andsubsampling (by 2) along rows and columns gives the “low-passapproximation“, the second one is obtained by low-passfiltering-subsampling along rows and high-passfiltering-subsampling (edge extraction) along columns giving thefirst “added details” corresponding to the vertical edge details, thethird and fourth ones similarly give the horizontal and diagonaledge details. Reconstruction from these sub-images can be donesimilar to the 1-D case.The process can be iterated on the low-pass approximation severaltimes as in the 1-D case to obtain finer frequency resolution andperform multi-level 2-D DWT. The following examples show singleand two-level DWT of the “Peppers” image using the orthogonalDb4 wavelet.

M.R. Azimi Digital Image Processing

Page 26: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

As can be seen, the detail sub-images mostly contain very lowintensities pixels and some edge/texture details. To compress theimage data using 2-D DWT the detail sub-images can bethresholded to extract only the useful edges/texture and zero-outthose pixels with small intensities (smaller than the chosenthreshold). Once this is done the lowest order approximationsub-image can be encoded using straight PCM while only edgesneed to be encoded in the detail sub-images. This yieldssubstantial reduction in the total number of bits.

M.R. Azimi Digital Image Processing

Page 27: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

M.R. Azimi Digital Image Processing

Page 28: Digital Image Processing Lectures 15 & 16

Continuous Wavelet Transform Wavelet Series Discrete Wavelet Transform 2-D DWT

Image Fusion Using 2-D DWT

Followings are visible and IR satellite images together with thefused image using lowest order approximation from IR channel andadded details from visible channel.

Image 1 Image 2 Fused Image

M.R. Azimi Digital Image Processing