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

조회 수: 1 (최근 30일)
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

답변 (2개)

Kin Sung Chan
Kin Sung Chan 2019년 11월 9일
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 2020년 2월 27일
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!

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by