Point cloud sequential transformation
Show older comments
Hi everyone,
I'm trying to apply two transformations to a point cloud, a translation A and then a rotation B. My issue is that the transformation matrix I get when using pcregistericp seems to be the opposite of what I expected (I get A*B instead of B*A). I'm not sure what the issue is, or if I'm misunderstanding the order of transformations in linear algebra.
xyzPoints=[];
for x=0:0.1:1
for y=0:0.2:2
z=x^2+y^3;
xyzPoints=[xyzPoints;x y z];
end
end
ptCloud100 = pointCloud(xyzPoints);
%translation
A = [1 0 0 0; ...
0 1 0 0; ...
0 0 1 0; ...
2 4 5 1];
tform = affine3d(A);
ptCloudOuttrans = pctransform(ptCloud100,tform);
%rotation
theta=deg2rad(70);
B = [cos(theta) 0 sin(theta) 0; ...
0 1 0 0; ...
-sin(theta) 0 cos(theta) 0; ...
0 0 0 1];
tform = affine3d(B);
ptCloudOutrot = pctransform(ptCloudOuttrans,tform);
%ICP
[tform_inv,movingReg] = pcregistericp(ptCloudOutrot,ptCloud100,'Extrapolate',true,'MaxIterations',50);
t=invert(tform_inv);
disp(t.T);
%What I expected it to match
disp(B*A);
%what it matches
disp(A*B);
Answers (1)
Sulaymon Eshkabilov
on 19 May 2021
The answer is simple. MATLAB's accuracy is not absolute and thus, you have gotten difference. You can test this exercise:
theta=deg2rad(90);
...
B*A
A*B
...
Good luck.
1 Comment
Daniela Moreno
on 19 May 2021
Categories
Find more on Point Cloud Processing 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!