Main Content

pcshowpair

Visualize difference between two point clouds

Description

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.

example

pcshowpair(ptCloudA,ptCloudB,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example, pchowpair(ptCloudA,ptCloudB,BackgroundColor="yellow"), sets the figure background color to yellow.

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

Examples

collapse all

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

load("livingRoom");

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

Plot and set the viewpoint of point clouds.

figure
pcshowpair(pc1,pc2,VerticalAxis="Y",VerticalAxisDir="Down")
title("Difference Between Two Point Clouds")
xlabel("X(m)")
ylabel("Y(m)")
zlabel("Z(m)")

Figure contains an axes object. The axes object with title Difference Between Two Point Clouds, xlabel X(m), ylabel Y(m) 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

collapse all

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: pchowpair(ptCloudA,ptCloudB,BackgroundColor="yellow"), sets the figure background color to yellow.

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.

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 site 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 "on" or "off", or as numeric or logical 0 (false) or 1 (true). A value of "on" is equivalent to true, and "off" is equivalent to false. 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.

  • "on" — Display the axes and its children.

  • "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.)

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.

More About

collapse all

Version History

Introduced in R2015b

expand all