Main Content

pcalign

Align an array point clouds

Description

example

ptCloudOut = pcalign(ptClouds,tforms) aligns an array of point clouds, ptClouds, into one point cloud by using the specified transformations tforms.

example

ptCloudOut = pcalign(ptClouds,tforms,gridStep) applies a box grid filter, with 3-D boxes of the specified size gridStep, to the aligned point cloud. Points within the same box are merged to a single point in the output, with averaged Color, Normal, and Intensity properties.

Examples

collapse all

Load a point cloud view set into the workspace.

data = load('vSetPointClouds.mat');
vSet = data.vSet;

Extract the point clouds and their absolute poses from the view set.

ptClouds = vSet.Views.PointCloud;
tforms   = vSet.Views.AbsolutePose;

Align the point clouds using their absolute poses, and apply a 3-D box filter of size 1 to the aligned point cloud.

gridStep = 1;
ptCloudMap = pcalign(ptClouds,tforms,gridStep);

Display the aligned point cloud map.

pcshow(ptCloudMap)
hold on
plot(vSet)

Input Arguments

collapse all

Point clouds, specified as a pointCloud array.

3-D rigid or affine geometric transformations, specified as an M-by-1 rigid3d array or an M-by-1 affine3d array. The tforms argument must contain the same number of elements as the ptClouds argument.

Size of the 3-D box for the grid filter, specified as a positive scalar. Increasing the value of gridStep can reduce memory usage by merging more points, but it can also reduce the amount of detail captured.

Data Types: single | double

Output Arguments

collapse all

Aligned point cloud, returned as a pointCloud object.

Tips

  • If the input point clouds do not all have an assigned value for a property, the function does not assign a value for that property in the returned point cloud. For example, if some of the input point clouds have values for the Color property but another one does not, then the function does not return a value for the Color property of ptCloudOut.

  • The function filters out points with NaN or Inf values.

Introduced in R2020b