Main Content


Visualize difference between two point clouds



pcshowpair(ptCloudA,ptCloudB) creates a visualization depicting the differences between the two input point clouds. The differences are displayed using a blending of magenta for point cloud A and green for point cloud B.

pcshowpair(ptCloudA,ptCloudB,Name,Value) visualizes the differences using additional options specified by one or more Name,Value pair arguments.

ax = pcshowpair(___) returns the plot axes to the visualization of the differences, using any of the preceding syntaxes.


collapse all

Load two point clouds that were captured using a Kinect device in a home setting.


pc1 = livingRoomData{1};
pc2 = livingRoomData{2};

Plot and set the viewpoint of point clouds.

title('Difference Between Two Point Clouds')

Figure contains an axes object. The axes object with title Difference Between Two Point Clouds contains 2 objects of type scatter.

Input Arguments

collapse all

Point cloud A, specified as a pointCloud object. The function uses levels of magenta to represent ptCloudA and a pure magenta when the point cloud contains no color information.

Point cloud B, specified as a pointCloud object. The function uses levels of green to represent ptCloudB and a pure green when the point cloud contains no color information.

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: 'VerticalAxisDir','Up' sets the vertical axis direction to up.

Approximate diameter of the point marker, specified as a positive scalar. The units are in 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.

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.

Output Arguments

collapse all

Plot axes, returned as an axes graphics object. Points with NaN or Inf coordinates are not displayed.

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.


  • To improve performance, pcshowpair 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.

  • To view point data or modify color display values, hover over the axes toolbar and select one of the following options.


    Click Data Tips to view the data point values for any point in the point cloud figure. For a normal point cloud, the Data Tips displays the x,y,z values. Additional data properties for the depth image and lidar are:

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

    Background color

    Click Rotate and then right-click in the figure for background options.

    Colormap value

    Click Rotate and 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.


    Click Rotate to change the viewing angle of the point cloud figure to the XZ, ZX,YZ, ZY, XY, or the YX plane. Click Restore View to reset the viewing angle.

  • pcshowpair supports the 'opengl' option for the Renderer figure property only.

Version History

Introduced in R2015b