public class ICPRegistration
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ICPRegistration.Prealign |
Modifier and Type | Field and Description |
---|---|
static double |
myAdjustTime |
static double |
myDistanceTime |
static double |
myPCATime |
static boolean |
myProfiling |
Constructor and Description |
---|
ICPRegistration() |
Modifier and Type | Method and Description |
---|---|
void |
addAxisFlips(java.util.LinkedList<RotationMatrix3d> flips,
RotationMatrix3d R,
Vector3d axis,
int n) |
void |
computeAdjustment(AffineTransform3d dX,
int ndists,
int n)
Computes an adjustment
dX to the current AffineTransform3d
X such that dX moves all the points in such a
way as to minimize their distance to the surface. |
RotationMatrix3d[] |
computeFlips(Vector3d sig) |
double |
computeInertia(Matrix3d J,
Vector3d c,
PolygonalMesh mesh) |
static void |
computeOBBFromPCA(OBB obb,
MeshBase mesh)
Use PCA to determine the OBB for a mesh.
|
static double |
computePCA(Matrix3d J,
Vector3d c,
MeshBase mesh)
Based on "Non-rigid Transformations for Musculoskeletal Model", by Petr
Kellnhofer.
|
boolean |
isDualDistancingEnabled() |
void |
registerICP(AffineTransform3d X,
PolygonalMesh mesh1,
PolygonalMesh mesh2,
ICPRegistration.Prealign align,
int[] npar) |
void |
registerICP(AffineTransform3d X,
PolygonalMesh mesh1,
PolygonalMesh mesh2,
int... npar) |
void |
registerInertia(AffineTransform3d X,
PolygonalMesh mesh1,
PolygonalMesh mesh2) |
void |
registerPCA(AffineTransform3d X,
PolygonalMesh mesh1,
PolygonalMesh mesh2) |
void |
setDualDistancingEnabled(boolean enable) |
public static boolean myProfiling
public static double myDistanceTime
public static double myAdjustTime
public static double myPCATime
public boolean isDualDistancingEnabled()
public void setDualDistancingEnabled(boolean enable)
public void computeAdjustment(AffineTransform3d dX, int ndists, int n)
dX
to the current AffineTransform3d
X
such that dX
moves all the points in such a
way as to minimize their distance to the surface. Specifically, we want
to move each point by a displacement dp_i
such that the
projection of this displacement onto the normal n_i
arising
from the nearest surface point equals the negative of the offset
o_i
from the surface:
n_i^T dp_i = -o_iNow,
dp_i
is determined by dX p_i
,
and dX
is itself described by n
independent
coordinates y
, where n
is either 3, 6, 7, or 12:
y0:y2
describing the translation parameters;y3:y5
describing the incremental yaw, pitch and roll angles;y6
describing the incremental scaling;y0:y2
describing the translation parameters and y3:y11
the coefficients of the 3 x 3 affine matrix.dX
takes the general form
[ y6 -y5 y4 y0 ] dX = [ y5 y6 -y3 y1 ] [ -y4 y3 y6 y2 ] [ 0 0 0 1 ]where
yi = 0
whenever i >= n
.
For each of the above cases, the relation
n_i^T dp_i = -o_i
can be expressed as
a_i^T y = -o_iwhere
a_i
is a n-vector formed from n_i
and p_i
.
Assembling these into a single matrix equation for all points, we end up with the linear least squares problem
A y = -owhere
A
is formed from individual rows a_i^T
and o
is formed from the aggregate of o_i
.
This least squares problem can be solved directly using the normal
equations approach:
A^T A y = -A^T oWe use this instead of QR decomposition for reasons of speed.
dX
- returns the computed adjustment transformndists
- number of points being adjustedn
- number of independent coordinates in dX. 3 corrresponds
to translation only, 6 to a rigid transform, 7 to a rigid
transform plus scaling, and 9 to a general affine transform.public static double computePCA(Matrix3d J, Vector3d c, MeshBase mesh)
public void registerPCA(AffineTransform3d X, PolygonalMesh mesh1, PolygonalMesh mesh2)
public void addAxisFlips(java.util.LinkedList<RotationMatrix3d> flips, RotationMatrix3d R, Vector3d axis, int n)
public RotationMatrix3d[] computeFlips(Vector3d sig)
public static void computeOBBFromPCA(OBB obb, MeshBase mesh)
public double computeInertia(Matrix3d J, Vector3d c, PolygonalMesh mesh)
public void registerInertia(AffineTransform3d X, PolygonalMesh mesh1, PolygonalMesh mesh2)
public void registerICP(AffineTransform3d X, PolygonalMesh mesh1, PolygonalMesh mesh2, int... npar)
public void registerICP(AffineTransform3d X, PolygonalMesh mesh1, PolygonalMesh mesh2, ICPRegistration.Prealign align, int[] npar)