Image Transformations

pancakesnightmuteAI and Robotics

Nov 5, 2013 (3 years and 5 months ago)

66 views

Image Transformations

DFT,DCT,Hotelling,Wavelet ...

Image processing in spectral domain

Enhancement

Restoration

(from a known defect)


Spatial

Domain

Spectral

Domain

Point Processing

E.g.

>
Contrast adjust.

>
Histogram equalization

Spatial filtering

E.g.

>Edge masks

Filtering

E.g.

>Freq. domain ops.

Inverse filtering

Wiener filtering

Spectral

Domain

Fourier Transform (1D)



)
f
(
j
ft
2
j
e

)
f
(
W
)
f
(
W
)
f
(
Y

j
)
f
(
X
)
f
(
W
dt
e

)
t
(
w
)
t
(
w
)
f
(
W












F
Continuous Fourier Transform (CFT)

Frequency, [Hz]

Amplitude

Spectrum

Phase

Spectrum



df
e

)
f
(
W
)
f
(
W
)
t
(
w
ft
2
j
1
-








F
Inverse Fourier Transform (IFT)

Discrete Fourier Transform (1D)



Discrete Domains


Discrete Time:


k = 0, 1, 2, 3, …………, N
-
1


Discrete Frequency:

n = 0, 1, 2, 3, …………, N
-
1




Discrete Fourier Transform






Inverse DFT

Equal time intervals

Equal frequency intervals













1
N
0
k
nk
N
2
j
;
e

]
k
[
x
]
n
[
X











1
N
0
n
nk
N
2
j
;
e

]
n
[
X
N
1
]
k
[
x
n = 0, 1, 2,….., N
-
1

k = 0, 1, 2,….., N
-
1

2D


D
iscrete

Fourier Transform


















1
0
,
/
2
1
1
0
,
/
2
1
]
,
[
]
,
[
]
,
[
]
,
[
N
m
n
N
ml
nk
j
N
N
l
k
N
ml
nk
j
N
e
m
n
x
l
k
X
e
l
k
X
m
n
x


Base
-
functions are
sinusaoidal
waves

2D
-

DFT

Base
-
functions are waves

l

k



N
ml
nk
j
e
/
2



Amplitude

and
Phase

original

amplitude

phase

)
(
x
F
)
(
x
F

Separability property of DFT























1
0
/
2
1
1
0
/
2
1
1
0
,
/
2
1
]
,
[
]
,
[
]
,
[
]
,
[
]
,
[
]
,
[
N
l
N
ml
j
N
N
k
N
nk
j
N
N
l
k
N
ml
nk
j
N
e
l
n
y
m
n
x
e
l
k
X
l
n
y
e
l
k
X
m
n
x



2D FFT=1D FFT for all lines and 1D FFT for all columns

(DFT in row direction)

(DFT in column direction)

Fast Fourier Transform

recursive algorithm



decimation in time = odd even in freq. domain



decimation in freq. domain = odd even in time

N
N
N
log
2
4

Linear Digital Filters

in Freq. Domain

digital filter

input

output

X
H
Y
x
h
y
F









impulse
-
response



transfer
-
function



amplification



phase
-
shift

]
,
[
]
,
[
]
,
[
]
,
[
m
n
H
m
n
H
m
n
H
j
i
h

Visualizing the

Discrete Fourier
t
ransform


Consider the
power
spectrum of the
1D
square
wave


0
1
2
3
4
5
6
7
0
50
100
150
200
250
300
350
Visualizing the

Discrete Fourier
t
ransform

(circular shifting)


The FT is centered about the origin


But the DFT is centered about N/2


We need to correct with a circular shift operation


Or, multiply by (
-
1) prior to taking the transform


0
1
2
3
4
5
6
7
0
50
100
150
200
250
300
350
k

Filtering in Frequency Domain: Basic Steps


Multiply pixel f(x,y) of the input image by (
-
1).


Compute
the DFT:
F(u,v)


G(u,v)=F(u,v)H(u,v)


g
1
(x,y)=F


{G(u,v)}


g(x,y) = g
1
(x,y)*(
-
1)

x+y

x+y

-
1

Ideal Low Pass Filters


D :
The cut
-
of
f
frequency


Image power as a function of distance from
the origin of DFT (5, 15, 30, 80, 230)

o

Ringing e
ffect of Ideal Low Pass Filters

Example 2: Original and images
LPFed with ideal filters

(with cut
-
off freqs getting larger)

Butterworth

Low Pass F
ilter





k
r
m
n
m
n
H
2
2
2
2
/
1
1
]
,
[





low
-
pass filter



cut
-
off frequency; radius
r



order; sharpness
k

k=1

k=5

r=0.1

Gaussian Low Pass Filter

D
(
u,v
): distance from

the origin of

Fourier transform













2
2
2
)
,
(
exp
)
,
(

v
u
D
v
u
H
High Pass Filters


Ideal high pass filter





Butterworth high pass filter





Gaussian high pass filter






.
1
)
,
(
0
)
,
(
otherwise
D
v
u
D
if
v
u
H
o


n
v
u
D
D
v
u
H
2
0
)
,
(
/
1
1
)
,
(













2
0
2
2
)
,
(
exp
1
)
,
(
D
v
u
D
v
u
H
Alternative to Fourier Transformation ?

O
ther orthogonal transformations
:



Cosine transform



Hadamar transform



Haar transform



Wavelet transform



Karhunen
-
Loeve



Slant transform

cosine
-
functions

block
-
waves

hierarchical block
-
functions

Discrete
Cosine
T
ransform

1
(2 1)
2
0
( ) ( ) ( ) cos
N
x u
N
x
C u u f x





 

 

1
1
2
( )
N
N
u







for
u = 0,1,....,N
-
1

1D DCT:

1
(2 1)
2
0
( ) ( ) ( ) cos
N
x u
N
u
f x u C u





 

 

for
x = 0,1,....,N
-
1

1D IDCT:

for u=0

for u=1,2,...,N
-
1

1
(2 1) (2 1)
2 2
0
(,) ( ) ( ) (,) cos cos
N
x u x v
N N
x
C u v u v f x y
 
 

 

   

   

for
u,v = 0,1,....,N
-
1

2D DCT:

1
(2 1) (2 1)
2 2
0
(,) ( ) ( ) (,) cos cos
N
x u x v
N N
u
f x y u v C u v
 
 

 

   

   

for
x,y = 0,1,....,N
-
1

2D IDCT:

Hotelling Transform (aka Karhunen Lowe
Transform or Principle Component
Analysis)

1
2
.
.
n
x
x
x
x
 
 
 
 

 
 
 
 
1
1
{ }
M
x k
k
m E x x
M

 

x
,........,

M data points

1

M

1
1
{( )( ) }
M
T T
T
x x x k k k k
k
C E x m x m x x m m
M

    

Mean:

Covariance:

Hotelling Transform:

( )
x
y A x m
 
The rows of matrix A are the eigen vectors of the covarience matrix

arranged in descending order (The first row corresponds to the eigen vector

corresponding to the largest eigen value of C, ...)

Hotelling T. Example: x vectors are
coordinates of points

Hotelling T. Example: x vectors are point
values in several spectral bands (channels)

From channels to principle components

Wavelet Transform


WT
:

Unification

of

Several

Techniques


Filter

Bank

Analysis


Pyramid

Coding



Subband

Coding


Three

Types

of

WT


CWT

(Continuous

WT)


Wavelet

series

expansion


DWT

(Discrete

WT)


Discrete WT


DWT


Most closely resembles unitary transforms


Most useful in image compression


Given a set of orthonormal basis fct.’s, DWT just like unitary
transform


Orthonormal wavelets with compact support

(by
Daubechies):



j,k
: integers


compact

support
:

[
0
,
2
r
-
1
]


shift
:

k


dilation

(scaling)
:




N
-
point

signal

N

coefficients



image

coefficients


)}
2
(
2
/
2
{
)}
(
{
k
x
j
r
j
x
r




j
2
0
20
40
60
80
100
120
140
-2.5
-2
-1.5
-1
-0.5
0
0.5
1
a=1

a=6

N
N

2
N


Scaling

Image Processing applications of
DWT



Block

Diagram



2
-
D Wavelet
transform for
image

decomposition


Quantization

Coding of
quantized
coefficients

Input
image

Image Compression

Processing in Wavelet Domain


(e.g. compute cooccurence matrices)

for texture segmentation

.

.

.

DWT for Image Compression


Image Decomposition



Scale 1




4 subbands:


Each coeff. a 2*2 area in the original image


Low frequencies:


High frequencies:

LL
1

HL
1

LH
1

HH
1

1
1
1
1
,
,
,
HH
LH
HL
LL

2
/
0









2
/
DWT for Image Processing


Image
Decomposition




Scale 2


4 subbands:


Each coeff. a 2*2
area in scale 1 image


Low Frequency:


High frequencies:


HL
1

LH
1

HH
1

HH
2

LH
2

HL
2

LL
2

2
,
2
,
2
,
2
HH
LH
HL
LL

4
/
0




2
/
4
/





At a coarser scale, coefficients represent a larger spatial area of the
image but a narrow band of frequencies.

DWT for Image Processing


Image Decomposition


Parent


Children


Descendants: corresponding
coeff. at finer scales


Ancestors: corresponding
coeff. at coarser scales



HL
1

LH
1

HH
1

HH
2

LH
2

HL
2

HL
3

LL
3

LH
3

HH
3


Parent
-
children dependencies of subbands: arrow points
from the subband of parents to the subband of children.