Main Content

pcshow

Plot 3-D point cloud

Description

example

pcshow(ptCloud)displays points using the locations and colors stored in the point cloud object.

pcshow(xyzPoints)displays points specified by thexyzPoints矩阵.

pcshow(xyzPoints,color)displays points contained in thexyzPoints矩阵, with colors specified bycolor.

pcshow(xyzPoints,colorMap)displays points contained in thexyzPoints矩阵, with colors specified bycolorMap.

pcshow(filename)displays the point cloud stored in the file specified byfilename.

pcshow(___,Name,Value)uses additional options specified by one or moreName,Valuepair arguments, using any of the preceding syntaxes.

ax= pcshow(___)returns the plot axes.

Examples

collapse all

Generate a sphere consisting of 600-by-600 faces.

numFaces = 600; [x,y,z] = sphere(numFaces);

Plot the sphere using the default color map.

figure; pcshow([x(:),y(:),z(:)]); title('Sphere with Default Color Map'); xlabel('X'); ylabel('Y'); zlabel('Z');

图包含一个坐标轴对象。坐标轴对象with title Sphere with Default Color Map contains an object of type scatter.

Load and display an image for texture mapping.

I = im2double(imread('visionteam1.jpg')); imshow(I);

图包含一个坐标轴对象。The axes object contains an object of type image.

Resize and flip the image for mapping the coordinates.

J = flipud(imresize(I,size(x)));

Plot the sphere with the color texture.

pcshow([x(:),y(:),z(:)],reshape(J,[],3)); title('Sphere with Color Texture'); xlabel('X'); ylabel('Y'); zlabel('Z');

图包含一个坐标轴对象。坐标轴对象with title Sphere with Color Texture contains an object of type scatter.

Input Arguments

collapse all

Point cloud, specified as apointCloudobject. The object contains the locations, intensities, and RGB colors to render the point cloud.

Point Cloud Property Color Rendering Result
Locationonly Maps the z-value to a color value in the current color map.
LocationandIntensity Maps the intensity to a color value in the current color map.
LocationandColor Use provided color.
Location,Intensity, andColor Use provided color.

Point cloud filename, specified as a character vector or a scalar string. The file must be supported bypcread.pcshowcallspcreadto read the point cloud from the file, but does not store the data in the MATLAB®workspace.

Point cloudx,y, andzlocations, specified as either anM3或M-by-N-by-3 numeric matrix. ThexyzPointsnumeric matrix containsMorM-by-N[x,y,z] points. Thezvalues in the matrix, which generally corresponds to depth or elevation, determine the color of each point. When you do not specify theCinput color, the function maps thezvalue to a color in the current colormap.

Color for points in the point cloud, specified as a 1-by-3-RGB vector, anM-by-3 matrix, anM-by-N-by-3 matrix, a short color name, or a long color name. For details on color values, see theColor Valuetable.

You can specify the same color for all points or a different color for each point. When you setcolortosingleordouble, the RGB values range between [0, 1]. When you setcolortouint8, the values range between [0, 255].

Points Input Color Selection Valid Values ofC
xyzPoints Same color for all points

1-by-3 RGB vector, or a color name or short name, listed in theColor Valuetable.

Different color for each point M-by-3 matrix orM-by-N-by-3 matrix containing RGB values for each point.

Point cloud color of points, specified as one of:

  • M-by-1 vector

  • M-by-N矩阵

Points Input Color Selection Valid Values ofC
xyzPoints Different color for each point Vector orM-by-N矩阵. The matrix must contain values that are linearly mapped to a color in the currentcolormap.

Name-Value Arguments

Specify optional comma-separated pairs ofName,Valuearguments.Nameis the argument name andValueis the corresponding value.Namemust appear inside quotes. You can specify several name and value pair arguments in any order asName1,Value1,...,NameN,ValueN.

Example:'VerticalAxisDir','Up'sets the vertical axis direction to up.

Diameter of marker, specified as a positive scalar. The value specifies the approximate diameter of the point marker. MATLAB graphics define 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 thez-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.

Axes on which to display the visualization, specified as anAxesobject. To create anAxesobject, use theaxesfunction. To display the visualization in a new figure, leave'Parent'unspecified.

Output Arguments

collapse all

Plot axes, returned as anaxesgraphics object.

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 theComputer Vision Toolbox Preferences.

More About

collapse all

Color Value

Color Name Short Name RGB Triplet Appearance
'red' 'r' [1 0 0]

Sample of the color red

'green' 'g' [0 1 0]

Sample of the color green

'blue' 'b' [0 0 1]

Sample of the color blue

'cyan' 'c' [0 1 1]

Sample of the color cyan

'magenta' 'm' [1 0 1]

Sample of the color magenta

'yellow' 'y' [1 1 0]

Sample of the color yellow

'black' 'k' [0 0 0]

Sample of the color black

'white' 'w' [1 1 1]

Sample of the color white

Tips

  • To improve performance,pcshowautomatically 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, no downsampling is applied. The downsampling occurs only for rendering the point cloud and does not affect the saved points.

  • 查看数据或修改颜色显示值,hover over the axes toolbar and select one of the following options.

    Feature Description
    Datatip

    ClickData Tipsto view the data point values for any point in the point cloud figure. For a normal point cloud, theData Tipsdisplays thex,y,zvalues. Additional data properties for the depth image and lidar are:

    Point Cloud Data Data Value Properties
    Depth image (RGB-D sensor) Color, row, column
    Lidar Intensity, range, azimuth angle, elevation angle, row, column

    Background color

    ClickRotateand then right-click in the figure for background options.

    Colormap value

    ClickRotateand then right-click in the figure for colormap options. You can modify colormap values for the coordinate and range values available, depending on the type of point cloud displayed.

    View

    ClickRotateto change the viewing angle of the point cloud figure to theXZ,ZX,YZ,ZY,XY, or theYXplane. ClickRestore Viewto reset the viewing angle.

  • pcplayersupports the'opengl'option for theRendererfigureproperty only.

Introduced in R2015b