Shape alignment using Procrustes Analysis again

10 views (last 30 days)
Hello, I am rewriting the question. Procrustes analysis is a method to align one shape against another . Say I have a 3D matrix which looks like:- A=[ 1 2 100 2 3 200]; and B =[3 4 566 4 7 899]; Now, My question is I have got 2 mesh-grids by interpolating A and B using Z = griddata(xi,yi,zi,X,Y,'cubic') where xi,yi and zi are the coordinates from the above matrices. And X,Y are 1:100 coordinates for setting up the mesh grid. .The problem is that I want to align perfectly A with B using the following code: [d Z tr] = procrustes(C,B,'scaling',true);
axis([ 0 100 0 100 0 100]);
figure(1),plot3( B(:,1),B(:,2),B(:,3),'rx');
figure(2),plot3( C(:,1),C(:,2),C(:,3),'gx');
figure(3),plot3( Z(:,1),Z(:,2),Z(:,3),'bx');
The problem is that when finally I AM PLOTTING Z it is not at all showing the perfect alignment. Any help would be appreciable.
  1 Comment
Matt J
Matt J on 28 Oct 2012
Please rewrite it a 3rd time. It's still very confusing, as I've also described in your duplicate post.

Sign in to comment.

Answers (2)

Matt J
Matt J on 28 Oct 2012
What you said about GRIDDATA suggests that the zi data in A and the zi data in B might be from totally different functions of the (xi,yi) data in A and the (xi,yi,) data in B respectively.
Therefore, you should probably be doing 2D registration between the (xi,yi) coordinates, not 3D registration between the (xi,yi,zi) coordinates. So maybe the following is what you want:
[d Z tr] = procrustes(A([1,2],:),B([1,2],:),'scaling',true);

Matt J
Matt J on 28 Oct 2012
Edited: Matt J on 28 Oct 2012
You might need to better describe your data and how they are obtained, with code if possible. It's not clear, for example, why it be should necessarily be possible to neatly plot B on the same axis range as Z and C. What if B and C differ by a huge translation or scaling?
Also, are you sure that B and C are consistently row-ordered? In other words, do all B(i,:) and C(i,:) represent corresponding points?
In any case, I don't have the Statistics Toolbox and am not too familiar with the PROCRUSTES command, but you can compare its results with this FEX file
[regparams, Z, errors] = absor(B,C,'doScale',1);
to see if you get the same results. If you do, the problem is probably in your data, not in PROCRUSTES.

Community Treasure Hunt

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

Start Hunting!