C3 - Image Tranforms - P2 - NTHai-9-2015
C3 - Image Tranforms - P2 - NTHai-9-2015
Lecture:
IMAGE PROCESSING
Chapter 3: Image Transforms
Wavelet Transforms
2
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Wavelet Analysis
Wavelet analysis is based on Multiresolution Analysis (MRA) in time-
frequency as shown in Fig. 3.7
3
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
- Wavelet analysis is considered between a signal x(t) and Wavelet
function (), in which wavelet () is considered as mother wavelet
function.
- Wavelet function () is a small signal or oscillation for distinguishing
different frequencies of the input signal.
- Wavelet contains information of analysis waveform and window
size (scale) as shown in Fig. 3.8
- In practice, there are many different wavelet family.
1 1 −
= ,
%⁄
= ! , = "#$ &
5
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Image Transforms
- Việc tính toán biến đổi Wavelet thường thực hiện với những giá trị rời rạc
ứng với các hệ số tỷ lệ và độ dịch chuyển . Các hệ số Wavelet được gọi
là chuỗi Wavelet. Chuỗi Wavelet có thể được tính như sau
(,) = *,+
*/
*,+ = , ,* − . ,
= 1 1 (,) *,+
*2 +2
6
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Image Transforms
7
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
• Many different wavelets can be used in CWT.
• Depending on signal features to be detected select a
wavelet for analysis easier.
c) Haar
d) Morlet
8
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Image Transforms
1D Haar Wavelets
• Haar scaling and wavelet functions:
• Mother scaling function: φ(t)
10
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Continuous wavelet transform (CWT)_Scale
• The scale works exactly the same with wavelet
11
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
With the 1D discrete signal # . , the DWT is determined using the
following equation:
1
34 5, , 6 = 1 #(.)89 ,: (.)
7 +
1
3 5, 6 = 1 #(.) ,: (.) 5 ≥ 5,
7 +
In which, 89 ,: (.) and ,: (.) are functions of scaling and discrete
Wavelet determined in the interval 0, 7 − 1 and orthogonal together
with 5, initially
- 34 5, , 6 expresses the approximation coefficient (low
frequencies),
- 3 5, 6 are the detail coefficients (high frequencies).
The inverse DWT is calculated as follows:
1 1
# . = 1 34 5, , 6 89 ,: . + 1 1 3 5, 6 ,: .
7 :
7 2 :
9 12
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Discrete Wavelet transform (DWT) in digital image
This is the 2D wavelet function, including scaling 8 , = and Wavelet
, = and calculated as follows:
8,*,+ , = = 2/ 8 2 − /, 2 = − . ,
?
,*,+ , = = 2/ ?
2 − /, 2 = − . , @ = A, B, C
3 wavelet functions D (, =), E (, =), F , = , are still called details;
and 8G , = is called approximation.
8 , = = 8 8 = , E , = = 8 = ,
D , = = 8 = , F
, = = = ,
13
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Discrete Wavelet transform (DWT) in digital image
Expressions of the approximation and details are described in 2D image
as follows:
LJ IJ
1
34 5, , /, . = 1 1 # , = 89 ,*,+ , = = G
7H M2, K2,
LJ IJ
1 ?
3 5, /, . = 1 1 # , = 8,*,+ , = , @ = A, B, C
7H M2, K2,
# , =
LJ IJ
1
= 1 1 34 5,,*,+ 89 ,*,+ , =
7H M2, K2,
1
+ 1 1 1 1 3? 5, /, . 8,*,+
?
, =
7H ?2D,E,F 2 * +
9
14
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
15
Nguyen Thanh Hai, PhD.
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
16
Nguyen Thanh Hai, PhD.
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
17
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Some wavelet functions in Matlab:
- [Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('wname');
In which, Lo_D and Hi_D are the lowpass and highpass filters. Lo_R và Hi_R
are the lowpass and highpass filters for synthesis, in which the filters must
be orthogonal.
- Function wfilters to find types of different wavelets:
[F1,F2] = wfilters('wname','type')
- wavefun :
[phi, psi, xval] = wavefun(vname,iter)
Give approximate vector of phi and psi, and xval is vector ước lượng; iter
describes integer numbers
- If variables are orthogonal, we have :
[phi1, psi1, phi2, psi2, xval] = wavefun(wname, iter)
In which phi1 and psi1 are decomposition, phi2 and psi2 are recontruction.
18
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
19
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Some wavelet functions in Matlab:
wavedec2:
[C, S] = wavedec2(X, N, Lo_D, Hi_D)
In which, X is the 2D matrix, N is the analysis level, Lo_D and Hi_D are the
filters. syntax:
[C,S] = wavedec2(X,N,'wname')
Output is row vector C (double) containing Wavelet coefficients and the
matrix S (double) determines coefficients in C. The relationship between C
and S is described as:
21
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Ex 3.6: Calculate DWT with the 4x4 matrix of magic function and
Haar family.
The resulat is that
16 2 3 13
# = 5 11 10 8
9 7 6 12
4 14 15 1
23
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Convolution of the image # and the lowpass filter UV_C cross the
row of the matrix.
24
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
25
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
26
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
. .
(0) . (0)
(1) (0) 0
= (2) 2 = (2) 2 2 = (2)
(3) (4) 0
(4) . (4)
. .
27
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Ex 3.7: Express wavelet with an image
clear all;
f=imread('cameraman.bmp');
[cA1,cH1,cV1,cD1]=dwt2(f,'Haar');
f1=[mat2gray(cA1) mat2gray(cH1);mat2gray(cV1)
mat2gray(cD1)];
[cA2,cH2,cV2,cD2]=dwt2(cA1,'Haar');
f22=[mat2gray(cA2) mat2gray(cH2);mat2gray(cV2)
mat2gray(cD2)];
28
Nguyen Thanh Hai, PhD
University of Technical Education
Faculty of Electrical & Electronic Engineering
Wavelet transform
Wavelet toolbox : dwt2 (cont)
29
Nguyen Thanh Hai, PhD.
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Ex 3.8: Express WT with noise
clear all
f=imread('cameraman.bmp');
fn=imnoise(f,'gaussian',0.01);
[cA,cH,cV,cD]=dwt2(fn,'Haar');
[THR_H,SORH_H,KEEPAPP_H]=dde
ncmp('den','wv',cH);
cH=wthresh(cH,SORH_H,THR_H);
[THR_V,SORH_V,KEEPAPP_V]=dden
cmp('den','wv',cV);
cV=wthresh(cH,SORH_V,THR_V);
[THR_D,SORH_D,KEEPAPP_D]=dde
ncmp('den','wv',cD);
cD=wthresh(cH,SORH_D,THR_D);
fdn=uint8(idwt2(cA,cH,cV,cD,'Haar'));
30
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
31
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
32
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Ex: express WT of a 5x5 matrix
• Find DWT of #=
J J
• Using wavelet Haar, in which: UV_C =
and A@_C =
J J
33
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Tip: access the ‘wavedec2’ function root and compare to your answer
34
Nguyen Thanh Hai, PhD
University of Technology and Education
Faculty of Electrical & Electronic Engineering
Wavelet Transforms
Wavelet toolbox
[C,S] = wavedec2(X,N,'wname')
Example: clear all;
f=magic(4);
[C,S]=wavedec2(f,1,'Haar');
35
Nguyen Thanh Hai, PhD.
University of Technical Education
Faculty of Electrical & Electronic Engineering
Image Transforms
The End
36
Nguyen Thanh Hai, PhD