Motion Analysis

29
Motion Analysis Motion Analysis Slides are from RPI Slides are from RPI Registration Class. Registration Class.

description

Motion Analysis. Slides are from RPI Registration Class. Registration. Images are described as discrete sets of point locations associated with a geometric measurement Locations may have additional properties such as intensities and orientations Registration problem involves two parts: - PowerPoint PPT Presentation

Transcript of Motion Analysis

Page 1: Motion Analysis

Motion AnalysisMotion Analysis

Slides are from RPI Registration Slides are from RPI Registration Class.Class.

Page 2: Motion Analysis

22

RegistrationRegistration

Images are described as discrete sets of Images are described as discrete sets of point locations associated with a point locations associated with a geometric measurementgeometric measurement Locations may have additional properties Locations may have additional properties

such as intensities and orientationssuch as intensities and orientations

Registration problem involves two parts:Registration problem involves two parts: Finding correspondences between featuresFinding correspondences between features Estimating the transformation parameters Estimating the transformation parameters

based on these correspondencesbased on these correspondences

Page 3: Motion Analysis

33

NotationNotation

Set of moving image featuresSet of moving image features

Set of fixed image featuresSet of fixed image features

Each feature must include a point location Each feature must include a point location in the coordinate system of its image. Set in the coordinate system of its image. Set of correspondences:of correspondences:

Page 4: Motion Analysis

44

Error objective function depends on unknown Error objective function depends on unknown transformation parameters transformation parameters andand unknown unknown feature correspondencesfeature correspondences Each may depend on the other!Each may depend on the other!

Transformation may include mapping of more Transformation may include mapping of more than just locations than just locations Distance function, Distance function, D, D, could be as simple as the could be as simple as the Euclidean distance between location vectors.Euclidean distance between location vectors.

Mathematical FormulationMathematical Formulation

Page 5: Motion Analysis

55

Correspondence ProblemCorrespondence ProblemDetermine correspondences Determine correspondences beforebefore estimating transformation parametersestimating transformation parameters Based on rich description of featuresBased on rich description of features Error proneError prone

Determine correspondences Determine correspondences at the same at the same timetime as estimation of parameters as estimation of parameters ““Chicken-and-egg” problemChicken-and-egg” problem

For the next few minutes we will assume a For the next few minutes we will assume a set of correspondences is given and set of correspondences is given and proceed to the estimation of parametersproceed to the estimation of parameters We will return to the correspondence problem We will return to the correspondence problem

laterlater

Page 6: Motion Analysis

66

Example: Estimating Example: Estimating ParametersParameters

2d point locations:2d point locations:

Similarity transformation:Similarity transformation:

Euclidean distance:Euclidean distance:

Page 7: Motion Analysis

77

Putting This TogetherPutting This Together

Page 8: Motion Analysis

88

What Do We Have?What Do We Have?Least-squares objective functionLeast-squares objective functionQuadratic function of each parameterQuadratic function of each parameterWe can We can Take the derivative with respect to each Take the derivative with respect to each

parameterparameter Set the resulting gradient to Set the resulting gradient to 0 0 (vector)(vector) Solve for the parameters through matrix Solve for the parameters through matrix

inversioninversion

We’ll do this in two forms: component We’ll do this in two forms: component and matrix/vectorand matrix/vector

Page 9: Motion Analysis

99

Component Derivative (a)Component Derivative (a)

Page 10: Motion Analysis

1010

Component Derivative (b)Component Derivative (b)

At this point, we’ve dropped the leading factor of 2. It will be eliminated when this is set to 0.

Page 11: Motion Analysis

1111

Component Derivatives tComponent Derivatives txx and t and tyy

Page 12: Motion Analysis

1212

GatheringGathering

Setting each of these equal to 0 we obtain Setting each of these equal to 0 we obtain a set of 4 linear equations in 4 unknowns. a set of 4 linear equations in 4 unknowns. Gathering into a matrix we have:Gathering into a matrix we have:

Page 13: Motion Analysis

1313

SolvingSolving

This is a simple equation of the formThis is a simple equation of the form

Provided the 4x4 matrix X is full-rank Provided the 4x4 matrix X is full-rank (evaluate SVD) we easily solve as(evaluate SVD) we easily solve as

Page 14: Motion Analysis

1414

Matrix VersionMatrix Version

We can do this in a less painful way by We can do this in a less painful way by rewriting the following intermediate rewriting the following intermediate expression in terms of vectors and expression in terms of vectors and matrices:matrices:

Page 15: Motion Analysis

1515

Matrix Version (continued)Matrix Version (continued)

Equal to zero. Take transpose on either side..

Page 16: Motion Analysis

1616

Matrix Version (continued)Matrix Version (continued)

Taking the derivative of this wrt the Taking the derivative of this wrt the transformation parameters (we didn’t transformation parameters (we didn’t cover vector derivatives, but this is fairly cover vector derivatives, but this is fairly straightforward):straightforward):

Setting this equal to Setting this equal to 00 and solving yields: and solving yields:

Page 17: Motion Analysis

1717

Comparing the Two VersionsComparing the Two Versions

Final equations are identical (if you Final equations are identical (if you expand the symbols)expand the symbols)

Matrix version is easier (once you have Matrix version is easier (once you have practice) and less error pronepractice) and less error prone

