Clear Filters
Clear Filters

statistics (PCA) on piecewise B spline for Shape Model problem using spline toolbox

3 views (last 30 days)
Hi, I want to perform subtraction on two cubic B splines and then project the difference on basis functions. ie. multiply the result by principal components matrix obtained from PCA performed on a group of curves. The problem is that the subtraction result in spline with different number of breaks and coefficients and therefore I can't multiply by the principal components matrix. I assume I need to delete breaks/knots (the opposite operation to 'fnrfn()') to force my new spline to the original number of breaks. How do I do that or does anyone have an alternative proposal?
my code looks something like: splineDiff = fncmb(meanBSpline,'-',proposedSpline); bNewProposed = PCoefs'*(reshape(splineDiff.coefs',1,[])');
both meanBSpline and proposedSpline are pp structures with 30 pieces (1x31 breaks, 60x4 coefs, order 4, dim 2) However, the splineDiff is a pp structure with (on this instance - can vary) 59 pieces (1x60 breaks, 118x4 coefs, order 4, dim 2)) my principal component matrix PCoefs is a 240x18, so I need the reshaped coefs vector of spline Diff to be 240.
Any assistance will be much appreciated

Answers (1)

Unai San Miguel
Unai San Miguel on 29 Sep 2016
fncmb takes first both spline functions to the same vector space (same breaks and order in this case). If the breaks are not the same the resulting spline will have the union of both breaks vectors.
One possible approach is to find the spline of the first vector space which is closest to the second one. For instance, if
br = meanBSpline.breaks;
prop_in_mean = csapi(br, fnval(proposedBSpline, br));
is a valid (approximation) solution for you then fncmb(meanBSpline, '-', prop_in_mean) will have exactly the same breaks as meanBSpline.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!