Match up two set of points in the least squares sense (procrustes command)
1 view (last 30 days)
Show older comments
Hi,
I am trying to find the best linear transformation (in the least square sense), i.e, rotation, scaling, translation and reflection, of points in a matrix Y to a different and small number of points in a matrix X.
I found procrustes command almost does what I want, but in this case I need same number of points in both matrices X and Y. What I am trying to do is a transformation from a relative system to an absolute system given by at least three points, given in matrix X.
The first figure here http://www.mathworks.se/products/statistics/examples.html?file=/products/demos/shipping/stats/cmdscaledemo.html solves the same problem, but instead number of points in X and Y matrices are equal. How could I do the same with less points as references? In the link example, the problem would be to try to execute the following (only three points are selected as references):
[D,Z] = procrustes(X(1:3,:), Y(:,1:2));
But I got the following error:
Error using procrustes (line 85) X and Y must have the same number of rows (points).
Thanks,
--M
0 Comments
Answers (1)
Peter Perkins
on 14 Aug 2012
MRR, perhaps I am misunderstanding your question, but you're going to have to say what you mean by "a least squares sense" if you want to compare two sets of points with different numbers of points. The goal of the PROCRUSTES function is to find a rotation/scaling/translation/reflection that makes the distances small between corresponding points. If you don't have a 1:1 correspondence between points, the criterion that PROCRUSTES minimizes doesn't apply.
The line of code you suggests that you want to take one set of points and transform them to be "near" to a subset of another set of points. That's perfectly reasonable, but you need to have the same number of points in both inputs to PROCRUSTES. In addition, that line of code seems to indicate that X has the larger number of points, which is exactly the opposite of your description in your first paragraph. From that description, I would have thought you would want to subset Y to have the same ("small") number of points as X. From there, you could get the last output of PROCRUSTES and apply the transformation to all the points in Y.
See Also
Categories
Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!