pcplayer
Visualize streaming 3-D point cloud data
Description
Visualize 3-D point cloud data streams from devices such as Microsoft® Kinect®.
To improve performance, pcplayer
automatically downsamples the
rendered point cloud during interaction with the figure. The downsampling occurs only
for rendering the point cloud and does not affect the saved points.
You can set the default center of rotation for the point cloud viewer to rotate around the axes center or around a point. Set the default behavior from the Computer Vision Toolbox Preferences.
Creation
Syntax
Description
player = pcplayer(
specifies options using one or more name-value arguments in addition to any
combination of arguments from previous syntaxes. For example,
xlimits
,ylimits
,zlimits
,Name=Value
)ViewPlane="XY"
sets the plane to the x-y axes from which
to visualize the point cloud.
Input Arguments
xlimits
— Range of x-axis coordinates
1-by-2 vector
Range of x-axis coordinates, specified as a 1-by-2
vector in the format [min
max]. pcplayer
does not display
data outside these limits.
ylimits
— Range of y-axis coordinates
1-by-2 vector
Range of y-axis coordinates, specified as a 1-by-2
vector in the format [min
max]. pcplayer
does not display
data outside these limits.
zlimits
— Range of z-axis coordinates
1-by-2 vector
Range of z-axis coordinates, specified as a 1-by-2
vector in the format [min
max].pcplayer
does not display
data outside these limits.
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.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: ViewPlane="XY"
sets the plane to the x-y axes from
which to visualize the point cloud.
MarkerSize
— Diameter of marker
6
(default) | positive scalar
Diameter of marker, specified as a positive scalar. The value specifies the approximate diameter of the point marker. MATLAB® graphics defines the unit as points. A marker size larger than six can reduce the rendering performance.
BackgroundColor
— Background color
[0 0 0]
(black) (default) | RGB triplet | hexadecimal color code | character vector
Background color, specified as an RGB triplet, hexadecimal color code, or a character vector that specifies a long or short color name.
VerticalAxis
— Vertical axis
"Z"
(default) | "X"
| "Y"
Vertical axis, specified as "X"
,
"Y"
, or "Z"
. When you
reload a saved figure, any action on the figure resets the vertical
axis to the z-axis.
VerticalAxisDir
— Vertical axis direction
"Up"
(default) | "Down"
Vertical axis direction, specified as "Up"
or
"Down"
. When you reload a saved figure, any
action on the figure resets the direction to the up
direction.
Projection
— Camera projection for 3-D views
"perspective"
(default) | "orthographic"
Camera projection for 3-D views, specified as one of these values:
"perspective"
— Projects the viewing volume as the frustum of a pyramid (a pyramid whose apex has been cut off parallel to the base). Objects further from the camera appear smaller. Distance causes foreshortening, which enables you to perceive the depth of 3-D objects. This projection type is useful when you want to display realistic views of real objects. Perspective projection does not preserve the relative dimensions of objects. Instead, it displays a distant line segment smaller than a nearer line segment of the same length. Lines that are parallel in the data might not appear parallel in the scene."orthographic"
— This projection type maintains the correct relative dimensions of graphics objects regarding the distance of a given point from the viewer. Relative distance from the camera does not affect the size of objects. Lines that are parallel in the data parallel appear parallel on the screen. This projection type is useful when it is important to maintain the actual size of objects and the angles between objects.
ViewPlane
— Plane to visualize point cloud
"XY"
(default) | "YX"
| "XZ"
| "ZX"
| "YZ"
| "ZY"
Plane to visualize point cloud, specified as
"XY"
, "YX"
,
"XZ"
, "ZX"
,
"YZ"
, "ZY"
. The
ViewPlane
sets the line of sight from the
camera, centered in the selected plane, to the center of the
plot.
ColorSource
— Point cloud property for color map
"auto"
(default) | "X"
| "Y"
| "Z"
| "Intensity"
| "Color"
| "Row"
| "Column"
Point cloud property for color map, specified as
"auto"
,"X"
,
"Y"
, "Z"
,
"Intensity"
, "Color"
,
"Row"
, "Column"
. The
pcshow
function uses the value of
ColorSource
to assign a color map for
rendering the point cloud. The values use these properties:
"X"
— x coordinates in theLocation
property of the input point cloud."Y"
— y coordinates in theLocation
property of the input point cloud."Z"
— z coordinates in theLocation
property of the input point cloud."Intensity"
—Intensity
property of the input point cloud."Color"
—Color
property of the input point cloud."Row"
— Using the row values of an organized point cloud."Column"
— Using the column values of an organized point cloud.
When you set ColorSource
to
"auto"
, the function sets the color map
depending on which property values are available in the input point
cloud object:
Available Point Cloud Property | Color Source |
---|---|
Location only | Maps the Z-value to a color value in the current color map. |
Location and
Intensity | Maps the z-value to a color value in the current color map. |
Location and
Color | Maps the color values to the current color map. |
Location ,
Intensity , and
Color | Maps the color values to the current color map. |
AxesVisibility
— State of axes visibility
"off"
or logical
0
(false
) (default) | "on"
or logical 1
(true
)
State of axes visibility, specified as "off"
or
"on"
, or as numeric or logical
0
(false
) or
1
(true
). A value of
"off"
is equivalent to
false
, and "on"
is
equivalent to true
. Thus, you can use the value
of this property as a logical value. The value is stored as an
on/off logical value of type matlab.lang.OnOffSwitchState
.
"off"
— Hide the axes without deleting it. You still can access the properties of an invisible axes object. (Child objects such as lines remain visible.)"on"
— Display the axes and its children.
Parent
— Axes on which to display the visualization
axes
graphics object
Axes on which to display the visualization, specified as an
Axes
object. To create an Axes
object, use the axes
function. To
display the visualization in a new figure, leave
"Parent"
unspecified.
Properties
Axes
— Player axes handle
axes
graphics object
Player axes handle, specified as an axes
graphics object.
Object Functions
Examples
Terminate a Point Cloud Processing Loop
Create the player and add data.
player = pcplayer([0 1],[0 1],[0 1]);
Display continuous player figure. Use the isOpen
function to check if player figure window is
open.
while isOpen(player) ptCloud = pointCloud(rand(1000,3,"single")); view(player,ptCloud); end
Terminate while-loop by closing pcplayer figure window.
More About
Axes Toolbar Operations
Keyboard shortcuts are enabled only for the rotate (default) mode. To view the axes toolbar operations, point to the figure and select one of these options. Click the Restore View icon to reset the display.
Feature | Description | ||||||
---|---|---|---|---|---|---|---|
Vertical Axis | Select an X-, Y-, or Z-direction to set the direction of that axis of the point cloud as the positive vertical direction. Use the keyboard arrow keys to move the point cloud with respect to the direction selected. | ||||||
View Plane | Select the viewing angle of the point cloud figure as the XY, YX, XZ, ZX, YZ, or ZY plane. | ||||||
Background Color | Display a color chart from which you can select a background color. | ||||||
Axes On/Off | Turn the display axes on or off. | ||||||
Projection | Select perspective or orthogonal view. | ||||||
Export |
| ||||||
Brush | Enable data brushing mode. | ||||||
Data Tips | View the point data values of a point by selecting it in the point cloud figure. The Data Tips display shows the x, y, and z values of the points. Point clouds for depth images and lidar contain these additional data properties:
| ||||||
Rotate 3D | Drag to rotate the point cloud figure. You can also right-click any point on the point cloud figure and select Rotate Around a Point to specify that point as the center of rotation for the figure. To return to axes rotation, right-click again and select Rotate Around Axes Center. While in Rotate 3D mode, you can also select the color source for the point cloud by right-clicking anywhere in the point cloud figure and selecting Color Source, and then selecting an option from the list. The figure applies the active colormap to the point cloud based on the values in the selected source. For a point cloud of only position data, the Color Source options are X, Y, Z, and User Specified. Point clouds for depth image and lidar data include these additional color source options:
| ||||||
Pan, Zoom in, and Zoom out | Maneuver the point cloud in the figure, or zoom the point cloud figure in or out. | ||||||
Restore View | Restore the original view of the axes. |
Move Camera Through a Scene
To navigate into a point cloud and observe the scene, use these keyboard shortcuts:
Action | Keyboard Shortcut | Example |
---|---|---|
Move forward or backwards through the scene. The camera and the target can move. | w — Forward s — Backward |
|
Move left or right through the scene. The camera and the target can move. | a — Left d — Right | |
Look around the scene (pitch/yaw rotation of the camera). Camera position is fixed, target moves. | Up arrow — Camera pitches up Down arrow — Camera pitches down Left arrow — Camera turns left in yaw Right arrow — Camera turns right in yaw |
|
Roll the scene (roll rotation of the camera). | q — Camera moves clockwise. (Scene appears to move counterclockwise.) e — Camera moves counterclockwise. (Scene appears to move clockwise.) |
|
Rotate the scene (rotate the camera around the point cloud). Camera position changes, target is fixed. | Shift + Left or Right — Camera orbits horizontally around the point cloud. (Scene appears to stand still as camera moves externally around it horizontally.) Shift + Up or Down — Camera orbits vertically around the point cloud. (Scene appears to stand still as camera moves externally around it vertically.) |
|
Zoom in or out. | z — Zoom in x — Zoom out |
|
Look at a view plane. | 1 — XY 2 — YX 3 — XZ 4 — ZX 5 — YZ 6 — ZY Camera positioned in the selected plane with a line of sight to the center of the plot. |
|
Switch between rotate and pan. | Spacebar — Press and hold the spacebar to switch the interaction to pan. Release the spacebar to switch back to rotate. |
|
Rotate in X-, Y-, and Z- dimensions. | T — Adds rotate interaction in the third dimension. |
|
Color Formats
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] |
Performance and Tips
To improve performance, the function automatically downsamples the rendered point cloud when you rotate, pan, or zoom in or out by clicking the mouse. Downsampling is not applied for zoom in or out by using the mouse scroll mechanism. When using data tips, the figure does not apply downsampling. The downsampling occurs only for rendering the point cloud and does not affect the saved points.
The keyboard shortcuts described in Move Camera Through Scene are not supported when loading a saved figure or for popped-out windows using Live Editor.
When you reload a saved figure, any action on the figure resets the vertical axis to the z-axis and in the up direction.
To visualize a large point cloud (greater than one million points), use the
pcviewer
object.
OpenGL Option
pcplayer
supports the "opengl"
option for
the Renderer
figure
property only.
Version History
Introduced in R2015bR2022b: Projection display default behavior changed to perspective
The default projection for the camera 3-D view display is changed from
orthographic to perspective. You can use the new Projection
name-value argument to specify the projection as "perspective"
or
"orthographic"
. Prior to R2022b, the display rendered the
point cloud in an orthographic view only.
See Also
Functions
showShape
|pcshow
|pcshowpair
|pcwrite
|pcread
|pcmerge
|plot3
|pcdownsample
|pcfitplane
|pcdenoise
|scatter3
|pcregistericp
Objects
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)