Main Content

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

Description

example

player = pcplayer(xlimits,ylimits,zlimits) returns a player with xlimits,ylimits, and zlimits set for the axes limits.

example

player = pcplayer(xlimits,ylimits,zlimits,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example, ViewPlane="XY" sets the plane to the x-y axes from which to visualize the point cloud.

Input Arguments

expand all

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.

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.

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.

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.

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.

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.

Background color, specified as an RGB triplet, hexadecimal color code, or a character vector that specifies a long or short color name.

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.

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.

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.

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.

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 the Location property of the input point cloud.

  • "Y"y coordinates in the Location property of the input point cloud.

  • "Z"z coordinates in the Location 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 PropertyColor 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.

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.

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

expand all

Player axes handle, specified as an axes graphics object.

Object Functions

hideHide player figure
isOpenVisible or hidden status for player
showShow player
viewDisplay point cloud

Examples

collapse all

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

expand all

Version History

Introduced in R2015b

expand all