www.gusucode.com > vision 源码程序 matlab案例代码 > vision/FindPointsWithinCuboidExample.m

    %% Find Points Within Cuboid
% Create a point cloud object with randomly generated points.

% Copyright 2015 The MathWorks, Inc.

ptCloudA = pointCloud(100*rand(1000,3,'single'));
%%
% Define a cuboid.
roi = [0,50;0,inf;0,inf];
%% 
% Find all the points within the cuboid.
indices = findPointsInROI(ptCloudA, roi);
ptCloudB = select(ptCloudA,indices);
%%
% Display points within the ROI. 
pcshow(ptCloudA.Location,'r');
hold on;
pcshow(ptCloudB.Location,'g');
hold off;