51
1 Chapter 5 Chapter 5 Image Image Transforms Transforms

1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

Embed Size (px)

Citation preview

Page 1: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

1

Chapter 5 Chapter 5 Image Image

TransformsTransforms

Chapter 5 Chapter 5 Image Image

TransformsTransforms

Page 2: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 3: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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.

Page 4: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

4

Image TransformsImage TransformsImage TransformsImage Transforms

• Fourier transform

• Discrete Fourier transform

• Discrete Cosine transform

• Hough transform

• Wavelet transform

Page 5: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

Transform

t

f(t)

F()

TransformTransform Input function

Basis function

Basis function g(t)

Operation: Inner Product

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

Page 6: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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(

)()(

Page 7: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

Transform

t

f(t)

0 t

0 t

0 t

F()

Fourier Transform

Page 8: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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)

Page 9: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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);

Page 10: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

-6

-4

-2

0

2

4

6

8

0 1 2 3

Page 11: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

11

Fourier TransformsFourier Transforms

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

Page 12: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 13: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

13

• Example:

uXj

X

euXuA

dxuxjA

dxuxjxfuF

)sin(

]2exp[

]2exp[)()(

0

)()sin(

|||)sin(||)(|

uXuX

AX

euXuA

uF uXj

Page 14: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 15: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

15

• Example:

Input function

)()sin(

)()sin(

),(),(

22

0

2

0

2

)(2

uYeuY

uXeuX

AXY

dyedxeA

dxdyeyxfvuF

uYjuXj

Yvyj

Xuxj

vyuxj

Page 16: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

16

Input function

Spectrum displayedas an intensity function

Fourier spectrum

Page 17: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 18: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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.

Page 19: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

19

Page 20: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

20

Page 21: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

21

Page 22: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 23: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

23

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

Page 24: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

,,

,, *

Page 25: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

25

Page 26: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 27: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

27

Page 28: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 29: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

29

Page 30: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 31: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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).

Page 32: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

32

Fast Fourier Transform (cont’)

Page 33: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

33

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

Page 34: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

34

Fourier High Pass FilteringFourier High Pass Filtering

Page 35: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

35

Fourier Low Pass FilteringFourier Low Pass Filtering

Page 36: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 37: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 38: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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.

Page 39: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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).

Page 40: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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.

Page 41: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 42: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

42

Waves, Wavelets, and Transforms

Waves & Wavelets

Book and booklet

A new word in English - Wavelets

Page 43: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 44: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

WaveletsWavelets

Wavelets are compact support functions

Compact support functions:

The functions are in a limited duration

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

Page 45: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

•These basis functions vary in position as well as frequency

WavesWaves

WaveletsWavelets

Low-frequency High-frequency

Position

Page 46: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 47: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

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

Page 48: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

Transform

t

f(t)

0 t

ba,

0 t

ba,

0 t

ba,

Page 49: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

t

f(t)

Signal

WaveletWavelettransformtransform

Inverse waveletInverse wavelettransformtransform

Time

Frequency

Musical notationWavelet components

Page 50: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

t

f(t)

Signal

FourierFouriertransformtransform

Inverse FourierInverse Fouriertransformtransform

Time

Frequency

Musical notationFourier components

Page 51: 1 Chapter 5 Image Transforms. 2 Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post Processing Scaling

51