Upload
malik-obeisat
View
348
Download
7
Embed Size (px)
Citation preview
Chapter 3
Frequency Transforms &
Image processing in the Frequency Domain
Introduction
The spatial domain refers to the representation of an image as the array of gray-level intensity.
The electromagnetic spectrum consist of sinusoidel waves of different wavelengths (frequencies).
The frequency content of an image refers to the rate at which the gray levels change in the image
Rapidly changing brightness values correspond to high frequency terms, slowly changing brightness values correspond to low frequency terms
The Fourier transform is a mathematical tool that analyses a signal (e.g. images) into its spectral components depending on its wavelength (i.e. frequency) content.
Fourier Transforms In 1822, Jean B. Fourier has shown that any function f(x) that
have bounded area with the x-axis can be expressed as a linear combination of sine and/or cosine waves of different frequencies.
This is also applicable functions of 2 variables, e.g. images.
+
+
+
=
Q. Can we recover the different frequencies of this signal?
Fourier Transforms Fourier transform converts a signal from time (or space) domain
to frequency domain
Illustration of Fourier Theory for images
Every row is Sine wave of frequncy 1
Sine wave with frequncy 3Sine wave with frequncy 2
Mixed waves with frequncy 5, 2 &1Combined waves frequncy 1+2+3
MATLAB generated images MATLAB can be used to generate images with patterns of and
desired rate of change of brightness. For this we need to use trigonometric functions of 2 variables as
indicated by the following example code:clear all;A=zeros(256,256);B=A;for i=1:1:256 for j=1:1:256 A(i,j)=a1*sin(pi*(a2*i+a3*j)/m);
B(i,j)=b1cos(pi*(b2*i+b3*j)/n); //m and n are to be powers of 2.
endendC=A+B;imshow(C);imwrite(C, 'SinoPattern2.bmp')
Images generated from Sinoside function
Fourier Transform - Definition
The Discrete Fourier Transform (DFT) of f(x) is defined as:
1
0
1
0
) 2
sin()() 2
cos()(M
u
M
u M
xuuI
M
xuuRf(x)
The u values u = 0, 1, ..., M-1) is the frequency domain of f(x).
One can use Excel to implement Fourier tranforms.
1
0
1
0
) 2
sin()(1
) 2
cos()(1
M
x
M
x M
xuxf
MM
xuxf
MF(u)
And the inverse DFT (IDFT) is defined as:
Fourier Transform - continued
.)()(
,)/2sin()(1
,)/2cos()(1
1
0
1
0
uIuR F(u)
MuxxfM
I(u)
MuxxfM
R(u)
M
x
M
x
i.e.
part.imaginary the called
and part, real the called
Unlike f(x), F(u) is a complex valued function, i.e. is a pair of functions involving trigonometric functions:
F is represented by its MAGNITUDE and PHASE rather that its REAL and IMAGINARY parts,
where: MAGNITUDE(u) = SQRT( R(u)^2+IMAGINARY(u)^2 )
The phase angle of the transform is:
).)(
)((tan)( 1
uR
uIu
PHASE(u) = ATAN( IMAGINARY(u)/REAL(u) )
The 2-dimensional DFT The DFT of a digitised function f(x,y) (i.e. an image) is defined as:
Note that, F(0,0) = the average value of f(x,y) and is refered to as the DC component of the spectrum.
It is a common practice to multiply the image f(x,y) by (-1)x+y. In this case, the DFT of (f(x,y)(-1)x+y) has its origin located at the centre of the image, i.e. at (u,v)=(M/2,N/2).
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
)/ / ( 2sin(),(
)/ / ( 2cos(),(
.before asmanner similar ain defined is DFT inverse theand
)/ / ( 2sin(),(1
)/ / ( 2cos(),(1
,
),(N
u
M
v
N
u
M
v
M
x
N
y
M
x
N
y
NyvMxuvuI
NyvMxuvuR
NyvMxuyxfMN
NyvMxuyxfMN
v)F(u
yxf
The Fourier spectrum – in 2D
The Fourier spectrum – in 2D
• The original image contains two principal features: edges run approximately at ±45ο .
• The Fourier spectrum shows important components in the same directions.
Fourier Spectrum
Log enhanced version of Fourier Spectrum
Original imageInverse Fourier
The FTs also tend to have bright lines that are perpendicular to lines in the original letter. If the letter has circular segments, then so does the FT.
Filtering in the Frequency Domain – Scheme
The Notch filter
Original image
Note that the edges stand out more than before filtering. When the average value is 0, some values of the filtered image are negative, but for display purposes pixel values are shifted.
Image after Notch filter application
A simple filter that forces the average image value to become 0.
The average value of an image f(x,y) is the DC component of the
DFT spectrum i.e. F(0,0). The Notch filter is defined as follows:
otherwise.
N/2)(M/2, v)(u, if
1
0),(
vuH
Low-pass and High-pass filtering
Low frequencies in the DFT spectrum correspond to image values over smooth areas, while high frequencies correspond to detailed features such as edges & noise.
A filter that suppresses high frequencies but allows low ones is called Low-pass filter, while a filter that reduces low frequencies and allows high ones is called High-pass filter.
Examples of such filters are obtained from circular Gaussian functions of 2 variables (see next slide)
.)e()v,u(H
,e)v,u(H
/)vu(
/)vu(
filter Highpass- 12
1
filter, Lowpass - 2
1
222
222
22
22
Low-pass & High-pass filtering - Example
Low pass filtering
High pass filtering
Low pass filtering results in blurring effects, while High pass filtering results in sharper edges.
Wavelet Transforms
Wavelet analysis allows the use of long time intervals for more precise low-frequency information, and shorter intervals for high-frequency information.
A wavelet (i.e. small wave) is a mathematical function used to analyse a continuous-time signal into different frequency components at different resolution scale.
A wavelet transform of a function is a representation of f wavelets. The wavelets are scaled and translated copies of a finite-length or fast-decaying oscillating waveform (t), known as the mother wavelet.
There are many wavelet filters to choose from. Here we only discuss the Discrete Wavelet Transform.
Wavelet Transforms -Properties
The Wavelet transform is a short time anlysis tool of finite energy quasi-stationary signals at multi-resolutions.
The Discrete wavelet transform (DWT) provide a compact representation of a signal’s frequency commponents with strong spatial support.
DWT decomposes a signal into frequency subbands at different scales from which it can be perfectly recontructed.
2D-signals such as images can be decomposed in many different ways.
The Haar Wavelet
It can be implemented using a simple filter:
If X={x1,x2,x3,x4 ,x5 ,x6 ,x7 ,x8 } is a time-signal of length 8, then the Haar wavelet decomposes X into an aproximation subband containing the Low frequencies and a detail subband containing the high frequencies:
Low= {x2+x1, x4+x3 , x6+x5 , x8+x7 }/2
High= {x2-x1, x4-x3 , x6-x5 , x8-x7 }/2
The Haar wavelet
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
-2 0 2 4 6 8 10
The Haar wavelet is a discontinuous, and resembles a step function.
It is a crude version of the Truncated cosine.
Haar Wavelet – in MATLAB
Wavelet Decomposition of Images
1 stage Transformation
After 2 stages
Original Image
…
A Haar wavelet decompose images first on the rows and then on the columns resulting in 4 subbands, the LL-subband which an approximation of the original image while the other subbands contain the missing details
The LL-subband output from any stage can be decomposed further.
Different Decomposition Schemes.
The previous 2 decomposition scheme is known as the Pyrimad scheme, whereby at successive stages only the LL subband is wavelet transdormed.
Other decomposition schemes include:
The standard scheme – At every stage all the image is wavelet transformd
The wavelet packet – After stage 1, a non-LL subband is transformed only if it satisfied certain condition.
The Quincux – During each stage, the columns decomposition is only applied on the L-subband
LL subband
0
100
200
300
400
500
600
700
1 25 49 73 97 121 145 169 193 217 241
HL subband
0
1000
2000
3000
4000
5000
6000
1 25 49 73 97 121 145 169 193 217 241
LH subband
010002000300040005000600070008000
1 25 49 73 97 121 145 169 193 217 241
HH subband
0
1000
2000
3000
4000
5000
6000
1 25 49 73 97 121 145 169 193 217 241
Statistical Properties of Wavelet subbands
Original pixels distribution of Mandrill
0
500
1000
1500
2000
2500
3000
1 20 39 58 77 96 115
134
153
172
191
210
229
248
coefficient value
frequ
ency
The distribution of the LL-subband approximate that of the original but all non-LL subbands have a Laplacian distribution. This remains valid at all depths.
Applications of Wavelet Transforms
The list of applications is growing fast. These include:
Image and video Compression
Feature detection and recognition
Image denoising
Face Recognition
Signal interpulation
Most applications benefit from the statistical propererty of the non-LL subbands (The laplacian distribution of the wavelet coefficients in these subbands).
Wavelet-based Feature detection Non-LL subbands of a wavelet decomposed image contains high
frequencies (i.e. image features) which are highlighted. These significant coefficients are the furthest away from the mean.
Thresholding reveals the main features.
Horizontal features
Vertical features
28
Extracting significant coefficients
Best value for sigma is related to the STD
0
NSC
SC
- +
HH1 LH1
HL1 HH2
HL2
LH2
Feature enhancement method using wavelet sub-band segmentation
29
End of Chapter 3