comparing two motions jehee lee seoul national university

66
Comparing Two Motions Jehee Lee Seoul National University

Upload: edgar-lewis

Post on 21-Jan-2016

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Comparing Two Motions Jehee Lee Seoul National University

Comparing Two Motions

Jehee Lee

Seoul National University

Page 2: Comparing Two Motions Jehee Lee Seoul National University

Distance Metric for Motion Sequences

• How can we measure the difference between two stylistic walking motions?

• How do we represent motion sequences?– Rotation/orientation makes problems

• We do we compare two time-series data?– What if the duration of one series differ from the other?

Page 3: Comparing Two Motions Jehee Lee Seoul National University

Affine Geometry

Jehee Lee

Seoul National University

Page 4: Comparing Two Motions Jehee Lee Seoul National University

Geometric Programming

• A way of handling geometric entities such as vectors, points, and transforms.

• Traditionally, computer graphics packages are implemented using homogeneous coordinates.

• We will review affine geometry and coordinate-invariant geometric programming.

Page 5: Comparing Two Motions Jehee Lee Seoul National University

Example of coordinate-dependence

• What is the “sum” of these two positions ?

Point p

Point q

Page 6: Comparing Two Motions Jehee Lee Seoul National University

If you assume coordinates, …

• The sum is (x1+x2, y1+y2)– Is it correct ?– Is it geometrically meaningful ?

p = (x1, y1)

q = (x2, y2)

Page 7: Comparing Two Motions Jehee Lee Seoul National University

If you assume coordinates, …

p = (x1, y1)

q = (x2, y2)

Origin

(x1+x2, y1+y2)

• Vector sum– (x1, y1) and (x2, y2) are considered as vectors from the origin to p

and q, respectively.

Page 8: Comparing Two Motions Jehee Lee Seoul National University

If you select a different origin, …

p = (x1, y1)

q = (x2, y2)

Origin

(x1+x2, y1+y2)

• If you choose a different coordinate frame, you will get a different result

Page 9: Comparing Two Motions Jehee Lee Seoul National University

Vector and Affine Spaces

• Vector space– Includes vectors and related operations– No points

• Affine space– Superset of vector space– Includes vectors, points, and related operations

Page 10: Comparing Two Motions Jehee Lee Seoul National University

Points and Vectors

• A point is a position specified with coordinate values.• A vector is specified as the difference between two

points.• If an origin is specified, then a point can be represented

by a vector from the origin.• But, a point is still not a vector in a coordinate-free point

of view.

Point p

Point qvector (p-q)

Page 11: Comparing Two Motions Jehee Lee Seoul National University

Vector spaces

• A vector space consists of– Set of vectors, together with– Two operations: addition of vectors and multiplication

of vectors by scalar numbers

• A linear combination of vectors is also a vector

VV wvuwvu ,,

Page 12: Comparing Two Motions Jehee Lee Seoul National University

Affine Spaces

• An affine space consists of– Set of points, an associated vector space, and– Two operations: the difference between two points

and the addition of a vector to a point

Page 13: Comparing Two Motions Jehee Lee Seoul National University

Coordinate-Invariant Geometric Operations

• Addition• Subtraction• Scalar multiplication• Linear combination• Affine combination

Page 14: Comparing Two Motions Jehee Lee Seoul National University

Addition

u

vu + v

p

p + w

u + v is a vector p + w is a point

w

u, v, w : vectorsp, q : points

Page 15: Comparing Two Motions Jehee Lee Seoul National University

Subtraction

v

u - vu

q

p

u - v is a vector p - q is a vector

p - q

p

p - w

p - w is a point

-w

u, v, w : vectorsp, q : points

Page 16: Comparing Two Motions Jehee Lee Seoul National University

Scalar Multiplication

scalar • vector = vector

1 • point = point

0 • point = vector

c • point = (undefined) if (c≠0,1)

Page 17: Comparing Two Motions Jehee Lee Seoul National University

Linear Combination

vvvvv

NN

N

iii cccc 1100

0

• A linear space is spanned by a set of bases– Any vector in the space can be represented as a

linear combination of bases

Page 18: Comparing Two Motions Jehee Lee Seoul National University

