Align array of point clouds
aligns an array of point clouds,
ptCloudOut = pcalign(
ptClouds, into one point
cloud by using the specified transformations
applies a box grid filter, with 3-D boxes of the specified size
ptCloudOut = pcalign(
gridStep, to the aligned point cloud. Points within the
same box are merged to a single point in the output, with averaged
Align Point Clouds from View Set
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)
tforms — 3-D rigid or affine geometric transformations
rigidtform3d array | M-by-1
3-D rigid or affine geometric transformations, specified as an
M-by-1 array of
rigidtform3d objects or an M-by-1 array of
affinetform3d objects. The
argument must contain the same number of elements as the
gridStep — Size of 3-D box for grid filter
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
ptCloudOut — Aligned point cloud
Aligned point cloud, returned as a
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
Colorproperty but another one does not, then the function does not return a value for the
The function filters out points with
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version HistoryIntroduced in R2020b
R2022b: Supports new geometric transformation objects
Starting in R2022b, most Computer Vision Toolbox™ functions create and perform geometric transformations using the
premultiply convention. Accordingly, you can now specify
as an array of
affinetform3d objects, which use the premultiply convention.
Although you can still specify
tforms as an array of
affine3d objects, these objects are
not recommended because they use the postmultiply convention. You can streamline
your geometric transformation workflows by switching to the new premultiply
geometric transformation objects. For more information, see Migrate Geometric Transformations to Premultiply Convention.