view
Display point cloud
Syntax
Description
Examples
View Rotating 3-D Point Cloud
Load point cloud.
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
Input Arguments
ptCloud
— Point cloud
pointCloud
object
Point cloud, specified as a pointCloud
object. The object
contains the locations, intensities, and RGB colors to render the point
cloud.
Point Cloud Property | Color Rendering Result |
---|---|
Location only | Maps the z-value to a color value in the current color map. |
Location and
Intensity | Maps the intensity to a color value in the current color map. |
Location and
Color | Use provided color. |
Location ,
Intensity , and
Color | Use provided color. |
player
— Player
pcplayer
object
Player for visualizing 3-D point cloud data streams, specified as a
pcplayer
object.
xyzPoints
— Point cloud x, y, and z locations
M-by-3 numeric matrix | M-by-N-by-3 numeric matrix
Point cloud x, y, and
z locations, specified as either an
M-by-3 or an
M-by-N-by-3 numeric matrix. The
M-by-N-by-3 numeric matrix is
commonly referred to as an organized point cloud. The
xyzPoints
numeric matrix contains
M or M-by-N
[x,y,z] points.
The z values in the numeric matrix, which generally
correspond to depth or elevation, determine the color of each point.
color
— Color for points in the point cloud
1-by-3 RGB vector | short name of color | long name of color | M-by-3 matrix | M-by-N-by-3 matrix
Color for points in the point cloud, specified as a 1-by-3-RGB vector, an M-by-3 matrix, an M-by-N-by-3 matrix, a short color name, or a long color name. For details on color names, see the Color Value table.
You can specify the same color for all points or a different color for
each point. When you set color
to
single
or double
, the RGB values
range between [0, 1]. When you set color
to
uint8
, the values range between [0,
255].
Points Input | Color Selection | Valid Values of C | |
---|---|---|---|
xyzPoints | Same color for all points | 1-by-3 RGB vector, or a color name or short name, listed in the Color Value table. |
|
Different color for each point | M-by-3 matrix or M-by-N-by-3 matrix containing RGB values for each point. |
|
colorMap
— Point cloud color map for points
M-by-1 vector | M-by-N matrix
More About
Color Value
Color Name | Short Name | RGB Triplet | Appearance |
---|---|---|---|
'red' | 'r' | [1 0 0] | |
'green' | 'g' | [0 1 0] | |
'blue' | 'b' | [0 0 1] | |
'cyan' | 'c' | [0 1 1] | |
'magenta' | 'm' | [1 0 1] | |
'yellow' | 'y' | [1 1 0] | |
'black' | 'k' | [0 0 0] | |
'white' | 'w' | [1 1 1] |
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)