Affine Combination

)()( 010

0

11000

ppp

pppp

N

iii

N

ii

NN

N

iii

cc

cccc

Page 19: Comparing Two Motions Jehee Lee Seoul National University

Example

• (p + q) / 2 : midpoint of line pq

• (p + q) / 3 : Can you find a geometric meaning ?

• (p + q + r) / 3 : center of gravity of ∆pqr

• (p/2 + q/2 – r) : a vector from r to the midpoint of q and p

Page 20: Comparing Two Motions Jehee Lee Seoul National University

Summary

Page 21: Comparing Two Motions Jehee Lee Seoul National University

Rotation and Orientation:Fundamentals

Jehee Lee

Seoul National University

Page 22: Comparing Two Motions Jehee Lee Seoul National University

What is Rotation ?

• Not intuitive– Formal definitions are also confusing

• Many different ways to describe– Rotation (direction cosine) matrix– Euler angles– Axis-angle– Rotation vector– Helical angles– Unit quaternions

Page 23: Comparing Two Motions Jehee Lee Seoul National University

Orientation vs. Rotation

• Rotation– Circular movement

• Orientation– The state of being oriented– Given a coordinate system, the orientation of an

object can be represented as a rotation from a reference pose

Page 24: Comparing Two Motions Jehee Lee Seoul National University

Analogy

(point : vector) is similar to (orientation : rotation)

Both represent a sort of (state : movement)

Reference coordinate system

Page 25: Comparing Two Motions Jehee Lee Seoul National University

Analogy

(point : vector) is similar to (orientation : rotation)

Both represent a sort of (state : movement)

Reference coordinate system

point : the 3d location of the bunnyvector : translational movement

Page 26: Comparing Two Motions Jehee Lee Seoul National University

Analogy

(point : vector) is similar to (orientation : rotation)

Both represent a sort of (state : movement)

Reference coordinate system

point : the 3d location of the bunnyvector : translational movement

orientation : the 3d orientation of the bunnyrotation : circular movement

Page 27: Comparing Two Motions Jehee Lee Seoul National University

2D Orientation

0

2

2

or

Polar Coordinates

Page 28: Comparing Two Motions Jehee Lee Seoul National University

2D Orientation

Although the motion is continuous, its representation could be discontinuous

0

2

2

or

)(t

Time

Page 29: Comparing Two Motions Jehee Lee Seoul National University

2D Orientation

Many-to-one correspondences between 2D orientations and their representations

0

2

2

or

)(t

Time

Page 30: Comparing Two Motions Jehee Lee Seoul National University

Extra Parameter

),( yx

X

Y122 yx

Page 31: Comparing Two Motions Jehee Lee Seoul National University

Extra Parameter

),( yx

X

Y122 yx

cossin

sincos

2x2 Rotation matrix is yet another method of using extra parameters

Page 32: Comparing Two Motions Jehee Lee Seoul National University

Complex Number

iyx

Real

Imaginary

Page 33: Comparing Two Motions Jehee Lee Seoul National University

Complex Exponentiation

iyx

Real

Imaginary

ie

iiyx

sincos

Page 34: Comparing Two Motions Jehee Lee Seoul National University

2D Rotation

• Complex numbers are good for representing 2D orientations, but inadequate for 2D rotations

• A complex number cannot distinguish different rotational movements that result in the same final orientation

– Turn 120 degree counter-clockwise– Turn -240 degree clockwise– Turn 480 degree counter-clockwise

Real

Imaginary

2

Page 35: Comparing Two Motions Jehee Lee Seoul National University

2D Rotation and Orientation

• 2D Rotation– The consequence of any 2D rotational movement can be

uniquely represented by a turning angle

• 2D Orientation– The non-singular parameterization of 2D orientations requires

extra parameters• Eg) Complex numbers, 2x2 rotation matrices

Page 36: Comparing Two Motions Jehee Lee Seoul National University

Operations in 2D

• (orientation) : complex number• (rotation) : scalar value• exp(rotation) : complex number

Page 37: Comparing Two Motions Jehee Lee Seoul National University

2D Rotation and Displacement

iyxc 1

Real

Imaginary

Page 38: Comparing Two Motions Jehee Lee Seoul National University

2D Rotation and Displacement

iyxc 1

Real

Imaginary

i

i

ecc

or

ecc

2

11

12

2c

Page 39: Comparing Two Motions Jehee Lee Seoul National University

2D Orientation Composition

Real

Imaginary

