procrustes algorithm gives no T transform matrix back

Hi,
Im having some trouble with the procrustes algorithm. When I enter the code(which is shown below) my transform.T is just a single number.
What am i trying to do:
I have 4 markers in placed in an image and i rotate that image with imrotate3 a several times. When im finnised rotating i select my 4 markers, in the correct order and give them the the procrustes algorithm. The outcome of the algorithm is terrible, what am i doing wrong?
Code:
%Markers
pos1 = [20 20 20];
pos2 = [1 1 1];
pos3 = [size(X,1)/2 1 1];
pos4 = [size(X,1) 1 1];
%pivot coordinats
bpn = [pos1,pos2,pos3,pos4];
%positionEA
epn = [([82 492 24]),([66 510 2]),([35 528 254]),([6 546 507])];
%procrustes
[dissim,Z,trans] = procrustes(bpn',epn');
%outcome
en = bpn-(trans.T)'*epn-(trans.c)';
RMS = rms(norm(en));

 採用された回答

Erik-Jan Meulenbrugge
Erik-Jan Meulenbrugge 2019 年 1 月 7 日

0 投票

this works
ePn = [1,20,size(X,1)/2,size(X,2);1,20,1,1;1,20,1,1];
bPn = [82,66,35,6;492,510,528,546;24,2,254,507];
[dissim,Z,trans] = procrustes(ePn',bPn','Scaling',true);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by