1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction...

Preview:

Citation preview

1

Chapter 5 Chapter 5 Image Image

TransformsTransforms

Chapter 5 Chapter 5 Image Image

TransformsTransforms

2

Image Image Processing for Processing for Pattern Pattern RecognitionRecognition

Feature Extraction

Acquisition

Preprocessing

Classification

Post Processing

ScalingCenteringEnhancementFiltering (Transform) Binarization (Thresholding)Edge detectionThinning

Pixel Feature (Histogram)Boundary ProjectionMomentsTransformation

MatchingTree Classification Neural Network

3

Why need transformation?Why need transformation?

• By image transformation with different basis functions (kernels), image f(x,y) is decomposed into a series expansion of basis functions, which are used as the featuresfeatures for further recognition.

4

Image TransformsImage TransformsImage TransformsImage Transforms

• Fourier transform

• Discrete Fourier transform

• Discrete Cosine transform

• Hough transform

• Wavelet transform

Transform

t

f(t)

F()

TransformTransform Input function

Basis function

Basis function g(t)

Operation: Inner Product

),(),( ),()()( wtgtfdtwtgtfwF

Wave transforms

• Wave transforms use the waves as their basis functions• Fourier transform uses sinusoidal waves as its orthogonal basis functions

dttjttf

dtetfF tj

)sin)(cos(

)()(

Transform

t

f(t)

0 t

0 t

0 t

F()

Fourier Transform

f0(x) = 1;

f1(x) = sin(x);

f2(x) = cos(2x);

f3(x) = cos(3x);

f4(x) = sin(18x);

f(x) = f0(x) +

f1(x) +

2f2(x) -

4f3(x) +

f4(x)

f1

2f2

- 4f3

f4

f0

f0(x) = 1;

f1(x) = sin(x);

f2(x) = cos(2x);

f3(x) = cos(3x);

f4(x) = sin(18x);

f0(x) = 1;

f1(x) = sin(x);

f2(x) = cos(2x);

f3(x) = cos(3x);

f4(x) = sin(18x);

f = f0f = f0 + f1 + f1 +2f2 +2f2 - 4f3- 4f3 + f4

-6

-4

-2

0

2

4

6

8

0 1 2 3

11

Fourier TransformsFourier Transforms

• Fourier integral transform• Discrete Fourier transform (DFT)• Fast Fourier Transform (FFT)

12

• Let f (x) be a continuous function of a real variable x. The Fourier transform of f (x) is

dxuxjxfuF ]2exp[)()(

Input signal Basic function

• F(u) is complex: )()()( ujIuRuF Real component Imaginary component

• Fourier spectrum: |)()(||)(| 22 uIuRuF

• Phase angle:

)()(

tan)( 1

uRuI

u

13

• Example:

uXj

X

euXuA

dxuxjA

dxuxjxfuF

)sin(

]2exp[

]2exp[)()(

0

)()sin(

|||)sin(||)(|

uXuX

AX

euXuA

uF uXj

14

• The 2-D Fourier transform of f (x,y) is

( , ) ( , ) exp[ 2 ( )] F u v f x y j u ux vy dxdy

• Fourier spectrum:

|),(),(||),(| 22 vuIvuRvuF

• Phase angle:

),(),(

tan),( 1

vuRvuI

vu

15

• Example:

Input function

)()sin(

)()sin(

),(),(

22

0

2

0

2

)(2

uYeuY

uXeuX

AXY

dyedxeA

dxdyeyxfvuF

uYjuXj

Yvyj

Xuxj

vyuxj

16

Input function

Spectrum displayedas an intensity function

Fourier spectrum

17

Discrete Fourier Transform• 1D:

• 2D: (N=M)

1

0

/2

1

0

/21

N

u

Nuxj

N

x

Nuxj

euFxf

exfN

uF

1

0

1

0

/2

1

0

1

0

/2

,1

,

,1

,

N

u

N

v

Nvyuxj

N

x

N

y

Nvyuxj

evufN

yxf

eyxfN

vuF

18

Discrete Fourier Transform (cont’)

• The Fourier spectrum, phase, and energy spectrum of 1D and 2D discrete functions are the same as the continuous case. But unlike the continuous case, both F(u) and F(u,v) always exist in the discrete case.

19

20

21

22

Some Properties of the 2D Fourier Transform

• Separability:

– The principle advantage of the separability property is that F(u, v) or f(x, y) can be obtained in two steps by successive applications of the 1D FT or its inverse.

1

0

/21

0

/2

1

0

/21

0

/2

,1

,

,1

,

N

v

NvyjN

u

Nuxj

N

y

NvyjN

x

Nuxj

evuFeN

yxf

eyxfeN

vuF

23

Some Properties of the 2D Fourier Transform (cont’)

24

Some Properties of the 2D Fourier Transform (cont’)

• Periodicity and Conjugate Symmetry:

– If f(x, y) is real, the FT also exhibits conjugate symmetry:

NvNuFNvuFvNuFvuF ,,,,

vuFvuF

vuFvuF

,,

,, *

25

26

Some Properties of the 2D Fourier Transform (cont’)

• Translation:

where the double arrow is used to indicate the correspondence between a function and its FT (and vice versa).

00

/2

00/2

,,

,,00

00

yyxxfevuF

vvuuFeyxfNvyuxj

Nyvxuj

27

28

Some Properties of the 2D Fourier Transform (cont’)

• Scaling and Distributivity

– FT and its inverse are distributive over addition, but not over multiplication.

1 2 1 2

/ , / ,

, , , ,

f x a y b F au bv

F f x y f x y F f x y F f x y

29

30

Some Properties of the 2D Fourier Transform (cont’)

• Average Value:

Substituting u=v=0 into F(u, v) yields

Giving

1 1

20 0

1, ,

N N

x y

f x y f x yN

1

0

1

0

,1

0,0N

x

N

y

yxfN

F

1, 0,0f x y F

N

31

Fast Fourier Transform (FFT)Fast Fourier Transform (FFT)• The number of complex multiplications and

additions required to implement a 1D discrete Fourier Transform is proportional to N2. The FFT computation of this is Nlog2N.

• In the 2D case, the number of direct operations is N4 and the FFT operation is 2N2log2N.

• FFT offers considerable computation advantage over direct implementation when N is relatively large (>256).

32

Fast Fourier Transform (cont’)

33

Fourier Transform (FFT) and Fourier Inverse Transform (FFT)Fourier Transform (FFT) and Fourier Inverse Transform (FFT)

34

Fourier High Pass FilteringFourier High Pass Filtering

35

Fourier Low Pass FilteringFourier Low Pass Filtering

36

Discrete Cosine TransformDiscrete Cosine Transform• The 1-D DCT of a function f (x) is C(u), u = 0,

1, 2, …, N-1

1

0

1

0

2

)12(cos)(

2)(

)(1

)0(

N

x

N

x

N

uxxf

NuC

xfN

C

• By the DCT, a function f(x) is decomposed into a series expansion of basis functions, which are used as the features

37

• The 2-D DCT of an image f (x,y) is C(u,v), u,v = 0, 1, 2, …, N-1

])12[cos(])12)[cos(,(2

1),(

),(1

)0,0(

1

0

1

03

1

0

1

0

vyuxyxfN

vuC

yxfN

C

N

y

N

x

N

y

N

x

• By the DCT, image f(x,y) is decomposed into a series expansion of basis functions, which are used as the features

38

Hough TransformHough Transform

Consider a point (xi, yi) and the general equation of a straight line in slope-intercept form,

yi=axi+b.

There is an infinite number of lines that pass through (xi, yi), but they all satisfy the above equation for varying values of a and b.

39

Hough Transform (cont’)Hough Transform (cont’)

• Consider b=-xia+yi, and the ab plane (parameter space), then we have the equation of a single line for a fixed pair (xi, yi).

40

Find the locations of strong peaks in the Hough transform matrix. The locations of these peaks correspond to the location of straight lines in the original image.

41

In this example, the strongest peak in R corresponds to and , . The line perpendicular to that angle and located at x’ is shown below, superimposed in red on the original image. The Radon transform geometry is shown in black.

94q

101x

42

Waves, Wavelets, and Transforms

Waves & Wavelets

Book and booklet

A new word in English - Wavelets

Waves & WaveletsWaves & WaveletsWavesWaves

• Waves are non-compact support functions• Non-compact support function The functions extend to infinity in both directions They are non-zero over their entire domain

f(x), x = - , …, 0, …, f(-) 0, f() 0

WaveletsWavelets

Wavelets are compact support functions

Compact support functions:

The functions are in a limited duration

f(x) 0, for x = (a, b)

•These basis functions vary in position as well as frequency

WavesWaves

WaveletsWavelets

Low-frequency High-frequency

Position

0 dttR

a is a scale parametera scale parameter, b is a translation parametera translation parameter.

,, 1 dttfbafW abt

Ra

Wavelet Transform

For any f(t) L2(R), the wavelet transform is

A function (t) R is called a wavelet, if it satisfies

where

dtetfF tj

)()(Wave Transform

An example of Wavelet Transform• Haar function (mother)

• Haar baby wavelets

(t)

0

1

-1

10.5

t

otherwiswfor,0

121for,1

21t0for,1

)( tt

10.5

t

0

)12(2 t

0 42 t

)12

(2

1 t

Transform

t

f(t)

0 t

ba,

0 t

ba,

0 t

ba,

t

f(t)

Signal

WaveletWavelettransformtransform

Inverse waveletInverse wavelettransformtransform

Time

Frequency

Musical notationWavelet components

t

f(t)

Signal

FourierFouriertransformtransform

Inverse FourierInverse Fouriertransformtransform

Time

Frequency

Musical notationFourier components

51

Recommended