Sometimes efficiency requires hand-Sometimes efficiency requires hand-calculation and coding of individual terms calculation and coding of individual terms

Page 18: Motion Analysis

1818

Registration (rigid+scale)Registration (rigid+scale)Given two point sets Given two point sets

Our goal is to find the similarity Our goal is to find the similarity transformation that best aligns the transformation that best aligns the moments of the two point sets.moments of the two point sets.

In particular we want to findIn particular we want to find The rotation matrix The rotation matrix RR, t, t The scale factor The scale factor ss, and , and The translation vector The translation vector tt

Page 19: Motion Analysis

1919

The first moment is the center of massThe first moment is the center of mass

Page 20: Motion Analysis

2020

Second MomentsSecond Moments

Scatter matrixScatter matrix

Eigenvalue / eigenvector decomposition (Eigenvalue / eigenvector decomposition (SSpp))

where where ii are the eigenvalues and the columns are the eigenvalues and the columns of of VVpp hold the corresponding eigenvectors: hold the corresponding eigenvectors:

Page 21: Motion Analysis

2121

Rotation, Translation and ScaleRotation, Translation and Scale

Rotated, uniformly scaled points:Rotated, uniformly scaled points:

Center of the rotated data is the same as Center of the rotated data is the same as the rotated, scaled and translated center the rotated, scaled and translated center before rotation:before rotation:

Page 22: Motion Analysis

2222

Scatter MatrixScatter Matrix

Rotated, scaled scatter matrix:Rotated, scaled scatter matrix:

Page 23: Motion Analysis

2323

Eigenvectors and EigenvaluesEigenvectors and Eigenvalues

An eigenvector is a favorite direction for a An eigenvector is a favorite direction for a matrix.matrix.Any square matrix Any square matrix MM has at least one nonzero has at least one nonzero vector vector vv which is mapped in a particularly simple which is mapped in a particularly simple wayway

M v = M v = v v vv is eigenvector of is eigenvector of AA and and is is corresponding eigenvaluecorresponding eigenvalueIf If > 0, > 0, M vM v is parallel to is parallel to vv. If . If < 0, they are < 0, they are antiparallel. If zero, v is in the nullspace.antiparallel. If zero, v is in the nullspace.In all cases, In all cases, M vM v is just a multiple of is just a multiple of vv..

Page 24: Motion Analysis

2424

Eigenvalues and EigenvectorsEigenvalues and Eigenvectors

Given an eigenvector Given an eigenvector vvjj of of SSp p and its rotation and its rotation vvjj’ = ’ = RvRvjj::

So, So, Eigenvectors are rotated eigenvectorsEigenvectors are rotated eigenvectors Eigenvalues are multiplied by the square of Eigenvalues are multiplied by the square of

the scalethe scale

So, So, Eigenvectors are rotated eigenvectorsEigenvectors are rotated eigenvectors Eigenvalues are multiplied by the square of Eigenvalues are multiplied by the square of

the scalethe scale

Multiply both sides by sMultiply both sides by s22RR, and manipulate:, and manipulate:Multiply both sides by sMultiply both sides by s22RR, and manipulate:, and manipulate:

R is rotation matrix

j

Page 25: Motion Analysis

2525

The processThe process

compute similarity transformation that best aligns the first and compute similarity transformation that best aligns the first and second momentssecond momentsAssume the 2nd moments (eigenvalues) are distinctAssume the 2nd moments (eigenvalues) are distinctProcedure:Procedure:

Center the data in each coordinate systemCenter the data in each coordinate system Compute the scatter matrices and their eigenvalues and Compute the scatter matrices and their eigenvalues and

eigenvectorseigenvectors

Using this, computeUsing this, compute Scaling and rotationScaling and rotation Then, translationThen, translation

Page 26: Motion Analysis

2626

RotationRotation

The rotation matrix should align the The rotation matrix should align the eigenvectors in order:eigenvectors in order:

Manipulating:Manipulating:Manipulating:Manipulating:

As a result:As a result:As a result:As a result:

Page 27: Motion Analysis

2727

ScaleScale

Ratios of corresponding eigenvalues should determine the scale:Ratios of corresponding eigenvalues should determine the scale:

Taking the derivative with respect to sTaking the derivative with respect to s22, which we are treating at , which we are treating at Taking the derivative with respect to sTaking the derivative with respect to s22, which we are treating at , which we are treating at

Setting the result to 0 and solving yieldsSetting the result to 0 and solving yieldsSetting the result to 0 and solving yieldsSetting the result to 0 and solving yields

Page 28: Motion Analysis

2828

TranslationTranslation

Once we have the rotation and scale we Once we have the rotation and scale we can compute the translation based on the can compute the translation based on the centers of mass:centers of mass:

Page 29: Motion Analysis

2929

SummarySummary

Calculations are straightforward, non-iterative Calculations are straightforward, non-iterative and do not require correspondences:and do not require correspondences: Moments, firstMoments, first Rotation and scale separatelyRotation and scale separately TranslationTranslation

Assumes the viewpoints of the two data sets Assumes the viewpoints of the two data sets coincide approximatelycoincide approximately Can fail miserably for significantly differing viewpointsCan fail miserably for significantly differing viewpoints