1c2c

)(21 undefinedcc

Page 40: Comparing Two Motions Jehee Lee Seoul National University

2D Rotation Composition

iii eee )(

Real

Imaginary

Page 41: Comparing Two Motions Jehee Lee Seoul National University

Analogy

Page 42: Comparing Two Motions Jehee Lee Seoul National University

X

Y

Z

X

Y

Z

3D Rotation

• Given two arbitrary orientations of a rigid object,

Page 43: Comparing Two Motions Jehee Lee Seoul National University

3D Rotation

• We can always find a fixed axis of rotation and an angle about the axis

Page 44: Comparing Two Motions Jehee Lee Seoul National University

Euler’s Rotation Theorem

In other words,• Arbitrary 3D rotation equals to one rotation

around an axis• Any 3D rotation leaves one vector unchanged

The general displacement of a rigid body withone point fixed is a rotation about some axis

Leonhard Euler (1707-1783)

Page 45: Comparing Two Motions Jehee Lee Seoul National University

Rotation Vector

• Rotation vector (3 parameters)

• Axis-Angle (2+1 parameters)

),,(ˆ zyx vv )ˆ,( v

anglescalar :

runit vecto : ˆ

v

Page 46: Comparing Two Motions Jehee Lee Seoul National University

3D Orientation

• Unhappy with three parameters – Euler angles

• Discontinuity (or many-to-one correspondences)• Gimble lock

– Rotation vector (a.k.a Axis/Angle)• Discontinuity (or many-to-one correspondences)

Page 47: Comparing Two Motions Jehee Lee Seoul National University

Using an Extra Parameter

• Euler parameters

2sinˆ

2cos

3

2

1

0

v

e

e

e

e

axisrotation :ˆ

anglerotation :

v

Page 48: Comparing Two Motions Jehee Lee Seoul National University

Quaternions

• William Rowan Hamilton (1805-1865)– Algebraic couples (complex number) 1833

iyx 12 iwhere

Page 49: Comparing Two Motions Jehee Lee Seoul National University

Quaternions

• William Rowan Hamilton (1805-1865)– Algebraic couples (complex number) 1833

– Quaternions 1843

iyx 12 iwhere

kzjyixw

jikikjkji

jkiijkkij

ijkkji

,,

,,

1222where

Page 50: Comparing Two Motions Jehee Lee Seoul National University

Unit Quaternions

• Unit quaternions represent 3D rotations

),(

),,,(

v

q

w

zyxw

kzjyixw

12222 zyxw

3S

Page 51: Comparing Two Motions Jehee Lee Seoul National University

Rotation about an Arbitrary Axis

• Rotation about axis by angle

1 qpqp ),,,0( zyxpwhere

),,( zyx

),,( zyx

Purely Imaginary Quaternion

2sinˆ,

2cos

vq

Page 52: Comparing Two Motions Jehee Lee Seoul National University

Unit Quaternion Algebra

• Identity

• Multiplication

• Inverse

– Opposite axis or negative angle

• Unit quaternion space is– closed under multiplication and inverse,

– but not closed under addition and subtraction

),(

),)(,(

2112212121

221121

vvvvvv

vvqq

wwww

ww

)/(),,,(

)/(),,,(2222

22221

zyxwzyxw

zyxwzyxw

q

)0,0,0,1(q

Page 53: Comparing Two Motions Jehee Lee Seoul National University

Unit Quaternion Algebra

• Antipodal equivalence– q and –q represent the same rotation

– ex) rotation by about opposite direction– 2-to-1 mapping between S and SO(3)– Twice as fast as in SO(3)

)()( pp qq RR

3

Page 54: Comparing Two Motions Jehee Lee Seoul National University

3D Orientations and Rotations

Orientations and rotations are different in coordinate-invariant geometric programming

Use unit quaternions for orientation representation– 3x3 orthogonal matrix is theoretically identical

Use 3-vectors for rotation representation

Page 55: Comparing Two Motions Jehee Lee Seoul National University

Tangent Vector(Infinitesimal Rotation)

3SqT

q

Page 56: Comparing Two Motions Jehee Lee Seoul National University

Tangent Vector(Infinitesimal Rotation)

3SqT

q

1q

Page 57: Comparing Two Motions Jehee Lee Seoul National University

Tangent Vector(Infinitesimal Rotation)

3SIT

),,,( 0001I

),,,( zyx0

qq 1

2

1

Angular Velocity

Page 58: Comparing Two Motions Jehee Lee Seoul National University

Exp and Log

log exp

I

)sinˆ,(cos)ˆexp()exp( vvv

Page 59: Comparing Two Motions Jehee Lee Seoul National University

Exp and Log

log exp

I

)sinˆ,(cos)ˆexp()exp( vvv

2sinˆ

2cos

3

2

1

0

v

e

e

e

e

Eulerparameters

Page 60: Comparing Two Motions Jehee Lee Seoul National University

Rotation Vector

1p

12 ppu

2p

2q

)( 121

12

ppp

upp

1q3S3R

21

11

12

logexp

)exp(

qqq

vqq

Page 61: Comparing Two Motions Jehee Lee Seoul National University

Rotation Vector

3S

21

1 qq

11

1 qqI 1p

12 ppu

2p

)( 121

12

ppp

upp

3R

21

11

12

logexp

)exp(

qqq

vqq

Page 62: Comparing Two Motions Jehee Lee Seoul National University

Rotation Vector

21

1 qq

11

1 qqI

21

11

12

logexp

)exp(

qqq

vqq

21

1log qqv

1p

12 ppu

2p

)( 121

12

ppp

upp

3R

Page 63: Comparing Two Motions Jehee Lee Seoul National University

Geodesic Distance

21

1 qq

11

1 qqI

21

121 log),( qqqq d

21

1log qqv

1p

12 ppu

2p

1221 ),( pppp d

3R

Page 64: Comparing Two Motions Jehee Lee Seoul National University

Coordinate-Invariant Operations

Page 65: Comparing Two Motions Jehee Lee Seoul National University

Dynamic Time Warping

• The vertex correspondence problem– Minimize the sum of distances between

corresponding vertices– The correspondence must be continuous

• No missing vertices• No cross edges (No turning back in time)

Signal A

Signal B

Page 66: Comparing Two Motions Jehee Lee Seoul National University

Dynamic Time Warping

• Find a chain from top-left to bottom-right– Allowed to move horizontally, vertically, or diagonally