Curve Alignment¶
These functions are for processing of N-D curves using the square-root velocity framework (srvf)
SRVF Functions¶
-
curve_to_q(beta)¶ Convert curve to square-root velocity function (srvf)
betais an array of shape (n,T) describing the curve, where n is the dimension and T is the number of sample points
-
q_to_curve(q)¶ Convert srvf to curve
qis an array of shape (n,T) describing the srvf, where n is the dimension and T is the number of sample points
-
optimum_reparam(beta1, beta2, lam, method="DP", w=0.01, rotated=true, isclosed=false))¶ Calculates the optimum reparamertization (warping) between two curves beta1 and beta2, using the srvf framework
beta1array (n,T) describing curve 1beta2array (n,T) describing curve 2lamcontrol amount of warping (default=0.0)methodoptimization method to find warping, default is Dynamic Programming (“DP”). Other options are Coordinate Descent (“DP2”), Riemanain BFGS (“LRBFGS”).wControls LRBFGS (default = 0.01)rotatedcalculate rotation (default = true)isclosedclosed curve (default = false)
Returns:
gamwarping functionRrotation matrixtauseed value
-
calc_shape_dist(beta1, beta2)¶ Calculate elastic shape distance between two curves beta1 and beta2
beta1andbeta2are arrays of shape (n,T) describing the curve, where n is the dimension and T is the number of sample points
-
resamplecurve(x, N=100)¶ Resmaples Curve
xarray describing curve (n,T)NNumber of samples to re-sample curve, N usually is > T
Alignment and Statistics¶
-
curve_pair_align(beta1::Array{Float64, 2}, beta2::Array{Float64, 2})¶ Pairwise align two curves
beta1array (n,T)beta2array (n,T)
Returns:
beta2naligned curve 2 to 1q2naligned srvf 2 to 1gamwarping functionq1srvf of curve 1
-
curve_geodesic(beta1::Array{Float64, 2}, beta2::Array{Float64, 2}, k::Integer=5)¶ Find curves along geodesic between two curves
beta1array (n,T)beta2array (n,T)knumber of curves along geodesic
Returns:
geodcurves along geodesic (n,T,k)geod_qsrvf’s along geodesic
-
curve_srvf_align(beta; mode='O', maxit=20)¶ Aligns a collection of curves using the elastic square-root velocity (srvf) framework.
betaarray (n,T,N) for N number of curvesmodeOpen (‘O’) or Closed (‘C’) curvesmaxitmaximum number of iterations
Returns:
betanaligned curvesqnaligned srvfsbetameanmean curveq_mumean srvf
-
curve_karcher_mean(beta; mode='O', maxit=20)¶ Calculates Karcher mean of a collection of curves using the elastic square-root velocity (srvf) framework.
betaarray (n,T,N) for N number of curvesmodeOpen (‘O’) or Closed (‘C’) curvesmaxitmaximum number of iterations
Returns:
mumean srvfbetameanmean curvevshooting vectorsqarray of srvfs
-
curve_karcher_cov(betamean, beta; mode='O')¶ Calculate Karcher Covariance of a set of curves
betameanarray (n,T) of mean curvebetaarray (n,T,N) for N number of curvesmodeOpen (‘O’) or Closed (‘C’) curves
Returns:
Kcovariance matrix
-
curve_principal_directions(betamean, mu, K; mode='O', no=3, N=5)¶ Calculate principal directions of a set of curves
betameanarray (n,T) of mean curvemuarray (n,T) of mean srvfKarray (T,T) covariance matrixmodeOpen (‘O’) or Closed (‘C’) curvenonumber of componentsNnumber of samples on each side of mean
Returns:
pdarray describing principal directions
-
sample_shapes(mu, K; mode='O', no=3, numSamp=10)¶ Sample shapes from model
muarray (n,T) mean srvfKarray (T,T) covariance matrixmodeOpen (‘O’) or Closed (‘C’) curvesnonumber of principal componentsnumSampnumber of samples
Return:
samplesarray (n,T,numSamp) of sample curves