www.gusucode.com > vision 源码程序 matlab案例代码 > vision/DetectPlaneInPointCloudExample.m
%% Detect Plane in Point Cloud % %% % Load point cloud. % Copyright 2015 The MathWorks, Inc. load('object3d.mat'); %% % Display the point cloud. figure pcshow(ptCloud) xlabel('X(m)') ylabel('Y(m)') zlabel('Z(m)') title('Detect a plane in a point cloud') %% % Set the maximum point-to-plane distance (2cm) for plane fitting. maxDistance = 0.02; %% % Set the normal vector of a plane. referenceVector = [0, 0, 1]; %% % Set the maximum angular distance (5 degrees). maxAngularDistance = 5; %% % Detect the table in the point cloud and extract it. model = pcfitplane(ptCloud,maxDistance,referenceVector,maxAngularDistance); %% % Plot the plane. hold on plot(model)