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

3 ビュー (過去 30 日間)
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.

採用された回答

Nicolai Sanders
Nicolai Sanders 2017 年 3 月 10 日
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 件のコメント
GAldos
GAldos 2018 年 7 月 26 日
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.' ?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by