point cloud rot in matlab

Hello Matlab,
want to ask regarding 3D Point cloud. we have points with X, Y, Z. We are totally new at this work. With MatLab we want to have few references for point cloud rot.
Any one have reference or solution etc?

댓글 수: 2

madhan ravi
madhan ravi 2018년 12월 11일
편집: madhan ravi 2018년 12월 11일
It's truly impolite of you to close the question after someone has answered. If you keep closing the question it is sure that you won't get any help in the future.
madhan ravi
madhan ravi 2018년 12월 12일
In case if the OP removes the original question below is the original question:
Hello Matlab,
want to ask regarding 3D Point cloud. we have points with X, Y, Z. We are totally new at this work. With MatLab we want to have few references for point cloud rot.
Any one have reference or solution etc?

댓글을 달려면 로그인하십시오.

답변 (1개)

Bruno Luong
Bruno Luong 2018년 12월 11일
편집: Bruno Luong 2018년 12월 11일

1 개 추천

xyz=xlsread('PointClouds.xlsx',3);
% Find the rotation axis
xyzc = mean(xyz,1);
xyzr = xyz-xyzc;
[~,S,V] = svd(xyzr,0);
s = diag(S);
if abs(diff(s(1:2))) < abs(diff(s(2:3)))
k = 3;
else
k = 1;
end
V = V(:,circshift(1:3,3-k));
xyzr = xyzr*V;
% Same as in this thread
% https://fr.mathworks.com/matlabcentral/answers/435031-best-fit-rotation-axis-for-the-point-cloud?s_tid=prof_contriblnk
r=sqrt(sum(xyzr(:,1:2).^2,2));
z=xyzr(:,3);
P = polyfit(z,r,5);
zi = linspace(min(z),max(z),50);
ri = polyval(P,zi);
theta = linspace(0,2*pi,100);
[THETA,Z] = meshgrid(theta,zi);
R = polyval(P,Z);
[X,Y,Z] = pol2cart(THETA,R,Z);
% Rotate/shift back
[XYZ] = xyzc + [X(:),Y(:),Z(:)]*V';
X = reshape(XYZ(:,1),size(R));
Y = reshape(XYZ(:,2),size(R));
Z = reshape(XYZ(:,3),size(R));
close all
subplot(2,1,1);
plot3(xyz(:,1),xyz(:,2),xyz(:,3),'.');
axis equal
subplot(2,1,2);
surf(X,Y,Z);
axis equal

댓글 수: 2

Stephan
Stephan 2018년 12월 11일
+1
Bruno Luong
Bruno Luong 2018년 12월 12일
Add here the data that OP has been removed

댓글을 달려면 로그인하십시오.

카테고리

제품

태그

질문:

2018년 12월 10일

다시 열림:

2018년 12월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by