CSE 554 Lecture 8 Alignment Fall 2016 CSE

  • Slides: 39
Download presentation
CSE 554 Lecture 8: Alignment Fall 2016 CSE 554 Alignment Slide 1

CSE 554 Lecture 8: Alignment Fall 2016 CSE 554 Alignment Slide 1

Review • Fairing (smoothing) – Relocating vertices to achieve a smoother appearance – Method:

Review • Fairing (smoothing) – Relocating vertices to achieve a smoother appearance – Method: centroid averaging • Simplification – Reducing vertex count – Method: edge collapsing CSE 554 Alignment Slide 2

Registration • Fitting one model to match the shape of another CSE 554 Alignment

Registration • Fitting one model to match the shape of another CSE 554 Alignment Slide 3

Registration • Applications – Tracking and motion analysis – Automated annotation CSE 554 Alignment

Registration • Applications – Tracking and motion analysis – Automated annotation CSE 554 Alignment Slide 4

Registration • Challenges: global and local shape differences – Imaging causes global shifts and

Registration • Challenges: global and local shape differences – Imaging causes global shifts and tilts • Requires alignment – The shape of the organ or tissue differs in subjects and evolve over time • Requires deformation Brain outlines of two mice CSE 554 After alignment After deformation Slide 5

Alignment • Registration by translation or rotation – The structure stays “rigid” under these

Alignment • Registration by translation or rotation – The structure stays “rigid” under these two transformations • Called rigid-body or isometric (distance-preserving) transformations – Mathematically, they are represented as matrix/vector operations Before alignment CSE 554 After alignment Alignment Slide 6

Transformation Math • Translation – Vector addition: – 2 D: – 3 D: CSE

Transformation Math • Translation – Vector addition: – 2 D: – 3 D: CSE 554 Alignment Slide 7

Transformation Math • Rotation y – Matrix product: – 2 D: x y •

Transformation Math • Rotation y – Matrix product: – 2 D: x y • Rotate around the origin! • To rotate around another point q: q x CSE 554 Alignment Slide 8

Transformation Math • Rotation – Matrix product: z – 3 D: y Around X

Transformation Math • Rotation – Matrix product: z – 3 D: y Around X axis: x Around Y axis: Any arbitrary 3 D rotation can be composed from these three rotations Around Z axis: CSE 554 Alignment Slide 9

Transformation Math • Properties of an arbitrary rotational matrix – Orthonormal (orthogonal and normal):

Transformation Math • Properties of an arbitrary rotational matrix – Orthonormal (orthogonal and normal): • Examples: – Easy to invert: CSE 554 Alignment Slide 10

Transformation Math • Properties of an arbitrary rotational matrix – Any orthonormal 3 x

Transformation Math • Properties of an arbitrary rotational matrix – Any orthonormal 3 x 3 matrix represents a rotation around some axis (not limited to X, Y, Z) • The angle of rotation can be calculated from the trace of the matrix – Trace: sum of diagonal entries – 2 D: The trace equals 2 Cos(a), where a is the rotation angle – 3 D: The trace equals 1 + 2 Cos(a) Examples: • The larger the trace, the smaller the rotation angle CSE 554 Alignment Slide 11

Alignment • Input: two models represented as point sets – Source and target •

Alignment • Input: two models represented as point sets – Source and target • Output: locations of the translated and rotated source points Source Target CSE 554 Alignment Slide 12

Alignment • Method 1: Principal component analysis (PCA) – Aligning principal directions • Method

Alignment • Method 1: Principal component analysis (PCA) – Aligning principal directions • Method 2: Singular value decomposition (SVD) – Optimal alignment given prior knowledge of correspondence • Method 3: Iterative closest point (ICP) – An iterative SVD algorithm that computes correspondences as it goes CSE 554 Alignment Slide 13

Method 1: PCA • Compute a shape-aware coordinate system for each model – Origin:

Method 1: PCA • Compute a shape-aware coordinate system for each model – Origin: Centroid of all points – Axes: Directions in which the model varies most or least • Transform the source to align its origin/axes with the target CSE 554 Alignment Slide 14

