Bad result / high deviation using procrustes

1 回表示 (過去 30 日間)
Fritz
Fritz 2015 年 12 月 4 日
編集済み: Fritz 2015 年 12 月 11 日
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))

採用された回答

Fritz
Fritz 2015 年 12 月 11 日
編集済み: Fritz 2015 年 12 月 11 日
I found a solution using procrustes with all permutations of the source points. The best transformation is the one with the minimum dissimilarity measure.
clearvars
%%Data
Source =[-52.00 0 0;
11.50 25.00 0;
53.00 0 0;
-20.00 -42.00 0];
Target =[ 0 0 2.71;
42.40 -23.23 0 ;
104.58 4.44 0 ;
70.90 45.19 0 ];
%%Procrustes
IndexPermutations = perms(1:size(Source,1)); % All permutations of the indices of Source
for i=1:length(IndexPermutations)
[D(i,1), ~, TFMs(i)] = procrustes(Target, Source(IndexPermutations(i,:),:), ...
'scaling',0, 'reflection',0); % Try procrustes with all permutations
end
[DMin, I_DMin] = min(D); % Get the index of the smallest dissimilarity measure
TFM = [[TFMs(I_DMin).T', TFMs(I_DMin).c(1,:)']; 0 0 0 1]; % Create the transformation
Source = Source(IndexPermutations(I_DMin,:),:);
Source_tfmd = transformPointsForward(affine3d(TFM'), Source);
rms(rms(Target-Source_tfmd))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Geodesy についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by