Docsity

Computing 3D Motion and Shape from Optical Flow or Point Correspondences - Prof. Mubarak S, Study notes of Computer Science

Partial preview of the text

Download Computing 3D Motion and Shape from Optical Flow or Point Correspondences - Prof. Mubarak S and more Study notes Computer Science in PDF only on Docsity!

Copyright Mubarak Shah 2003

Lecture-

Structure from Motion

Copyright Mubarak Shah 2003

Problem

  • Given optical flow or point

correspondences, compute 3-D

motion (translation and rotation)

and shape (depth).

Copyright Mubarak Shah 2003

Tomasi and Kanade

Orthographic

Projection

Copyright Mubarak Shah 2003

Assumptions

  • The camera model is orthographic.
  • The positions of “p” points in “f” frames

(f>=3), which are not all coplanar, have

been tracked.

  • The entire sequence has been acquired

before starting (batch mode).

  • Camera calibration not needed, if we

accept 3D points up to a scale factor.

Copyright Mubarak Shah 2003

( )

( )

P f

T

fP f

P f

T

fP f

v j s t

u i s t

= −

= −

( , , )

p p P P

s = X Y Z 3D world

point

Orthographic

projection

k

f

= i

f

× j

f

Copyright Mubarak Shah 2003

Copyright Mubarak Shah 2003

fp fP f

u = u −a

~

( )

1

( )

1

q f

P

q

T

p f f

T

f

i s t

P

= i s −t − −

∑

=

⎥

⎦

⎤

⎢

⎣

⎡

= − ∑

=

P

q

P q

T

f

s

P

i s

1

1

P

T

f

= i s

Origin of world is at the

centroid of object points

Copyright Mubarak Shah 2003

P

T

fP f

P

T

fP f

v j s

u i s

=

=

~

~

⎥

⎥

⎥

⎦

⎤

⎢

⎢

⎢

⎣

⎡

= −

V

U

W

~

~

~

Copyright Mubarak Shah 2003

Translation

fp fP f

u = u −a

~

P

T

fp f

u = i s

~

fp fP f

u = u + a

~

fp f p f

u = i s + a ( )

p f

T

fp f

u =i s −t

f is projection of camera translation along x-axis

a

Copyright Mubarak Shah 2003

Translation

fp f p f

u =i s +a

T

p

W = RS + te

( 1 , 1 )

( , , , , , )

K

K K

=

=

T

p

e

t

T

f f

a a b b

fp f p f

v = j s +b

2FX 1XP

2FX3 3XP

Copyright Mubarak Shah 2003

Translation

Projected camera translation can

be computed:

∑

∑

=

=

− = =

− = =

P

p

f f p

T

f

P

p

f f p

T

f

v

P

j t b

u

P

i t a

1

1

1

1

Copyright Mubarak Shah 2003

Noisy Measurements

  • Without noise, the matrix must be at

most of rank 3. When noise corrupts the

images, however, will not be rank 3.

Rank theorem can be extended to the

case of noisy measurements.

W

~

W

~

Copyright Mubarak Shah 2003

Singular Value Decomposition (SVD)

Theorem: Any m by n matrix A, for which

,can be written as

1 2

A = O ΣO

mxn

nxn nxn mxn

is diagonal

are orthogonal

Σ

1 2

O,O

O O O O I

T T = = 1 1 2 2

m ≥ n

Copyright Mubarak Shah 2003

Singular Value Decomposition (SVD)

If A is square, then are all square. 1 2

O , Σ,O

O 1

− 1

= O 1

T

O 2

− 1

= O 2

T

Σ

− 1

= diag(

1

w j

)

1 2

A =OΣO

A

− 1

= O 2

diag(

w j

)O

1

1 2

A = O ΣO

mxn

nxn nxn mxn

Copyright Mubarak Shah 2003

Singular Value Decomposition (SVD)

The condition number of a matrix is the ratio

of the largest of the to the smallest of.

A matrix is singular if the condition number is

infinite, it is ill-conditioned if the condition

number is too large.

j

w

j

w

Copyright Mubarak Shah 2003

Singular Value Decomposition (SVD)

Ax = b

  • If A is singular, some subspace of “x”

maps to zero; the dimension of the null

space is called “nullity”.

  • Subspace of “b” which can be reached by “A”

is called range of “A”, the dimension of range is

called “rank” of A.

Copyright Mubarak Shah 2003

Singular Value Decomposition (SVD)

  • SVD constructs orthonormal basses of

null space and range.

  • Columns of with non-zero

spans range.

  • Columns of with zero spans

null space.

1

O

j

w

2

O

j

w

A =OΣO

Copyright Mubarak Shah 2003

Solution of Linear System

  • How to solve Ax=b, when A is singular?
  • If “b” is in the range of “A” then system has

many solutions.

  • Replace by zero if

= 0 j

w

j

w

1

O b

w

x O diag

T

j

2 1

)]

1

= [ (

Copyright Mubarak Shah 2003

Solution of Linear System

If b is not in the range of A, above eq still gives

the solution, which is the best possible solution,

it minimizes:

r ≡| Ax−b |

Copyright Mubarak Shah 2003

Approximate Rank

W = OΣO

[ ] 1 1 1

O = O′ O′′

⎥

⎦

⎤

⎢

⎣

⎡

Σ ′′

Σ′

Σ =

0

0

⎥

⎦

⎤

⎢

⎣

⎡

′′

′

=

2

2

2

O

O

O

1 2 1 2 1 2

O ΣO =O′Σ′O′+O′′Σ ′′O′′

3 P-

2F

3

P-

3

P-

P

(^3) P-

Copyright Mubarak Shah 2003

Approximate Rank

[ ]

[ ]

W R S

S O

R O

ˆ ˆ ˆ

ˆ

ˆ

2

2

1

2

1

1

=

= Σ′ ′

= ′ Σ′

ˆ

W =

ˆ

RQ ( )

Q

− 1 ˆ

S ( )

This decomposition is not unique

Q is any 3X3 invertable matrix

Approximate Rotation matrix

Approximate Shape matrix

Copyright Mubarak Shah 2003

Approximate Rank

S Q S

R RQ

ˆ

i

f

T

QQ

T

ˆ

i

f

= 1

ˆ

j

f

T

QQ

T

ˆ

j

f

= 1

ˆ

i

f

T

QQ

T

ˆ

j

f

= 0

R and S are linear transformation of

approximate Rotation and shape matrices

How to determine Q?

Rows of rotation matrix are unit vectors

and orthogonal

Copyright Mubarak Shah 2003

How to determine Q: Newton’s

Method

3

3 1

3 2

3 1 1

2 1 1

1 1 1

−

−

T

f

T T

f f

T

f

T T

f f

T

f

T T

f f

T T T

T T T

T T T

f i QQ j

f j QQ j

f i QQ i

f i QQ j

f j QQ j

f i QQ i

q

q

q

q

q

q

M

M ∆ q = ε

∆ q = ∆q

1

,K,∆q

9

[ ]

M

ij

∂f

i

∂q

j

ε is error

Copyright Mubarak Shah 2003

Algorithm

  • Compute SVD of
    • define
      • Compute

1 2

~

W =OΣO

[ ]

2

1

1

R = O′Σ′

[ ]

2

2

1

ˆ

S = Σ′ O′

Q

  • Compute R RQ

ˆ

= S^ Q S

ˆ

− 1

=

Copyright Mubarak Shah 2003

Selected Features

Copyright Mubarak Shah 2003

Reconstructed Shape

Copyright Mubarak Shah 2003

Comparison

Copyright Mubarak Shah 2003

House Sequence