Basic Math • Eigenvectors and eigenvalues – Let M be a square m-by-m matrix,

Basic Math • Eigenvectors and eigenvalues – Let M be a square m-by-m matrix, v is an eigenvector and λ is an eigenvalue if: – Any scalar multiples of an eigenvector is also an eigenvector (with the same eigenvalue). • So an eigenvector should be treated as a “line”, rather than a vector – There at most m non-zero eigenvectors • If M is symmetric, its eigenvectors are pairwise orthogonal CSE 554 Alignment Slide 15

Method 1: PCA • Computing axes: Principal Component Analysis (PCA) – Consider a set

Method 1: PCA • Computing axes: Principal Component Analysis (PCA) – Consider a set of points p 1, …, pn with centroid location c • Construct matrix P whose i-th column is vector pi – c – 2 D (2 by n): – 3 D (3 by n): • Build the covariance matrix: – 2 D: a 2 by 2 matrix – 3 D: a 3 by 3 matrix – Symmetric! CSE 554 Alignment Slide 16

Method 1: PCA • Computing axes: Principal Component Analysis (PCA) – Eigenvectors of the

Method 1: PCA • Computing axes: Principal Component Analysis (PCA) – Eigenvectors of the covariance matrix represent principal directions of shape variation (2 in 2 D; 3 in 3 D) – Eigenvalues indicate amount of variation along each eigenvector • Eigenvector with largest (smallest) eigenvalue is the direction where the model shape varies the most (least) Eigenvector with the smaller eigenvalue Eigenvector with the larger eigenvalue CSE 554 Alignment Slide 17

Method 1: PCA • PCA-based alignment – Let c. S, c. T be centroids

Method 1: PCA • PCA-based alignment – Let c. S, c. T be centroids of source and target. – First, translate source to align c. S with c. T: – Next, find rotation R that aligns two sets of PCA axes, and rotate source around c. T: – Combined: CSE 554 Alignment Slide 18

Method 1: PCA • Oriented axes Y – 2 D: Y is ccw from

Method 1: PCA • Oriented axes Y – 2 D: Y is ccw from X X – 3 D: X, Y, Z follow right-handed rule Z Y X CSE 554 Alignment Slide 19

Method 1: PCA • Finding rotation between two sets of oriented axes Y 1

Method 1: PCA • Finding rotation between two sets of oriented axes Y 1 Y 2 X 1 X 2 – Let A, B be two matrices whose columns are the axes • The axes are orthogonal and normalized (i. e. , both A and B are orthonormal) – We wish to compute a rotation matrix R X 1 Y 1 X 2 Y 2 such that: – Notice that A and B are orthonormal, so we have: CSE 554 Alignment Slide 20

Method 1: PCA • How to get oriented axes from eigenvectors? – In 2

Method 1: PCA • How to get oriented axes from eigenvectors? – In 2 D, two eigenvectors can define 2 sets of oriented axes (whose X, Y correspond to 1 st and 2 nd eigenvectors) Y X X Y 1 st eigenvector CSE 554 Alignment 2 nd eigenvector Slide 21

Method 1: PCA • How to get oriented axes from eigenvectors? – In 3

Method 1: PCA • How to get oriented axes from eigenvectors? – In 3 D, three eigenvectors can define 4 sets of oriented axes (whose X, Y, Z correspond to 1 st, 2 nd, 3 rd eigenvectors) Z Y X Y Y X Z 1 st eigenvector CSE 554 2 nd eigenvector Alignment Z X Y 3 rd eigenvector Slide 22

Method 1: PCA • Finding rotation between two sets of eigenvectors – Fix the

Method 1: PCA • Finding rotation between two sets of eigenvectors – Fix the orientation of the target axes. – For each possible orientation of the source axes, compute R – Pick the R with smallest rotation angle (by checking the trace of R) • Assuming the source is “close” to the target! Smaller rotation CSE 554 Larger rotation Alignment Slide 23

Method 1: PCA • Limitations – Axes can be unreliable for circular objects •

Method 1: PCA • Limitations – Axes can be unreliable for circular objects • Eigenvalues become similar, and eigenvectors become unstable PCA result Rotation by a small angle CSE 554 Alignment Slide 24

