www.gusucode.com > vision 源码程序 matlab案例代码 > vision/Rotate3DPointCloudExample.m
%% Rotate 3-D Point Cloud % %% % Read a point cloud. % Copyright 2015 The MathWorks, Inc. ptCloud = pcread('teapot.ply'); %% % Plot the original data. figure pcshow(ptCloud); xlabel('X'); ylabel('Y'); zlabel('Z'); %% % Create a transform object with a 45 degrees rotation along the _z_ -axis. A = [cos(pi/4) sin(pi/4) 0 0; ... -sin(pi/4) cos(pi/4) 0 0; ... 0 0 1 0; ... 0 0 0 1]; tform = affine3d(A); %% % Transform the point cloud. ptCloudOut = pctransform(ptCloud,tform); %% % Plot the transformed point cloud. figure pcshow(ptCloudOut); xlabel('X'); ylabel('Y'); zlabel('Z');