www.gusucode.com > vision 源码程序 matlab案例代码 > vision/ViewRotating3DPointCloudExample.m
%% View Rotating 3-D Point Cloud %% % Load point cloud. % Copyright 2015 The MathWorks, Inc. ptCloud = pcread('teapot.ply'); %% % Define a rotation matrix and 3-D transform. x = pi/180; R = [ cos(x) sin(x) 0 0 -sin(x) cos(x) 0 0 0 0 1 0 0 0 0 1]; tform = affine3d(R); %% % Compute _x_-_y_ limits that ensure that the rotated teapot is not clipped. lower = min([ptCloud.XLimits ptCloud.YLimits]); upper = max([ptCloud.XLimits ptCloud.YLimits]); xlimits = [lower upper]; ylimits = [lower upper]; zlimits = ptCloud.ZLimits; %% % Create the player and customize player axis labels. player = pcplayer(xlimits,ylimits,zlimits); xlabel(player.Axes,'X (m)'); ylabel(player.Axes,'Y (m)'); zlabel(player.Axes,'Z (m)'); %% % Rotate the teapot around the _z_-axis. for i = 1:360 ptCloud = pctransform(ptCloud,tform); view(player,ptCloud); end