Professional Documents
Culture Documents
D ig ita l Im a g e P r o c e s s in g
D ig ita l Im a g e C h a r a c te r is tic s
S p a tia l S p e c tr a l
P r e -P r o c e s s in g
C o m p r e s s io n
In fo r m a tio n T h e o r y L o s s le s s Lossy
L Z W (g if) T ra n s fo r m -b a s e d (jp e g )
S e g m e n ta tio n
E d g e D e te c tio n
D e s c rip tio n
S h a p e D e s c r ip to rs T e x tu re M o r p h o lo g y
Basic ideas
of Image
Transforms
Spatial Frequency
or
Fourier Transform
g(x) = A cos(x)
g(x)
2
x
What is spatial frequency?
A cos(x 2/L)
g(x) Period (L) g(x) = A cos(x 2/)
Wavelength () A cos(x 2f)
Frequency f=(1/ )
Amplitude (A)
Magnitude (A)
x
What is spatial frequency?
g(x) = A cos(x 2f)
g(x)
x
(1/f)
period
But what if cosine is shifted in phase?
What is spatial frequency?
Let us take arbitrary g(x)
x g(x)
0.00 2 cos(0.25) = 0.707106...
0.25 2 cos(0.50) = 0.0
g(x) = A cos(x 2f + )
0.50 2 cos(0.75) = -0.707106...
0.75 2 cos(1.00) = -1.0
A=2 m 1.00 2 cos(1.25) = -0.707106…
f = 0.5 m-1 1.25 2 cos(1.50) = 0
= 0.25 = 45 1.50 2 cos(1.75) = 0.707106...
1.75 2 cos(2.00) = 1.0
g(x) = 2 cos(x 2(0.5) + 0.25)
2.00 2 cos(2.25) = 0.707106...
2 cos(x + 0.25)
x
Now we take discrete values of Ai , fi
and i
gi(x) = Ai cos(x 2fi + i), i = 0,1,2,3,...
x
Now we substitute fi = i/N
gi(x) = Ai cos(x 2fi + i), i = 0,1,2,3,...
gi(x) = Ai cos(x 2i/N + i), i = 0,1,2,3,…,N-1
f=i/N
N = time interval
0 N
Values for various values of i
We calculate f=i/N
values of
function for
various
values of i
0 N
Substituting various values of i to the
formula we get various cosinusoides
gi(x) = Ai cos(x 2i/N + i), i = 0,1,2,3,…,N-1
A2
A0 A1
i=1 i=2
i=0
Changing N to N/2
i=0 i=N/2 - 1
Lowest frequency Highest frequency
What is spatial frequency?
i=0 i=N/2-1
Lowest frequency Highest frequency
What will happen if we take N/2?
i=0 i=N/2
Lowest frequency Too high
Redundant frequency
What is spatial frequency?
g(x) = A cos(x 2f + )
i N / 2 1 i N / 2 1
g ( x) g x A cos x 2 i / N
i 0
i
i 0
i i
We try to approximate a periodic
function with standard trivial
(orthogonal, base) functions
Low frequency
Medium frequency +
=
High frequency +
We add values from component
functions point by point
+
=
+
g(x)
i=1
i=2
i=3
i=4
i=5
i=63
x
Example of periodic 0 127
function created by
summing standard trivial
functions
g(x)
i=1
i=2
i=3
i=4
i=5
i=10
x
0 127
Example of periodic
function created by
summing standard trivial
functions
64 terms
g(x)
10 terms
g(x)
Example of periodic
function created by
summing standard trivial
functions
Fourier Decomposition of a step function (64 terms)
g(x)
i=1
i=2
i=3
i=4
i=5
Example of periodic
function created by i=63 x
summing standard trivial 0 127
functions
Fourier Decomposition of a step function (11 terms)
g(x)
i=1
i=2
i=3
Example of periodic
i=4 function created by
summing standard trivial
i=5 functions
i=10 x
0 63
Main concept – summation of base
functions
Any function of x (any shape) that can
be represented by g(x) can also be
represented by the summation of cosine
functions
i N / 2 1
g ( x) A cos x 2 i / N
i 0
i i
Observe two
numbers for
every i
Information is not lost when we
change the domain
Spatial Domain
Frequency Domain
i N / 2 1
g i ( x) A cos x 2 i / N
i 0
i i
N pieces of information
N/2 amplitudes (Ai, i=0,1,…,N/2-1) and
N/2 phases (i, i=0,1,…,N/2-1) and
Information is not lost when
What is spatial frequency? we
change the domain
i N / 2 1
gi(x) and A cos x 2 i / N
i 0
i i
Are equivalent
They contain the same amount of information
• G-1(G(f)) = g(x)
Power Spectrum and Phase Spectrum
complex Complex conjugate
• Inverse DFT
j 2 nk
N 1
X[n ] x[k ] e N ; n = 0, 1, 2,….., N-1
k 0
2
1 N 1 j nk
x[k ] X[n ] e N ; k = 0, 1, 2,….., N-1
N n 0
Fourier 2D Image Transform
Another formula for Two-Dimensional
Fourier
Image is A cos(x2i/N) B cos(y2j/M)
function
of x and y
fx = u = i/N, fy = v =j/M
image
transform
spectrum
Two Dimensional Fast Fourier in Matlab
Filtering in Frequency
Domain
… will be covered in a separate lecture
on spectral approaches…..
•H(u,v) for various
values of u and v
•These are standard
trivial functions to
compose the image
from
< < image
..and its
spectrum
Image and its
spectrum
Image and its
spectrum
Image and its
spectrum
Convolution Theorem
Let g(u,v) be the kernel
Let h(u,v) be the image
This is a very important result
G(k,l) = DFT[g(u,v)]
H(k,l) = DFT[h(u,v)]
Then
DFT 1 G H g h
where means multiplication
and means convolution.
Then
Multiplication in
Convolution in
spectral domain
spatial domain
DFT 1 G H g h
where means multiplication
and means convolution.
v Image
u
Spectrum Noise and its
spectrum
Noise
filtering
Image Spectrum
u
Image x(u,v) Spectrum log(X(k,l))
v l
u
k
Image of cow with noise
l
v
u
k
white noise white noise spectrum
(1,1)
(1,2) 2
Artificial Feature (2,1)
Neural Vector (2,2) 3
Network .
. 4
.
5
Noise Removal
Transforms for Noise Removal
-1 -2 -1 -1 0 1
0 0 0 -2 0 2
1 2 1 -1 0 1
m pq x p y q f ( x, y ) dx dy
p, q 0, 1, 2....
where
pq
1;
2
for p, q 2, 3,.....
http://engineering.rowan.edu/~shreek/fall01/dip/lab4.html
Image Compression
Please visit the website
http://www.cs.sfu.ca/CourseCentral/365/li/material/notes/Chap4/Chap4.html