Method 1: PCA • Limitations – Centroid and axes are affected by noise Noise

Method 1: PCA • Limitations – Centroid and axes are affected by noise Noise Axes are affected CSE 554 Alignment PCA result Slide 25

Method 2: SVD • Optimal alignment between corresponding points – Assuming that for each

Method 2: SVD • Optimal alignment between corresponding points – Assuming that for each source point, we know where the corresponding target point is. CSE 554 Alignment Slide 26

Method 2: SVD • Formulating the problem – Source points p 1, …, pn

Method 2: SVD • Formulating the problem – Source points p 1, …, pn with centroid location c. S – Target points q 1, …, qn with centroid location c. T • qi is the corresponding point of pi – After centroid alignment and rotation by some R, a transformed source point is located at: – We wish to find the R that minimizes sum of pair-wise distances: CSE 554 Alignment Slide 27

Method 2: SVD • An equivalent formulation – Let P be a matrix whose

Method 2: SVD • An equivalent formulation – Let P be a matrix whose i-th column is vector pi – c. S – Let Q be a matrix whose i-th column is vector qi – c. T – Consider the cross-covariance matrix: – Find the orthonormal matrix R that maximizes the trace: CSE 554 Alignment Slide 28

Method 2: SVD • Solving the minimization problem – Singular value decomposition (SVD) of

Method 2: SVD • Solving the minimization problem – Singular value decomposition (SVD) of an m by m matrix M: • U, V are m by m orthonormal matrices (i. e. , rotations) • W is a diagonal m by m matrix with non-negative entries – Theorem: the orthonormal matrix (rotation) is the one that maximizes the trace – SVD is available in Mathematica and many Java/C++ libraries CSE 554 Alignment Slide 29

Method 2: SVD • SVD-based alignment: summary – Forming the cross-covariance matrix – Computing

Method 2: SVD • SVD-based alignment: summary – Forming the cross-covariance matrix – Computing SVD Translate – The optimal rotation matrix is – Translate and rotate the source: CSE 554 Alignment Rotate Slide 30

Method 2: SVD • Advantage over PCA: more stable – As long as the

Method 2: SVD • Advantage over PCA: more stable – As long as the correspondences are correct CSE 554 Alignment Slide 31

Method 2: SVD • Advantage over PCA: more stable – As long as the

Method 2: SVD • Advantage over PCA: more stable – As long as the correspondences are correct CSE 554 Alignment Slide 32

Method 2: SVD • Limitation: requires accurate correspondences – Which are usually not available

Method 2: SVD • Limitation: requires accurate correspondences – Which are usually not available CSE 554 Alignment Slide 33

Method 3: ICP • Iterative closest point (ICP) – Use PCA alignment to obtain

Method 3: ICP • Iterative closest point (ICP) – Use PCA alignment to obtain an initial alignment – Alternate between estimating correspondences (e. g. , closest point) and aligning the corresponding points by SVD • Repeat until a termination criteria is met. CSE 554 Alignment Slide 34

ICP Algorithm • Termination criteria – A user-given maximum iteration is reached – The

ICP Algorithm • Termination criteria – A user-given maximum iteration is reached – The improvement of fitting is small • Root Mean Squared Distance (RMSD): – Captures average deviation in all corresponding pairs • Stops the iteration if the difference in RMSD before and after each iteration falls beneath a user-given threshold CSE 554 Alignment Slide 35

ICP Algorithm After PCA After 1 iter CSE 554 After 10 iter Alignment Slide

ICP Algorithm After PCA After 1 iter CSE 554 After 10 iter Alignment Slide 36

ICP Algorithm After PCA After 1 iter CSE 554 Alignment After 10 iter Slide

ICP Algorithm After PCA After 1 iter CSE 554 Alignment After 10 iter Slide 37

More Examples After PCA After ICP CSE 554 Alignment Slide 38

More Examples After PCA After ICP CSE 554 Alignment Slide 38

More Examples After PCA CSE 554 Alignment After ICP Slide 39

More Examples After PCA CSE 554 Alignment After ICP Slide 39