Bad result / high deviation using procrustes
Show older comments
I try using procrustes to get the transformation between two point sets, each with 4 points. Manually I found a transformation, that aligns the two point set quite good (TFM_Ref). But the transformation calculated by procrustes (TFM_PcR) is quite bad compared to TFM_Ref.
clearvars
%%Data
S =[-52.0000 0 0;
11.5000 25.0000 0;
53.0000 0 0;
-20.0000 -42.0000 0];
T =[ 0 0 2.71;
42.4000 -23.2300 0;
104.5800 4.4400 0;
70.9000 45.1900 0];
%%Test transformation (determined manually)
TFM_Ref = [-0.9991 -0.0427 0 53.0000;
0.0427 -0.9991 0 0 ;
0 0 1.0000 0 ;
0 0 0 1.0000];
S2T_Ref = unique(transformPointsInverse(affine3d(TFM_Ref'), S),'rows');
T_Ref = unique(T,'rows');
RMSE_Ref = rms(rms(T_Ref-S2T_Ref))
%%Procrustes
[~,~,transform] = procrustes(T, S, 'scaling',0, 'reflection',0);
TFM_PrC = inv([[transform.T', transform.c(1,:)']; 0 0 0 1]);
S2T_PrC = unique(transformPointsInverse(affine3d(TFM_PrC'), S), 'rows');
RMSE_PrC = rms(rms(T_Ref-S2T_PrC))
Accepted Answer
More Answers (0)
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!