Why does transforming with affine3D yield different result than multiplying with transfomation matrix?

3 visualizaciones (últimos 30 días)
Hi,
I am trying to transform a pointcloud with a transformation matrix on a point-per-point basis.
In the following script I run a pctransform which does indeed shift the pointcloud over a unit of 1.
However, when applying the same transformation matrix on a point per point basis, I dont see any difference in the resulting point cloud.
I cant use pctransform in my final setup since my transformation matrices are non-rigid.
Could anyone point me out what i am doing wrong?
ptCloud1 = pointCloud(rand(10000,3,'single'));
moveRight = [1 0 0 0; ...
0 1 0 0; ...
0 0 1 0; ...
1 0 0 1];
ptCloudRight = pctransform(copy(ptCloud1),affine3d(moveRight));
pcshowpair(ptCloud1,ptCloudRight);
ptCloudRightCreated = pointCloud(transformPoints(copy(ptCloud1), moveRight))
pcshowpair(ptCloud1,ptCloudRightCreated);
function newPoints = transformPoints(ptc, tmatrix)
newPoints = [];
disp(tmatrix)
for i = 1 : ptc.Count
point = [ptc.Location(i,:), 0];
tPoint = point * tmatrix;
newPoints = cat(1, newPoints, tPoint(1:3));
end
end

Respuestas (2)

Kin Sung Chan
Kin Sung Chan el 9 de Nov. de 2019
ptCloud = pointCloud(rand(10000,3,'single'));
moveRight = [1 0 0 0; ...
0 1 0 0; ...
0 0 1 0; ...
1 0 0 1];
tform = affine3d(moveRight);
ptCloudRight = pctransform(ptCloud, tform);
figure(1)
pcshowpair(ptCloud, ptCloudRight );
I have no problems translating the point cloud.

Lewis Newton
Lewis Newton el 27 de Feb. de 2020
This appears to have been expanded in the 2019 version, if you check your current help you'll find that it says it must be rigid.
If you update your version, help says this function works for both rigid and non-rigid transforms!

Categorías

Más información sobre Point Cloud Processing en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by