Transcript
Page 1: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

FFTs in Graphics and Vision

Alignment, Invariance

and Pattern Matching

1

Page 2: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Outline

Alignment

Shape Matching

Invariance

Pattern Matching

2

Page 3: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Representation

For 2D shape matching/analysis, it is common to

represent the geometry of a shape by a circular

array of real values.

3

Page 4: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Representation

Example:

The circular extent function represents the extent

of the shape about the center of mass:• The value at an angle is the distance to the last

point of intersection of the ray from the origin, with

angle , with the shape

4

Page 5: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Since the shape of an object doesn’t change

when we rotate it, we would like to know if the two

arrays are equivalent, up to rotation.

=?

5

Page 6: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Is there a rotation that will rotate the first array

into the second?

6

Page 7: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Is there a rotation that will rotate the first array

into the second?

Given the n-dimensional arrays f[ ] and g[ ], is

there an index such that:

]) [(] [ fg

nkkfkg 0 ][][

7

Page 8: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Semantics

In a continuous setting, asking the binary

question “are the arrays equal” is not very

meaningful, sinceSampling

Noise

Etc

can result in two “equal” arrays having different

values.

8

Page 9: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Semantics

Is there a rotation that will rotate the first array

into the second?

For every rotation, how close is the rotation of the

first array to the second array?

9

Page 10: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Semantics

Is there a rotation that will rotate the first array

into the second?

For every rotation, how close is the rotation of the

first array to the second array?

For every rotation , what is the value of:

] []), [( gfD10

Page 11: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Since the space of functions on a circle is an

inner product space, there is an implicit metric

defined by:

] [] [], [] [] [] [] [], [22 gfgfgfgfD

11

Page 12: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Since the space of functions on a circle is an

inner product space, there is an implicit metric

defined by:

So in our situation, we would like to evaluate:

at every .

] [] [], [] [] [] [] [], [22 gfgfgfgfD

] []) [(], []) [(] []), [(2 gfgfgfD

12

Page 13: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Re-writing this equation gives:

] []) [(], []) [(] []), [(2 gfgfgfD

] []), [(] []), [(

] [], []) [(]), [(] []), [(2

gfgf

ggffgfD

13

Page 14: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Since the Hermitian dot-product of two real-

valued arrays is also a real value:

] []), [(2] []) [(] []), [(222 gfgfgfD

] []), [(] []), [(

] [], []) [(]), [(] []), [(2

gfgf

ggffgfD

14

Page 15: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Since is a unitary transformation:

] []), [(2] [] [] []), [(222 gfgfgfD

] []), [(2] []) [(] []), [(222 gfgfgfD

15

Page 16: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

So, to compute the distance between a rotation of

the circular array f[ ] by , and the circular array

g[ ], we need to know:The magnitude of f[ ]: ,

The magnitude of g[ ]: ,

The value of the cross-correlation:

] []), [(2] [] [] []), [(222 gfgfgfD

2] [f

2] [g

] []), [( gf

16

Page 17: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

• The size of f[ ]:This is a constant value independent of and can be

computed in O(n) time.

• The size of g[ ]:This is a constant value independent of and can be

computed in O(n) time.

• The value of the cross-correlation:This can be computed using the FFT in O(n log n)

time.

] []), [(2] [] [] []), [(222 gfgfgfD

2] [f

2] [g

] []), [( gf

17

Page 18: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

] []), [(2] [] [] []), [(222 gfgfgfD

f[ ] g[ ]] []), [( gfD

18

Page 19: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Alignment

Instead of looking for the minimum of the moving

L2-difference, why not just look for the maximum

of the moving dot-product?

] []), [(2] [] [] []), [(222 gfgfgfD

f[ ] g[ ]

]])[ [] [( gf *

19

Page 20: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Outline

Alignment

Shape Matching

Invariance

Pattern Matching

20

Page 21: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

In shape matching applications, we would like to

find the shapes in a database that are most

similar to a given query.

Query

21

Page 22: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

General approach:

Define a function that takes in two models and

returns a measure of their proximity.

D , D ,M1 M1 M3M2

M1 is closer to M2 than it is to M322

Page 23: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Database Retrieval

• Compute the distance from the query to each

database model

3D Query

Database Models

Q

M1

M2

Mn

D(Q,Mi)

23

Page 24: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Database Retrieval

• Sort the database models by proximity

3D Query

Database Models Sorted Models

D(Q,Mi)

Q

M1

M2

Mn

M1

M2

Mn

~

~

~

ji

MQDMQD ji )~

,()~

,(

24

Page 25: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

~

Database Retrieval

• Return the closest matches

Best Match(es)

3D Query

Database Models Sorted Models

D(Q,Mi)

Q

M1

M2

Mn

M1

M2

Mn

~

~

~

ji

MQDMQD ji )~

,()~

,(

M1~

M2

25

Page 26: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

In shape matching applications, we would like to

find the shapes in a database that are most

similar to a given query.

To do this efficiently, models are often

represented by Shape Descriptors: Arrays of values encapsulating information about

the shape of the model, such that

The distance between the arrays gives a measure

of proximity of the underlying shapes.

26

Page 27: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

Challenge:

Since the shape of the model doesn’t change if

we rotate it, we would like to match models

across rotational poses.

=

27

Page 28: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

Challenge:

Since the shape of the model doesn’t change if

we rotate it, we would like to match models

across rotational poses.

Solution 1:

One way to resolve is this is to define the

measure of similarity by computing the cross-

correlation, to find the distance between two

models at the best possible alignment.

28

Page 29: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

Challenge:

Since the shape of the model doesn’t change if

we rotate it, we would like to match models

across rotational poses.

Solution 1:

One way to resolve is this is to define the

measure of similarity by computing the cross-

correlation, to find the distance between two

models at the best possible alignment.

This can be too slow for interactive

applications that need to return the best

match from very large databases.

29

Page 30: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

Challenge:

Since the shape of the model doesn’t change if

we rotate it, we would like to match models

across rotational poses.

Solution 1:

One way to resolve is this is to define the

measure of similarity by computing the cross-

correlation, to find the distance between two

models at the best possible alignment.

This can be too slow for interactive

applications that need to return the best

match from very large databases.

Not quite true for 1D arrays, but becomes

more true as the dimension increases.

30

Page 31: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Shape Matching

Challenge:

Since the shape of the model doesn’t change if

we rotate it, we would like to match models

across rotational poses.

Solution 2:

Alternatively, we can try to design a shape

descriptor that is rotation invariant: Instances of the same shape in the same pose will

give the same shape descriptor.

31

Page 32: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Given an array f[ ], we would like to define a

(possibly non-linear) mapping taking f[ ] to

some array g[ ], such that for all :

f[ ] g[ ]

]) [(]) [( gf

]) [(]) [( ff

32

Page 33: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Given an array f[ ], expressed in terms of its

Fourier decomposition:

What happens to the Fourier coefficients of f[ ] as

we rotate f[ ]?

1

0

] [][ˆ] [n

k

kvkff

33

Page 34: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Given an array f[ ], expressed in terms of its

Fourier decomposition:

What happens to the Fourier coefficients of f[ ] as

we rotate f[ ]?

1

0

] [][ˆ] [n

k

kvkff

1

0

]) [(][ˆ]) [(n

k

kvkff

34

Page 35: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Since the vk[ ]are a basis for the one-dimensional

irreducible representations of the rotation group,

we know that:

where k( ) is some complex number.

1

0

]) [(][ˆ]) [(n

k

kvkff

] [)(]) [( kkk vv

35

Page 36: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Since the vk[ ]are a basis for the one-dimensional

irreducible representations of the rotation group,

we know that:

where k( ) is some complex number.

Since the representation is unitary, we know that

k( ) must have unit complex norm.

] [)(]) [( kkk vv

1

0

]) [(][ˆ]) [(n

k

kvkff

36

Page 37: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Thus, if:

Are the Fourier coefficients of f[ ], then the Fourier

coefficients of (f[ ]) will be:

]1[ˆ)(,],1[ˆ)(],0[ˆ)( 110 nfff n

]1[ˆ,],1[ˆ],0[ˆ nfff

1

0

]) [(][ˆ]) [(n

k

kvkff

37

Page 38: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Thus, if:

Are the Fourier coefficients of f[ ], then the Fourier

coefficients of (f[ ]) will be:

and we have:

for all k.

]1[ˆ)(,],1[ˆ)(],0[ˆ)( 110 nfff n

]1[ˆ,],1[ˆ],0[ˆ nfff

][ˆ][ˆ)( kfkfk

1

0

]) [(][ˆ]) [(n

k

kvkff

38

Page 39: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

So, we can get a rotation invariant representation

of f[ ] by storing only the magnitudes of the

Fourier coefficients (i.e. discarding phase):

]1[ˆ,,]1[ˆ,]0[ˆ]) [( nffff

][ˆ][ˆ)( kfkfk

39

Page 40: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

What kind of information do we get when we

compare just the amplitudes of the Fourier

coefficients?

40

Page 41: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Suppose that we are given two arrays f[ ] and g[ ]

with only one non-zero Fourier coefficient:

what is the measure of similarity

at the optimal alignment?

] [][ˆ] [

] [][ˆ] [

k

k

vkgg

vkff

][ˆ kg

][ˆ kf

x

iy

41

Page 42: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Suppose that we are given two arrays f[ ] and g[ ]

with only one non-zero Fourier coefficient:

what is the measure of similarity

at the optimal alignment?

If we rotate f[ ] by , this

amounts to multiplying the

k-th Fourier coefficient by e-ik .

] [][ˆ] [

] [][ˆ] [

k

k

vkgg

vkff

][ˆ kg

][ˆ kf

x

iy

42

Page 43: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Suppose that we are given two arrays f[ ] and g[ ]

with only one non-zero Fourier coefficient:

what is the measure of similarity

at the optimal alignment?

If we rotate f[ ] by , this

amounts to multiplying the

k-th Fourier coefficient by e-ik .

But this is just a rotation in the complex plane.

] [][ˆ] [

] [][ˆ] [

k

k

vkgg

vkff

][ˆ kg

][ˆ kf

x

iy

43

Page 44: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Suppose that we are given two arrays f[ ] and g[ ]

with only one non-zero Fourier coefficient:

what is the measure of similarity

at the optimal alignment?

At the optimal rotation, the

Fourier coefficients are on

the same line and the measure

of similarity is the difference between the lengths.

] [][ˆ] [

] [][ˆ] [

k

k

vkgg

vkff

][ˆ kg

][ˆ kfx

iy

44

Page 45: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Thus, storing only the amplitude of the Fourier

coefficients and discarding phase, we get a shape

representation (f[ ]) that: Is invariant to rotations

Provides a measure of similarity that corresponds

to the distance between f[ ] and g[ ] if we could

optimally align the different frequency components

independently.

45

Page 46: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Thus, storing only the amplitude of the Fourier

coefficients and discarding phase, we get a shape

representation (f[ ]) that: Is invariant to rotations

Provides a measure of similarity that corresponds

to the distance between f[ ] and g[ ] if we could

optimally align the different frequency components

independently.

This is a lower bound for the distance between f[ ]

and g[ ] at the optimal alignment.46

Page 47: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

How good is the lower bound?

After discarding phase, what’s left?

47

Page 48: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

How good is the lower bound?

After discarding phase, what’s left?

Experiment:

To test this, we can consider what happens when

we take two arrays and swap the amplitudes of

the Fourier coefficients:1

0

1

0

] [] [ ] [] [n

k

k

i

k

n

k

k

i

k vesgverf kk

1

0

] []) [], [(ASwapn

k

k

i

k vergf k

48

Page 49: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Amplitude Phase

49

Page 50: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Does this imply that most of the information is

stored in the phase?

50

Page 51: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Does this imply that most of the information is

stored in the phase?

Not necessarily. For human perception, dominant

information occurs at image boundaries: Positions in the image where there is an abrupt

change of value

51

Page 52: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Does this imply that most of the information is

stored in the phase?

Not necessarily. For human perception, dominant

information occurs at image boundaries: Positions in the image where there is an abrupt

change of value

These discontinuities arise when the phases are

lined up so the occurrence of these events is

strongly phase dependent.

52

Page 53: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Invariance

Does this imply that most of the information is

stored in the phase?

Not necessarily. For human perception, dominant

information occurs at image boundaries: Positions in the image where there is an abrupt

change of value

These discontinuities arise when the phases are

lined up so the occurrence of these events is

strongly phase dependent.

If the grid encodes other type of information (non-

visual) amplitude can be more important.53

Page 54: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Outline

Alignment

Shape Matching

Invariance

Pattern Matching

54

Page 55: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Notation

If f[ ] and g[ ] are two n-dimensional arrays, then

we can define f[ ]·g[ ] to be the entry-wise product

of the two arrays, with:

][][][] [] [ jgjfjgf

55

Page 56: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Note 1

If f[ ] is a real-valued n-dimensional array, and g[ ]

and h[ ] are complex-valued n-dimensional

arrays, then:

] [] [], [] [], [] [ hfghgf

56

Page 57: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Note 1

If f[ ] is a real-valued n-dimensional array, and g[ ]

and h[ ] are complex-valued n-dimensional

arrays, then:

] [] [], [

][] [] [][

][][][

][][][

][][] [] [] [], [] [

1

0

1

0

1

0

1

0

hfg

khfkg

khkfkg

khkgkf

khkgfhgf

n

k

n

k

n

k

n

k

57

Page 58: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Note 1

If f[ ] is a real-valued n-dimensional array, and g[ ]

and h[ ] are complex-valued n-dimensional

arrays, then:

] [] [], [

][] [] [][

][][][

][][][

][][] [] [] [], [] [

1

0

1

0

1

0

1

0

hfg

khfkg

khkfkg

khkgkf

khkgfhgf

n

k

n

k

n

k

n

k

58

Page 59: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Note 1

If f[ ] is a real-valued n-dimensional array, and g[ ]

and h[ ] are complex-valued n-dimensional

arrays, then:

] [] [], [

][] [] [][

][][][

][][][

][][] [] [] [], [] [

1

0

1

0

1

0

1

0

hfg

khfkg

khkfkg

khkgkf

khkgfhgf

n

k

n

k

n

k

n

k

59

Page 60: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Note 1

If f[ ] is a real-valued n-dimensional array, and g[ ]

and h[ ] are complex-valued n-dimensional

arrays, then:

] [] [], [

][] [] [][

][][][

][][][

][][] [] [] [], [] [

1

0

1

0

1

0

1

0

hfg

khfkg

khkfkg

khkgkf

khkgfhgf

n

k

n

k

n

k

n

k

60

Page 61: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Note 1

If f[ ] is a real-valued n-dimensional array, and g[ ]

and h[ ] are complex-valued n-dimensional

arrays, then:

] [] [], [

][] [] [][

][][][

][][][

][][] [] [] [], [] [

1

0

1

0

1

0

1

0

hfg

khfkg

khkfkg

khkgkf

khkgfhgf

n

k

n

k

n

k

n

k

61

Page 62: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Note 2

If is the unitary representation that shifts an

array by indices:

Then

][]])[ [( kfkf

]) [(]) [(]) [] [( gfgf

62

Page 63: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

Given an instance of a pattern, find all

occurrences of the pattern within a target image:

Pattern f[ ][ ] Target Image g[ ][ ]

63

Page 64: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

Given an instance of a pattern, find all

occurrences of the pattern within a target image:

Pattern f[ ][ ] Target Image g[ ][ ]

64

Page 65: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

We could compute the cross correlation of the

pattern with the image and look for local maxima:

* =

65

Page 66: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

We could compute the cross correlation of the

pattern with the image and look for local maxima:

* =

66

Page 67: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

The cross-correlation has large values because

the dot product of the image with the translated

pattern instance is large.

What causes the dot-product of f[ ] with g[ ] to be

large?

67

Page 68: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

What causes the dot-product of f[ ] with g[ ] to be

large? If the values of f[ ] are similar to the values of g[ ]

68

Page 69: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

What causes the dot-product of f[ ] with g[ ] to be

large? If the values of f[ ] are similar to the values of g[ ]

If the values of g[ ] are large

* =

69

Page 70: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

We don’t want to measure:

How correlated is the pattern instance with a

region in the image?

What we want to measure is:

How similar is the pattern instance with a

region in the image?

70

Page 71: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

For every point in the image, we want to know

how similar the region about the point is to the

translated pattern.

-

Restricted Target

p

Translated Pattern

71

Page 72: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

For every point in the image, we want to know

how similar the region about the point is to the

translated pattern.

-

Restricted Target

p

Translated Pattern

72

Page 73: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

For every point in the image, we want to know

how similar the region about the point is to the

translated pattern.

-

Restricted Target

p

Translated Pattern

73

Page 74: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

For every point in the image, we want to know

how similar the region about the point is to the

translated pattern.

-

Restricted Target

p

Translated Pattern

74

Page 75: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

75

Page 76: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

If we represent the pattern by f[ ][ ], then the

translation of the pattern to the point p can be

written as:]) ][ [( fp

76

Page 77: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

If we represent the pattern by f[ ][ ], then the

translation of the pattern to the point p can be

written as:

How do we express the restriction of g[ ][ ] to the

region about p?

]) ][ [( fp

77

Page 78: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

If we represent the pattern by f[ ][ ], then the

translation of the pattern to the point p can be

written as:

How do we express the restriction of g[ ][ ] to the

region about p?

What we want to do is to zero out all of g[ ][ ]

except for the region about p.

]) ][ [( fp

78

Page 79: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

Let [ ][ ] be the characteristic grid of the pattern:

otherwise0

pattern theinside is ),( if1]][[

kjkj

f[ ][ ] [ ][ ]

79

Page 80: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

The restriction of g[ ][ ] to the region about p can

be expressed as:

p(f[ ][ ]) shifts the characteristic grid to be centered

about p.

Multiplying by p(f[ ][ ]) zeros out everything except

for the region about p.

] ][ []) ][ [( gp

80

Page 81: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

The restriction of g[ ][ ] to the region about p can

be expressed as:

] ][ []) ][ [( gp

[ ][ ]

g[ ][ ]

81

Page 82: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

The restriction of g[ ][ ] to the region about p can

be expressed as:

] ][ []) ][ [( gp

[ ][ ]

p

p( [ ][ ])

g[ ][ ]

82

Page 83: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

The restriction of g[ ][ ] to the region about p can

be expressed as:

] ][ []) ][ [( gp

[ ][ ]

p

p( [ ][ ]) p( [ ][ ])·g[ ][ ]

g[ ][ ]

83

Page 84: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

For every p, we would like to compute:

2

] ][ []) ][ [(]) ][ [( gf pp

p( [ ][ ])·g[ ][ ]p(f[ ][ ])84

Page 85: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

How do we express this formally?

For every p, we would like to compute:

Writing this out in terms of dot-products gives

three terms:

2

] ][ []) ][ [(]) ][ [( gf pp

]) ][ [(]), ][ [( ff pp

] ][ []) ][ [(]), ][ [(2 gf pp

] ][ []) ][ [(], ][ []) ][ [( gg pp

85

Page 86: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching (Term 1)

Using the the fact that the representation is

unitary gives:2

] ][ []) ][ [(]), ][ [( fff pp

]) ][ [(]), ][ [( ff pp

86

Page 87: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching (Term 2)

Using the the fact that [ ][ ] is real-valued, we

can move it to the other side of the dot-product:

] ][ []) ][ [(]), ][ [(2 gf pp

] ][ []), ][ [(]) ][ [(] ][ []) ][ [(]), ][ [( gfgf pppp

87

Page 88: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching (Term 2)

Using the the fact that [ ][ ] is real-valued, we

can move it to the other side of the dot-product:

Since the product of the representations is the

representation of the products we get:

] ][ []) ][ [(]), ][ [(2 gf pp

] ][ []), ][ [(]) ][ [(] ][ []) ][ [(]), ][ [( gfgf pppp

] ][ []), ][ [] ][ [(] ][ []), ][ [(]) ][ [( gfgf ppp

88

Page 89: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching (Term 2)

Using the the fact that [ ][ ] is real-valued, we

can move it to the other side of the dot-product:

Since the product of the representations is the

representation of the products we get:

And since [ ][ ] is equal to one whenever f[ ][ ] is

non-zero we get:

] ][ []) ][ [(]), ][ [(2 gf pp

] ][ []), ][ [(]) ][ [(] ][ []) ][ [(]), ][ [( gfgf pppp

] ][ []), ][ [] ][ [(] ][ []), ][ [(]) ][ [( gfgf ppp

] ][ []), ][ [(] ][ []), ][ [] ][ [( gfgf pp 89

Page 90: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching (Term 3)

Using the the fact that [ ][ ] and g[ ][ ] are both

real-valued, we can move them to the other sides

of the dot-product:

] ][ []) ][ [(], ][ []) ][ [( gg pp

] ][ [,]) ][ [(] ][ []) ][ [(], ][ []) ][ [( 22ggg ppp

90

Page 91: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching (Term 3)

Using the the fact that [ ][ ] and g[ ][ ] are both

real-valued, we can move them to the other side

of the dot-product:

Since the [ ][ ] is always equal to either 0 or 1,

we have [ ][ ]= 2[ ][ ] so that:

] ][ []) ][ [(], ][ []) ][ [( gg pp

] ][ [,]) ][ [(] ][ []) ][ [(], ][ []) ][ [( 22ggg ppp

] ][ []), ][ [(] ][ [,]) ][ [( 222gg pp

91

Page 92: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

Combining all of this together, we get:

] ][ []), ][ [(2

] ][ []), ][ [(] ][ [] ][ []) ][ [(]) ][ [( 222

gf

gfgf

p

ppp

92

Page 93: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

Combining all of this together, we get:

Or somewhat more cleanly:

] ][ []), ][ [(2

] ][ []), ][ [(] ][ [] ][ []) ][ [(]) ][ [( 222

gf

gfgf

p

ppp

] ][ [] ][ [2 ] ][ [] ][ [ ] ][ [ 22gfgf **

93

Page 94: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

Combining all of this together, we get:

Or somewhat more cleanly:

] ][ []), ][ [(2

] ][ []), ][ [(] ][ [] ][ []) ][ [(]) ][ [( 222

gf

gfgf

p

ppp

] ][ [] ][ [2 ] ][ [] ][ [ ] ][ [ 22gfgf **

The windowed norm The moving dot-product

94

Page 95: FFTs in Graphics and Vision - Department of …misha/Fall08/07.pdfBut this is just a rotation in the complex plane. [ ] Ö[ ] [ ] [ ] Ö [ ] [ ] k k g g k v f f k v gÖ[k] Öf[k ]

Pattern Matching

] ][ [] ][ [2] ][ [] ][ [] ][ [ 22gfgf **

f[ ][ ] g[ ][ ]

f[ ][ ]*g[ ][ ]

||f[ ][ ]||2+…

95


Recommended