Main Content

plot

Plot parametric model

Description

example

plot(model) plots a model within the axis limits of the current figure. H is the handle to surf, a 3-D shaded surface plot or patch, a filled polygon region.

plot(model,Name=Value) specifies options using one or more name-value arguments in addition to argument from previous syntax. For example, plot(model,Parent=gca) sets the color of the plot to red.

H = plot(___) specifies options using one or more name-value arguments. For example, plot(model,Parent=gca)

Examples

collapse all

Load a MAT file containing a point cloud into the workspace.

load("object3d.mat");

Display the point cloud.

figure
pcshow(ptCloud)
xlabel("X(m)")
ylabel("Y(m)")
zlabel("Z(m)")
title("Detect a Cylinder in a Point Cloud")

Set the maximum point-to-cylinder distance for cylinder fitting to 5mm.

maxDistance = 0.005;

Specify a region of interest (ROI) to constrain the fitting function.

roi = [0.4 0.6; -inf 0.2; 0.1 inf];
sampleIndices = findPointsInROI(ptCloud,roi);

Set the orientation constraint for the fitting function

referenceVector = [0 0 1];

Detect the cylinder in the specified ROI of the point cloud and extract it.

model = pcfitcylinder(ptCloud,maxDistance,referenceVector, ...
        SampleIndices=sampleIndices);

Plot the model of the detected cylinder.

hold on
plot(model)

Load a point cloud into the workspace.

load("object3d.mat");

Display the point cloud and label the figure.

figure
pcshow(ptCloud)
xlabel("X(m)")
ylabel("Y(m)")
zlabel("Z(m)")
title("Detect a sphere in a point cloud")

Set the maximum point-to-sphere distance for sphere fitting to 1cm.

maxDistance = 0.01;

Set the region of interest to constrain the search.

roi = [-inf,0.5;0.2,0.4;0.1,inf];
sampleIndices = findPointsInROI(ptCloud,roi);

Detect the globe in the point cloud and extract it.

[model,inlierIndices] = pcfitsphere(ptCloud,maxDistance,SampleIndices=sampleIndices);
globe = select(ptCloud,inlierIndices);

Plot the extracted globe.

figure
pcshow(globe)
title("Globe Point Cloud")

Input Arguments

collapse all

Parametric model returned by the cylinderModel, planeModel, or the sphereModel object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: plot(model,Parent=gca) sets the output axes to the current axes in the current figure.

Output axes, specified as gca (the current axes) or axes (a custom set axes) for displaying the visualization.

Output Arguments

collapse all

Handle to a plot, returned as a surf 3-D shaded surface plot or as a patch filled polygon region.

Version History

Introduced in R2015b