Azzera filtri
Azzera filtri

How can I do a homogeneous transform of data to a different coordinate system?

5 visualizzazioni (ultimi 30 giorni)
Hello
I have two 3D data arrays, A and B, that contain spatial measurement data of the same real world object. A and B are not the same size. There are XYZ coordinate systems attached to both arrays. In array B the object is rotated, scaled and translated relative to the data in array A. I do have the transformation matrix for the affine transformation between the two coordinate systems, thanks to fiduciary points in the object which show up in the data.
I would like to interpolate the data in the B array into the coordinate system for the A array, but I am unsure how to do this?
The end result would be a new array, C, that contains the interpolated data from the B array, but with the same size as the A array.
Thank you for your help.

Risposta accettata

Nicolai Sanders
Nicolai Sanders il 10 Mar 2017
To answer my own question: I ended up using imwarp when i realized it can handle 3D arrays.
I defined spatial references for the A and B coordinate systems with
RA = imref3d(size(A),[min(xA), max(xA)],[min(yA), max(yA)],[min(zA), max(zA)]);
RB = imref3d(size(B),[min(xB), max(xB)],[min(yB), max(yB)],[min(zB), max(zB)]);
Then i defined an affine transformation AT with my transformation matrix TM
AT=affine3d(TM);
Now i could transform B into the coordinate system of A with
[C,RC]=imwarp(B,RB,AT,'OutputView',RA);
On a sidenote, i acquired the transformation matrix with absor
[rp,Bfit,ErrorStats]=absor(PA,PB,'DoScale',1);
TM=rp.M.';
  1 Commento
GAldos
GAldos il 26 Lug 2018
Thanks for posting your solution! Just wondering why did you take the transpose of the rotation matrix to get the transformation matrix with absor? i.e. TM=rp.M.' ?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by