22
1

1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

Embed Size (px)

Citation preview

Page 1: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

1

Page 2: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

2

Motivation (Horn87)

• Registration of 3D Shapes

Assume correspondence

has been determined…

n

iii

bRqbRp

1

2

,min

n

iii

bRqbRp

1

2

,min

Any other better solutions for this least-square problem?

Page 3: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

3

Exercise

• Configuration A– p1 = (3,0,0)

– p2 = (0,3,0)

– p3 = (0,0,3)

• Configuration B– q1 = (3,3,-3)

– q2 = (3,0,0)

– q3 = (6,0,-3)

Find the rotation and translation that takes configuration A to configuration B

Page 4: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

Solution

4

010

001

100

030

003

300

333

000

333

303

003

633

300

030

003

3

0

3

1

1

1

2

1

4

303

003

633

300

030

003

R

R

d

dddR

This is a badly chosen example, where the three points are linearly independent.

If this is not so (such as three coplanar points), this simple approach cannot be used.

Page 5: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

5

Recap in CG Course (link)

• New algebra defined (addition, multiplication)• Length; unit quaternion as rotation• Perform rotations• Converting to/from rotation matrices• slerp

33221100cos

sin

sin

sin

)1(sin)(

rqrqrqrq

rt

qt

ts

q

r

)(22)(

...

020

*

xqqxqqxqqq

qxqx

****

*

)()( qpxqpqpxpqqxqx

pxpx

nqn ˆsincos),ˆ(Rot 22

Page 6: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

6

History• Quaternions were introduced by Irish mathematician Sir

William Rowan Hamilton in 1843. Hamilton was looking for ways of extending complex numbers to higher spatial dimensions. He could not do so for 3 dimensions, but 4 dimensions produce quaternions.

• According to the story Hamilton told, on October 16, he was out walking along the Royal Canal in Dublin with his wife when the solution in the form of the equation

suddenly occurred to him; Hamilton then promptly carved this equation into the side of the nearby Brougham Bridge

Page 7: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

7

Definitions1

Addition

Multiplication

Page 8: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

8

Definitions2

qppq

Complex conjugate

Norm (of quaternion)

Page 9: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

9

Alternative Formulation

A quaternion can be conveniently thought of as either:

• A vector with four components;

• A scalar plus a vector with three components; or

• A complex number with three different “imaginary” parts

Page 10: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

10

Product in Matrix Form (Horn)

Expand first quaternion Expand second quaternionNote the matrices are different!

“R is orthogonal”!

RRrIrRR

rrrr

rrrr

rrrr

rrrr

R

rrrr

rrrr

rrrr

rrrr

R

TT

xyz

xzy

yzx

zyx

T

xyz

xzy

yzx

zyx

0

0

0

0

0

0

0

0

,

TRR *

Treat quaternion as a vector in R4Notation: we use to denote quaternion

This is the “matrix way” to compute

quaternion product

:R R:

Page 11: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

11

Details

0

0

0

0

0

0

0

0

*

0*

0

0

0

0

0

0

0

0

0

)()()(

)()()(

)()()(

)()()(

,,,

,,,

rrrr

rrrr

rrrr

rrrr

rrrr

rrrr

rrrr

rrrr

R

rrrrr

rrrr

rrrr

rrrr

rrrr

R

rrrr

rrrr

rrrr

rrrr

R

rrrrr

xyz

xzy

yzx

zyx

xyz

xzy

yzx

zyx

zyx

xyz

xzy

yzx

zyx

T

xyz

xzy

yzx

zyx

zyx

TRR *

Page 12: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

12

Dot Product of Quaternions

qppq

This is new!

Def:

4D vector viewpoint

*** rqprqprQp

rQprpQrpQrpqTT

TTT

p.9

Page 13: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

13

1. Length preserved after operation

Unit Quaternion as Rotation1

Observations: (why Lq(v) is a rotation…)

2. If v is along q, it is left unchanged.

[Horn] dot product and triple product preserved …

Page 14: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

14

Unit Quaternion as Rotation2

Lq is linear over R3

Lq(v) = Lq(n+a) = Lq(n) + Lq(a) = Lq(n) + a

v=Lp(u) , w=Lq(v)w= Lq(v)=qvq*=q(pup*)q*=(qp)u(qp)*=Lqp(u)

v

a

nqu

Page 15: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

15

Application: Data Registration

Iterative (least square) solutionor Closed form solution

Find the most appropriate rotation R and translation b

Page 16: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

16

0

Similarly,

01

;

1 ,

1 centroid

1

11111

11

n

ii

n

ii

n

ii

n

ii

n

ii

n

ii

iiii

n

ii

n

ii

q

pn

nppnpppp

qqqppp

qn

qpn

p

Convert global coordinates to local coordinate (from centroid)

Page 17: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

17

Objective function (minimization)

First, determine the rotation R, then the optimal translation by:

Optimal rotation R: 2

22

2

2

2

wwvv

wwwvvv

wvwvwv

Page 18: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

18

Convert to quaternion:

is symmetric, with real eigenvalues 1, 2, 3, 4 and corresponding orthogonal unit eigenvectors v1, v2, v3, v4 in R4

This correspond to R and R

in p.8

Page 19: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

19

11rotation is 2

423

22

21

24

23

22

214433221144332211

qq

vvvvvvvvqq

1: largest eigenvalue

Simplified to: MqqT

qmax

1

4321

1241

231

221

211

244

233

222

211

0,1 :at occurs maximum

vq

MqqT

Therefore,

Represent q in eigen basis

The optimum rotation is the eigenvector with largest eigenvalue. (It is already normalize).

Page 20: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

20

Details

332211322313312112

322333221112213113

133112213322113223

211231132332332211

123

132

231

321

123

132

231

321

0

0

0

0

0

0

0

0

qpqpqpqpqpqpqpqpqp

qpqpqpqpqpqpqpqpqp

qpqpqpqpqpqpqpqpqp

qpqpqpqpqpqpqpqpqp

QP

qqq

qqq

qqq

qqq

Q

ppp

ppp

ppp

ppp

P

iT

i

iT

i

symmetricQP iT

i is

Page 21: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

21

The Real Exercise

• Configuration A– p1 = (3,0,0)

– p2 = (0,3,0)

– p3 = (3,3,0)

• Configuration B– q1 = (1,4,1)

– q2 = (1,1,4)

– q3 = (1,4,4)

Find the rotation and translation that takes configuration A to configuration B

Page 22: 1. 2 Motivation (Horn87) Registration of 3D Shapes Assume correspondence has been determined… Any other better solutions for this least-square problem?

Quaternion in SVL

22