plot
Plot cuboid model
Description
Examples
Detect Cuboid in Point Cloud
Detect a cuboid in a point cloud using pcfitcuboid
function. The function stores the cuboid parameters as a cuboidModel
object.
Read point cloud data into the workspace.
ptCloud = pcread('highwayScene.pcd');
Search the point cloud within a specified region of interest (ROI). Create a point cloud of only the detected points.
roi = [-30 30 -20 30 -8 13]; in = findPointsInROI(ptCloud,roi); ptCloudIn = select(ptCloud,in);
Plot the point cloud of detected points.
figure pcshow(ptCloudIn.Location) xlabel('X(m)') ylabel('Y(m)') zlabel('Z(m)') title('Detected Points in ROI')
Find the indices of the points in a specified ROI within the point cloud.
roi = [9.6 13.8 7.9 9.3 -2.5 3]; sampleIndices = findPointsInROI(ptCloudIn,roi);
Fit a cuboid to the selected set of points in the point cloud.
model = pcfitcuboid(ptCloudIn,sampleIndices); figure pcshow(ptCloudIn.Location) xlabel('X(m)') ylabel('Y(m)') zlabel('Z(m)') title('Detect a Cuboid in a Point Cloud')
Plot the cuboid box in the point cloud.
hold on
plot(model)
Display the internal properties of the cuboidModel
object.
model
model = cuboidModel with properties: Parameters: [11.4873 8.5997 -1.6138 3.6713 1.3220 1.7576 0 0 0.9999] Center: [11.4873 8.5997 -1.6138] Dimensions: [3.6713 1.3220 1.7576] Orientation: [0 0 0.9999]
Input Arguments
model
— Cuboid model
cuboidModel
object
Cuboid model, specified as a cuboidModel
object.
ax
— Output axes
gca
(default) | Axes
object
Output axes, specified as an Axes
object, on which to display the
cuboid model. For a list of properties, see Axes Properties.
Output Arguments
H
— Patch object
patch
object
Patch object, returned as a patch
object.
Version History
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)